i 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:
OpUserServiceWebService proxy = new Users().getOpUserServiceWebServiceImplPort();
Map requestContext = ((BindingProvider) proxy).getRequestContext();
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
proxy.signOn("Administrator", "");
the following error appears:
Exception in thread “main” com.sun.xml.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://www.onepoint-project.com/webService}signOnResponse but found: {null}signOnResponse
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:189)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:197)
at com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.readResponse(ResponseBuilder.java:498)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:238)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:206)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
at $Proxy37.signOn(Unknown Source)
at client.Client.main(Client.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
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:
Request:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header><ns2:password xmlns:ns2="http://www.onepoint-project.com/webService">
</ns2:password>
</S:Header>
<S:Body>
<ns2:signOn xmlns:ns2="http://www.onepoint-project.com/webService">
<login>Administrator</login>
</ns2:signOn>
</S:Body>
</S:Envelope>
and response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<signOnResponse>
<user xmlns:ns2="http://www.onepoint-project.com/webService" id="Op1">
<name>Administrator</name>
<displayName>${AdministratorDisplayName}</displayName>
<description>${AdministratorDescription}</description>
<source>0</source>
<level>2</level>
<active>true</active>
<contact id="Op229376"/>
</user>
</signOnResponse>
</soap:Body>
</soap:Envelope>
i could not figure out the problem. but a hint tells me that the problem is that the namespace ns2=“http://www.onepoint-project.com/webService” 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.
Vlad