我需要在我的 SOAP 请求中有这个节点(使用 1.1):
<CredentialsHeader xmlns="http://www.url.com/Services/P24ListingService11"
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</CredentialsHeader>
所以我有以下PHP:
$client = new SoapClient("https://exdev.www.example.com/Services/example.asmx?WSDL",
array(
"trace" => 1,
"exceptions" => 0,
"cache_wsdl" => 0,
'soap_version' => SOAP_1_1
)
);
$CredentialObject = new SoapVar(array('EMail' => 'ricky@email.net', 'Password' => 'password'), SOAP_ENC_OBJECT);
生成:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/Services/Example">
<SOAP-ENV:Header>
<ns1:CredentialsHeader>
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</ns1:CredentialsHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:EchoAuthenticated/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我需要做的就是阻止它使用ns1
并实际xmlns
在节点中定义,如下所示:
<CredentialsHeader xmlns="http://www.example.com/Services/Example">
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</CredentialsHeader>
我已经在 Firefox Poster 中对其进行了测试,并且知道更改可以解决问题。