PHP - SOAP请求
问题描述:
我试图发送一个请求给我的WSDL,而当看功能__getTypes()/__getFunctions()
我有以下结果:PHP - SOAP请求
Array
(
[0] => getValuesResponseType getValues(getValues $parameters)
[1] => ecoResponse eco(eco $parameters)
)
Array
(
[0] => struct getValues{
value1 value1;
value2 value2;
}
[1] => string value1
[2] => string value2
[3] => struct eco {
string in;
}
我不知道怎么这部分代码,我在这里有点迷失 。
这是我做了什么,但不返回任何内容:
<?php
$wsdl = "http://wsdl.example";
$local_cert = 'local_cert';
$cert_pass = 'xxxxx';
$options = array();
$options['trace'] = true;
$options['exceptions'] = true;
$options['local_cert'] = $local_cert;
$options['passphrase'] = $cert_pass;
$options['cache_wsdl'] = WSDL_CACHE_NONE;
$options['soap_version'] = SOAP_1_1;
$params = array(
'value1' => 'xxxx',
'value2' => 'xxxx'
);
$request = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://wsdl.example">
<soapenv:Header/>
<soapenv:Body>
<ws:getValues>
<value1>xxxx</value1>
<value2>xxx</value2>
</ws:getValues>
</soapenv:Body>
</soapenv:Envelope>';
$location = $wsdl;
$action = "http://wsdl.example";
$version = "1";
try {
$soapClient = new SoapClient($wsdl, $options);
$getFunctions = $soapClient->__getFunctions();
$getTypes = $soapClient->__getTypes();
$response = $soapClient->__doRequest($request,$location,$action,$version);
echo '<pre>';
print_r($getFunctions);
print_r($getTypes);
print_r($response);
echo '</pre>';
}
catch (Exception $e)
{
echo $e->getMessage(), '<br />', $e->getTraceAsString();
}
嗯,我要试试这个!而且我能够解决另一个我没有加载外部实体的错误! 谢谢 – Wargio