我试图使用php soap客户端进行肥皂调用,但它一直给我“请求不能为空。请提供请求详细信息。”。我在这里做错了什么?
$username = 'myusername_example';
$password = '123456787';
$url = "http://trail.dexceldesigns.com/m2m/APIwsdls/SessionService/SessionService.wsdl";
$soapclient = new \SoapClient($url);
try{
$params = array(
'Username' => $username,
'Password' => $password
);
$response = $soapclient->LogIn($params);
}
catch(\SoapFault $fault)
{
echo '<br/>'.$fault->getLine();
echo '<br/>Message: '.$fault->getMessage();
echo '<br/>Trace: '.$fault->getTraceAsString();
echo '<br/><br/>'.$fault->getCode();
echo '<br/><br/>'.$fault->getFile();
}
var_dump($soapclient->__getLastRequest());
编辑: var_dump的输出($ soapclient-&gt; __ getLastRequest());永远是空的
编辑:2(这是根据文档的请求)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/NPhase.UnifiedWebService.APIs.v2.Contract.SessionService" xmlns:ns2="http://nphase.com/unifiedwebservice/v2">
<SOAP-ENV:Body>
<ns2:LogIn>
<ns2:Input>
<ns1:Username>?</ns1:Username>
<ns1:Password>?</ns1:Password>
</ns2:Input>
</ns2:LogIn>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>