PHP Fatal error: “The SOAP action specified on the message, '', does not match the HTTP SOAP Action”

后端 未结 2 629
清酒与你
清酒与你 2020-12-07 02:30

I\'m attempting to write a PHP script that will connect to the SOAP client for our SightMax interface. With the code below I am able to print out a list of functions availa

相关标签:
2条回答
  • 2020-12-07 03:01

    You should give the SOAP Action. Since you do not include it in the initialization of SoapClient, it doesn't match the SOAP Action of the web service. Make sure you know what the SOAP Action is before connecting.

    Read http://www.oreillynet.com/xml/blog/2002/11/unraveling_the_mystery_of_soap.html for more on the subject.

    0 讨论(0)
  • 2020-12-07 03:14

    WCF seems to be looking for the action in the SOAP envelope. You can add it to your call with PHP's SoapClient this way:

    $actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing',
                                   'Action',
                                   'http://soapaction.that.was.in.the.wsdl');
    $client->__setSoapHeaders($actionHeader);
    

    If you change the third parameter and add that between your instantiation of $client and the __call() it should clear the error (and possibly bring on new ones, isn't SOAP fun?)

    Also FYI, having just gone through this same problem, I found the __getLastRequestHeaders(), __getLastRequest(), __getLastResponseHeaders(), and __getLastResponse() functions very handy to see if what I was trying had any effect (note that you need to add "trace" => "1" to your SoapClient options for those to work.)

    0 讨论(0)
提交回复
热议问题