简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM