Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SoapClient Remap SoapAction in WSDL-mode?

I have an issue where I'm trying to use the standard PHP SoapClient to access a method on a SoapServer. The issue is that the method on the SoapServer is listed twice with the same name, but the action is different.

For example: SOAP UI shows GetStockQuote and GetStockQuote listed twice, but the second GetStockQuote is actually going to call GetStockQuoteV2.

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

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

But when I'm in wsdl-mode, it still calls GetStockQuote rather than GetStockQuoteV2.

My conclusion was that I have to run in non-wsdl mode and deal with the annoyances of that. When in non-wsdl mode, the above __soapCall appears to be calling the correct method, but because I'm in non-wsdl mode, I think there's a problem with building the appropriate AuthHeader that the server needs.

My question is, can I remap the soap action while in PHP SoapClient wsdl-mode?

like image 860
Halfstop Avatar asked Aug 12 '16 18:08

Halfstop


1 Answers

It's an ugly workaround, but as we see here -- you have ugly Soap service on another side.

  1. Take WSDL url
  2. Save it as local file
  3. And change there methods order (those bad should be 1st)

Another solution. You can extend SoapClient and inside method A actually call remote method B.

like image 51
gaRex Avatar answered Oct 25 '22 10:10

gaRex