I got this problem when I'm trying to call a WCF method from php. It just shows 500 error when I send the request.
$wsdl = "http://localhost:12019/XianglanCommuService/?wsdl";
$soapClient = new SoapClient($wsdl, array('soap_version' => SOAP_1_2));
try {
return $soapClient->Test();
} catch (SoapFault $fault) {
return $fault->faultstring;
}
So I tried to check its XML by Wireshark, the XML is like this:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/">
<env:Body>
<ns1:Test/>
</env:Body>
</env:Envelope>
But the fine XML should be like this:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/">
<env:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>
http://tempuri.org/IWCFService/Test
</wsa:Action>
</env:Header>
<env:Body>
<ns1:Test/>
</env:Body>
</env:Envelope>
So the question comes: How can I customize the header in phpsoap?