JAXWS issue without namespace prefix using Jboss 4.2.3ga

I have a java service published as a JAXWS web service using @WebServiceannotation. The service is well deployed on the application server 4.2.2 (Jboss application) provided by the application server.

The service works well when the Soap message looks 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 looks 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 mistake, I mean that "mymethod" is called, but arg0 is null.

Does anyone know if the expected JAX-WS api behavior or error? I did not find links to one or the other.

Has anyone encountered the same problem (or success) using a different JAX-WS stack?

+4
source share
1 answer

There is no default namespace in the working code, and <mymethod> bound to mynamespace with a prefix. Since the <arg0> element has no prefix, it is in an empty namespace .

In failed code, mynamespace set as the default namespace. Since <mymethod> and <arg0> have no prefix, they have mynamespace as their namespace URI.

You cannot associate an empty namespace URI with any prefix. Therefore, you either need to continue to use the namespace prefix in <mymethod> , or you need to override the default namespace in <arg0> as follows:

 <arg0 xmlns=""> 

Note that this sets all incomplete <arg0> child elements to empty namespaces if you have not yet redefined the default namespace.

+4
source

Source: https://habr.com/ru/post/1340351/


All Articles