Axis2 problem in setting SOAPAction HTTP header
Asked Answered
G

2

6

I am trying co connect to a 3'rd party SOAP web service. It seems that the service can work when the HTTP SOAPAction header is an empty String (""). This is the snippet of the wsdl:

<wsdl:binding name="detailsRequestMessage" type="tns:UssdPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="details">
        <soap:operation soapAction=""/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

Where you see the soapAction=""

I generated a stubusing the Axis2 (1.5) wsdl2java.

I was hoping to get the following (the successful output when running with SoapUI):

POST /details HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: some.host
Content-Length: 323

But instead I am getting:

POST /details HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://some.url/wsussd/ussdtypes/UssdPortType/detailsRequest"
User-Agent: Axis2
Host: some.host
Content-Length: 300

Does anyone has any idea what is the problem or how do I set the soapAction in the program.

Thanks, Ronen

Gingergingerbread answered 6/10, 2009 at 12:29 Comment(0)
V
4

rperez wasn't entirely clear with his answer. I have found https://issues.apache.org/jira/browse/AXIS2-4264 which claims the issue was fixed in 1.6.0, but I still have problems in 1.6.2

However, this does work:

stub._getServiceClient().getOptions().setProperty(org.apache.axis2.Constants.Configuration.DISABLE_SOAP_ACTION, true);
Vespucci answered 12/4, 2013 at 16:37 Comment(0)
I
2

Have a look at the answer to this question...you may be able to find similar code in your generated stubs.

If that's the case, then I think you can set the action (according to the API):

serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
options.setAction("");

I think the action is handled differently depending on the SOAP version. To specify a different version:

options.setSoapVersionURI(
    org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

(or the SOAP12 version of the constant).

Hope that helps.

Ironlike answered 6/10, 2009 at 16:8 Comment(1)
I tried that with no luck. the thing that did it was to set the properties of the option . ThanksGingergingerbread

© 2022 - 2024 — McMap. All rights reserved.