我必须使用这种结构调用SOAP(使用SOAPUI获得):
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:v3='http://v3.ws.server.ldap.ws.xxx/'
xmlns:cod='http://server/Usr/codeUsr'>
<soapenv:Header/>
<soapenv:Body>
<v3:getUsr>
<cod:codeUsr>P012997</cod:codeUsr>
</v3:getUsr>
</soapenv:Body>
</soapenv:Envelope>
客户是: $ client = new SoapClient(“http://xxx.xxx.xxx.xxx:8080/ws-ldap3/wServiceV3?wsdl”);
到目前为止,我试过了:
echo "a(TT).<br/>";var_dump($client->getUsr('P012997'));
echo "b(TT).<br/>";var_dump($client->getUsr(array('cod' => 'P012997')));
echo "c(TT).<br/>";var_dump($client->getUsr(array('codeUsr' => 'P012997')));
echo "d(TT).<br/>";var_dump ($client->__soapCall('getUsr', array('parameters' => array('cod' => 'P012997'))));
echo "e(TT).<br/>";var_dump ($client->__soapCall('getUsr', array('parameters' => array('codeUsr' => 'P012997'))));
echo "f(TT).<br/>";var_dump ($client->__soapCall('getUsr', array('cod' => 'P012997')));
echo "g(TT).<br/>";var_dump ($client->__soapCall('getUsr', array('codeUsr' => 'P012997')));
没有成功。如何传递参数codeUsr?
TIA,
答案 0 :(得分:0)
我终于使用CURL解决了问题(不是这种情况)。我完全根据需要发送XML。
$xml="<same as before>";
$sDo = curl_init();
curl_setopt($sDo, CURLOPT_URL, "http://xxx.xxx.xxx.xxx:8080/ws-ldap3/wServiceV3?wsdl");
curl_setopt($sDo, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($sDo, CURLOPT_TIMEOUT, 10);
curl_setopt($sDo, CURLOPT_RETURNTRANSFER, true);
curl_setopt($sDo, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($sDo, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($sDo, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($sDo, CURLOPT_POST, true );
curl_setopt($sDo, CURLOPT_POSTFIELDS, $xml);
curl_setopt($sDo, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=utf-8", "Content-Length: " . strlen($xml)));
$result = curl_exec($sDo);
发布以防其他人遇到瓶颈而无法花费数天时间来确定如何使其发挥作用。