PHP SoapClient Remap SoapAction in WSDL mode?

I have a problem when I try to use standard PHP SoapClient to access a method on SoapServer. The problem is that the method on SoapServer is specified twice with the same name, but the action is different.

For example: the SOAP user interface shows that GetStockQuote and GetStockQuote are listed twice, but the second GetStockQuote will actually be called GetStockQuoteV2.

But my PHP SoapClient, if I call $ client-> GetStockQuote, it will call the first one automatically. From my research, I should do something like this.

$client->__soapCall('GetStockQuote', array($request), array('soapaction'=>'GetStockQuoteV2')); 

But when I'm in wsdl mode, it still calls GetStockQuote, not GetStockQuoteV2.

My conclusion was that I needed to work in non-wsdl mode and deal with annoyance. When in non-wsdl mode, the above __soapCall seems to call the correct method, but due to the fact that I'm in non-wsdl mode, I think that there is a problem with building the corresponding AuthHeader that the server requires.

My question is: can I reassign the action of soap in PHP SoapClient wsdl-mode?

+6
source share
1 answer

This is an ugly workaround, but as we see here, you have an ugly soap service on the other hand.

  • Take the WSDL URL
  • Save it as a local file
  • And change the order of the methods (these bad ones should be 1st)

Another solution. You can extend SoapClient inside the method as well. Actually call remote method B.

+2
source

All Articles