您如何确定有效的SoapAction?

问题描述:

我正在使用NuSoap PHP library呼叫webservice. webservice似乎使用.NET;每次调用它时,都会出现有关使用无效的SoapAction header的错误.正在发送的标头是一个空字符串.如何找到服务器期望的SoapAction?

I'm calling a webservice using the NuSoap PHP library. The webservice appears to use .NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?

通过查看服务的WSDL,可以看到正在调用的服务操作期望的SoapAction.对于.NET服务,您可以通过打开Web浏览器访问服务的URL并在末尾附加?wsdl来访问WSDL.

You can see the SoapAction that the service operation you're calling expects by looking at the WSDL for the service. For .NET services, you can access the WSDL by opening a web browser to the url of the service and appending ?wsdl on the end.

在WSDL文档中,您可以看到在操作"节点下(在绑定"下)定义的SoapActions.例如:

Inside the WSDL document, you can see the SoapActions defined under the 'Operation' nodes (under 'Bindings'). For example:

<wsdl:operation name="Execute">
  <soap:operation soapAction="http://tempuri.org/Execute" style="document" />

找到要尝试调用的操作的操作节点,然后将在其中找到所需的Soap Action.

Find the operation node for the operation you're trying to invoke, and you'll find the Soap Action it expects there.