-->

Find SOAPAction from a WSDL

2019-06-22 14:57发布

问题:

My requirement is to call a web service from Android and display the result in a nice manner.

But inside the web service's WSDL I don't find a SOAPAction. The WSDL looks like this:

<operation name="getStudentList">
 <soap:operation soapAction=""/>
 <input>
   <soap:body use="literal"/>
 </input>
 <output>
   <soap:body use="literal"/>
  </output>
</operation>

Is there any way to find the SOAPAction in some other places inside the WSDL? Can I call the web service and get a result without the SOAPAction?

回答1:

The SOAPAction is required for SOAP 1.1 over HTTP but it's hard to say what the behavior of your web service will be if you don't send a proper header. The web service may return a fault if it's missing the SOAPAction (or if it has an unexpected value) or it might do nothing at all.

The WSDL is the place to find the value to use for the SOAPAction, inside the <soap:operation>. If it's not specified for an operation or it's like in the example you posted (soapAction="") you normally need to add this to the request headers:

SOAPAction: ""

Try with an empty quoted string and it should work.