snowflake
snowflake

Reputation: 1714

JAXWS problem without namespace prefix using Jboss 4.2.3ga

I have a java service published as a JAXWS webservice using @WebServiceannotation. The service is well deployed on Jboss application server 4.2.3ga (with Jax-ws implementation provided by the application server).

The service works well when the Soap message look like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="mynamespace">
   <soapenv:Header/>
   <soapenv:Body>
        <pref:mymethod>
            <arg0>value</arg0>
        </pref:mymethod>
   </soapenv:Body>
</soapenv:Envelope>

And failed when the Soap message look like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="mynamespace">
   <soapenv:Header/>
   <soapenv:Body>
        <mymethod>
            <arg0>value</arg0>
        </mymethod>
   </soapenv:Body>
</soapenv:Envelope>

By fail I mean "mymethod" is invoked, but arg0 is null.

Does anybody know if it is the expected behaviour of JAX-WS api or a bug ? I found no reference to one or to the other.

Does anybody experienced the same problem (or success) using another JAX-WS stack ?

Upvotes: 4

Views: 4569

Answers (1)

jasso
jasso

Reputation: 13966

In the working code there is no default namespace and <mymethod> is bound to mynamespace with a prefix. Because the <arg0> element has no prefix, it is in null namespace.

In the failing code mynamespace is set as the default namespace. Because <mymethod> and <arg0> do not have any prefix, they both have mynamespace as their namespace URI.

It is not allowed to bind the empty namespace URI to any prefix. Therefore you either need to continue to use a namespace prefix in <mymethod> or you need to override the default namespace in <arg0> like this:

<arg0 xmlns="">

Note that this sets all the unprefixed child elements of <arg0> to null namespace unless you override the default namespace again.

Upvotes: 4

Related Questions