我在使用soap的soap请求时,使用soap获取faultcode错误。
<soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring> 11|Session|</faultstring></soap:Fault></soap:Body>
请提出有关此错误的建议。
我在PHP中使用以下代码:
$request = '<soapenv:Envelope xmlns:soapenv="..>
<soapenv:Header xmlns:add="http://www.w3.org/2005/08/addressing">
<MessageID>...
<oas:Security xmlns:..">
<oas:UsernameToken oas1:Id="UsernameToken-1">
...
</oas:UsernameToken>
</oas:Security>
<awsse:Session TransactionStatusCode="Start" xmlns:awsse="http://xml.amadeus.com/2010/06/Session_v3"/>
</soapenv:Header>
<soapenv:Body>
....
</soapenv:Body>
</soapenv:Envelope>';
$soapaction = "..";
$url = "..";
$headers = array(
"Accept-Encoding: gzip,deflate",
"Content-Type: text/xml;charset=UTF-8",
"SOAPAction: $soapaction",
"Connection: Keep-Alive",
"Host: nodeD1.test.com",
"User-Agent: ".$_SERVER['HTTP_USER_AGENT'],
"Content-length: ".strlen($request)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_ENCODING, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
我尝试使用带有SoapClient类的$ client-&gt; __ doRequest方法。
答案 0 :(得分:0)
通常,这是由于身份验证问题引起的。您构造的请求由于身份验证或标头数据不正确而无法到达目标资源。请尝试此操作。
-您应检查<soapenv:Header>.
UserToken
中的-用户名可能丢失或不正确。