Login with  Log in with facebook
Hiring Manager? SIGN UP HERE
1

Hi,

I am trying to access a web service in another web service(hosted in Axis 2). I am using Spring-WS in Axis2 to access the external web service. The XML bindings are generated via JAXB. Now when I am trying to send a request to the external web service it is forming a request in the following form

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

    <soapenv:Body>

        <testExternalService xmlns:ns3="external.webservice.namespace">

            <arg0>some_value</arg0>

            <arg1>some_value</arg1>

            <arg2>some_value</arg2>

            <arg3>some_value</arg3>

            .

            .

            .

            <argn>some_value</argn>

        </testExternalService>

    </soapenv:Body>

</soapenv:Envelope>

 

For the above request the external service is throwing NPE. However, If modify the request(I used SOAPUI for this) in following way, it works fine.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

    <soapenv:Body>

        <testExternalService xmlns="external.webservice.namespace">

            <arg0 xmlns="">some_value</arg0>

            <arg1 xmlns="">some_value</arg1>

            <arg2 xmlns="">some_value</arg2>

            <arg3 xmlns="">some_value</arg3>

            .

            .

            .

            <argn xmlns="">some_value</argn>

        </testExternalService>

    </soapenv:Body>

</soapenv:Envelope>

 

Please note in this new form, namespace prefix is removed from the operation(testExternalService) tag and empty namespace declaration is made for all the arguments for that operation.

 

Now these are my questions:

 

1. What is the reason for failure of first request and success of second request?

2. Do we have some method in Spring-WS such that the request is formed in this way?

3. Can this problem be due to Axis2 because same code accessing that external service works fine in my another Spring MVC applicaiton?

Vikas Agarwal
07/10/2011 at 06:43
1 Answer
1
1

I have found the solution. I have explicitly set the namespace (external.webservice.namespace), for the XmlRootElement annotation, in JAXB generated class for testExternalService and it worked just fine. :)

Vikas Agarwal
07/20/2011 at 06:48

If you want to post any answer to this forum then you need to log in.
Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *
Details