File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes unexpected XML tag in JAX-WS client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "unexpected XML tag in JAX-WS client" Watch "unexpected XML tag in JAX-WS client" New topic

unexpected XML tag in JAX-WS client

Turian Vlad

Joined: Oct 17, 2009
Posts: 12
Hi all,
I have fought today with a trully strange problem.

So I am trying to consume a web service using a jax-ws client. i do not have access to the web serviceimplementation because it is a third party.

My client code looks like this:

the following error appears:

i used soap-ui to test the the web service and it works like a charm.
also i used wireshark to see what xml messages are transmitted throught the wire and the messages are:

and response:

i could not figure out the problem. but a hint tells me that the problem is that the namespace ns2="" is on the user tag and not on the signOnResponse tag.
i used wsimport to generate the necessary classes on the client.
if this is the problem are there any workarounds on it, something to do on the client (because i do not have access to the web service implementation)?
what is stranger is that the code works when using Axis 2

Thank you for your answers.

Freedom cannot be bought! You say the price is small?!... do not fool yourselves... It will get bigger and bigger until one day when the price of freedom will be freedom itself! (Vlad The Impailer)
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Turian,
what is stranger is that the code works when using Axis 2

Why do you want to use JAX-WS if it is already working with Axis2?

It looks like WSDL provided to you was modified since your service provider created web service, owing to the fact that signOnResponse namespace is not appearing in the response but is expeceted by your JAX-WS client. Can you try to tweak your WSDL by removing the namespace for signOnResponse and regenerate the client?

(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Turian Vlad

Joined: Oct 17, 2009
Posts: 12
Hi Naren,

Thank you for your answer. Yes...i've tried to eliminate the namespace occurence from the wsdl and to generate the client code again. Unfortunately the problem still remains.

The wsdl generated by wsimport I presume, from the url that my web service provider gave me is:

attemting to remove the namespace from the top did not solved the problem.

if let's say i go over the generated classes and i remove all namespace occurences the problem is not solved either: it is just transformed into:

It is starting to drive me crazy. As i see things there are 2 things i could do:
1. modify the client so that it would not expect a certain namespace(i wasn't able to do that) and i don't believe it is a smart thing to do because when running wsimport again all the modifications will be lost
2. altering somehow the incoming soap message in order the add the namespace on the signOnResponse tag. i don't know how to do this either.

Any help will be appreciated.

Thank you all,
I agree. Here's the link:
subject: unexpected XML tag in JAX-WS client
It's not a secret anymore!