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.
我有一个问题,我试图使用标准的PHP SoapClient来访问SoapServer上的一个方法。问题是SoapServer上的方法被用相同的名称列出了两次,但是操作是不同的。
For example: SOAP UI shows GetStockQuote and GetStockQuote listed twice, but the second GetStockQuote is actually going to call GetStockQuoteV2.
例如,SOAP UI显示了两次列出的GetStockQuote和GetStockQuote,但是第二个GetStockQuote实际上是调用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.
但是我的PHP SoapClient,如果我调用$client->GetStockQuote,它会自动调用第一个。根据我的研究,我必须做这样的事情。
$client->__soapCall('GetStockQuote', array($request), array('soapaction'=>'GetStockQuoteV2'));
But when I'm in wsdl-mode, it still calls GetStockQuote rather than GetStockQuoteV2.
但在wsdl模式下,它仍然调用GetStockQuote而不是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.
我的结论是,我必须以非wsdl模式运行,并处理其中的烦恼。当处于非wsdl模式时,上面的__soapCall似乎正在调用正确的方法,但是由于我处于非wsdl模式,我认为构建服务器需要的适当的AuthHeader存在问题。
My question is, can I remap the soap action while in PHP SoapClient wsdl-mode?
我的问题是,我可以在PHP SoapClient wsdl模式下重新映射soap操作吗?
1 个解决方案
#1
2
It's an ugly workaround, but as we see here -- you have ugly Soap service on another side.
这是一个丑陋的解决方案,但是正如我们在这里看到的——另一边有丑陋的Soap服务。
- Take WSDL url
- 将WSDL url
- Save it as local file
- 保存为本地文件
- And change there methods order (those bad should be 1st)
- 改变方法顺序(坏的应该是1)
Another solution. You can extend SoapClient and inside method A actually call remote method B.
另一个解决方案。您可以扩展SoapClient并在方法A内部调用远程方法B。
#1
2
It's an ugly workaround, but as we see here -- you have ugly Soap service on another side.
这是一个丑陋的解决方案,但是正如我们在这里看到的——另一边有丑陋的Soap服务。
- Take WSDL url
- 将WSDL url
- Save it as local file
- 保存为本地文件
- And change there methods order (those bad should be 1st)
- 改变方法顺序(坏的应该是1)
Another solution. You can extend SoapClient and inside method A actually call remote method B.
另一个解决方案。您可以扩展SoapClient并在方法A内部调用远程方法B。