Skip to main content

Exception in JAX-WS client

10 replies [Last post]
tsegreti
Offline
Joined: 2008-12-20

Hello,
I have a simple WCF service that I am trying to consume using a JAX-WS client and I seem to be running up against an interoperability issue. I have been able to consume the WCF web service from a WCF client so I know the service is at least halfway decent. The stack trace that I am getting when I try to invoke a method on the WCF service from the Java client is this:

javax.xml.ws.soap.SOAPFaultException: MustUnderstand headers:[{http://www.w3.org/2005/08/addressing}Action] are not understood
at com.sun.xml.internal.ws.protocol.soap.MUTube.createMUSOAPFaultException(MUTube.java:140)
at com.sun.xml.internal.ws.protocol.soap.ClientMUTube.processResponse(ClientMUTube.java:82)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:591)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:540)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:525)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:422)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:235)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:120)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:230)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
at $Proxy34.submitTxn(Unknown Source)
at com.trmi.lane.plazaproxy.PlazaProxyWSIntegrationTest.testSubmitTransactionToWebService(PlazaProxyWSIntegrationTest.java:91)
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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

I can give some more information if needed but I was wondering if the problem might be obvious to someone?
Thanks!
Tom

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gms5002
Offline
Joined: 2010-01-11

Hi ramapulavarthi - can you clarify what you mean (or point me to an example). I have a client sending my server a soap message with mustUnderstand="1" on a header, and I am not sure how to make my webservice accept this message. Thanks.

ramapulavarthi
Offline
Joined: 2004-06-01

Since you are trying to send some SOAP headers as mustUnderstand that are not processed by the server-side framework or the application, You can configure a SOAPHandler on the Web Service and process the corresponding mu headers and also explicitly specify in the SOAPHandler that it claims the headers with those QNames (Override getHeaders() http://java.sun.com/javase/6/docs/api/javax/xml/ws/handler/soap/SOAPHand... ).
See http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_Aug06.html#2 for details on configuring server-side handler.

al_sm
Offline
Joined: 2009-12-28

Hi tsegreti ,
Did you able to resolve the issue? If so how?

Thanks

ramapulavarthi
Offline
Joined: 2004-06-01

If you are facing the same problem, post your wsdl.

I doubt if the service is using WS-Policy to indicate the use of Addressing, which can only be understood by Metro. You could try with Metro instead of just standalone JAX-WS. Latest version JAX-WS RI (2.2) should have no problem with such wsdls.

al_sm
Offline
Joined: 2009-12-28

Hi ramapulavarthi,
I will explain my problem in detail.
I have created a jax-ws web service client which is using the code generated from the wsdl.
I am using a handler to set the headers before sending to the web service. I am able to set the headers and able to send the soap message to the web service. The web service is able to process my soap message and send back the response to my client.
In my client I am expecting that message to come to handleMessage() method in my client handler. But instead of that it is throwing the MustUnderstand exception
(javax.xml.ws.soap.SOAPFaultException: MustUnderstand headers:[{http://schemas.xmlsoap.org/ws/2004/03/addressing}MessageID, {http://schemas.xmlsoap.org/ws/2004/03/addressing}To, {http://schemas.xmlsoap.org/ws/2004/03/addressing}Action, {http://schemas.xmlsoap.org/ws/2002/07/utility}Timestamp, {http://schemas.xmlsoap.org/ws/2004/03/addressing}From, {http://schemas.xmlsoap.org/ws/2004/03/addressing}RelatesTo] are not understood)

So I am not able to get the response object in my client.
I am setting System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
So I am able to see the http message response from the service.

This is the response header from the service
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
http://services.test.com/test/#Echo/Response/
uuid:bb1cf43050739c45:1f3c76df:12573bacd6b:-7fa9
uuid:13a85b05:1257f14e0a7:-7ffd
http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous
http://services.test.com/test/update
2009-12-11T14:03:44.246-05:00

Any idea how to remove this exception?
Many thanks in advance.

Thanks

ramapulavarthi
Offline
Joined: 2004-06-01

Is addressing enabled on the client? These addressing headers should be processed by JAX-WS if AddressingFeature is enabeld on the client.

If you intend to handle any headers in the handler that have mustUnderstand=true, then you need to declare those header Qnames in your handler for all the headers not handled by the application or the jax-ws framework. See http://java.sun.com/javase/6/docs/api/javax/xml/ws/handler/soap/SOAPHandler.html#getHeaders()

al_sm
Offline
Joined: 2009-12-28

Thanks a lot Rama

Glen Mazza

BTW, your problem might be similar to this reader's:
http://www.nabble.com/Problem-with-wsimport-parsing-a-WSDL-that-includes...

Namely, that Metro appears to want the older WS-Addressing namespace from
2004.

metro-3 wrote:
>
> Hello,
> I have a simple WCF service that I am trying to consume using a JAX-WS
> client and I seem to be running up against an interoperability issue. I
> have been able to consume the WCF web service from a WCF client so I know
> the service is at least halfway decent. The stack trace that I am getting
> when I try to invoke a method on the WCF service from the Java client is
> this:
>
> javax.xml.ws.soap.SOAPFaultException: MustUnderstand
> headers:[{http://www.w3.org/2005/08/addressing}Action] are not understood
>

--
View this message in context: http://www.nabble.com/Exception-in-JAX-WS-client-tp22254907p22257460.html
Sent from the Metro - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

Glen Mazza

Hmmm. If I understand correctly, your client cannot understand a particular
header so it is raising an exception, but whether or not it understands the
header shouldn't matter, because the SOAP client has already gotten the
response within the SOAP:body. Also, I'm not sure how the client can claim
it doesn't understand a particular header unless you explicitly program it
to raise such an exception (i.e., a SOAP client cannot understand header foo
if and only if you code it to raise an exception should it receive foo), so
I'm not sure what the problem is.

If not much effort, I would try to quickly access that same web service
provider using a CXF client, and see what exception *it* gives you--it might
provide you with more or different troubleshooting clues:
http://www.jroller.com/gmazza/date/20090101

Could there be something wrong with that Action URI? I don't know.

HTH,
Glen

metro-3 wrote:
>
> Hello,
> I have a simple WCF service that I am trying to consume using a JAX-WS
> client and I seem to be running up against an interoperability issue. I
> have been able to consume the WCF web service from a WCF client so I know
> the service is at least halfway decent. The stack trace that I am getting
> when I try to invoke a method on the WCF service from the Java client is
> this:
>
> javax.xml.ws.soap.SOAPFaultException: MustUnderstand
> headers:[{http://www.w3.org/2005/08/addressing}Action] are not understood
> at
> com.sun.xml.internal.ws.protocol.soap.MUTube.createMUSOAPFaultException(MUTube.java:140)
> at
> com.sun.xml.internal.ws.protocol.soap.ClientMUTube.processResponse(ClientMUTube.java:82)
> at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:591)
> at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:540)
> at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:525)
> at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:422)
> at com.sun.xml.internal.ws.client.Stub.process(Stub.java:235)
> at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:120)
> at
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:230)
> at
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
> at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
> at $Proxy34.submitTxn(Unknown Source)
> at
> com.trmi.lane.plazaproxy.PlazaProxyWSIntegrationTest.testSubmitTransactionToWebService(PlazaProxyWSIntegrationTest.java:91)
> 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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
> at
> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
> at
> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
> at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
> at
> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
> at
> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
> at
> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
> at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
> at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> at
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> I can give some more information if needed but I was wondering if the
> problem might be obvious to someone?
> Thanks!
> Tom
> [Message sent by forum member 'tsegreti' (tsegreti)]
>
> http://forums.java.net/jive/thread.jspa?messageID=334335
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>
>

--
View this message in context: http://www.nabble.com/Exception-in-JAX-WS-client-tp22254907p22257385.html
Sent from the Metro - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

creplogle
Offline
Joined: 2006-05-05

What you say about ignoring headers that aren't understood is incorrect. If the service returns a header with the "mustUnderstand" attribute and the client doesn't explicitly handle the header, then the runtime is required to raise an exception.

>
> Hmmm. If I understand correctly, your client cannot
> understand a particular
> header so it is raising an exception, but whether or
> not it understands the
> header shouldn't matter, because the SOAP client has
> already gotten the
> response within the SOAP:body. Also, I'm not sure
> how the client can claim
> it doesn't understand a particular header unless you
> explicitly program it
> to raise such an exception (i.e., a SOAP client
> cannot understand header foo
> if and only if you code it to raise an exception
> should it receive foo), so
> I'm not sure what the problem is.
>
> If not much effort, I would try to quickly access
> that same web service
> provider using a CXF client, and see what exception
> *it* gives you--it might
> provide you with more or different troubleshooting
> clues:
> http://www.jroller.com/gmazza/date/20090101
>
> Could there be something wrong with that Action URI?
> I don't know.
> HTH,
> Glen
>
>
> metro-3 wrote:
> >
> > Hello,
> > I have a simple WCF service that I am trying to
> consume using a JAX-WS
> > client and I seem to be running up against an
> interoperability issue. I
> > have been able to consume the WCF web service from
> a WCF client so I know
> > the service is at least halfway decent. The stack
> trace that I am getting
> > when I try to invoke a method on the WCF service
> from the Java client is
> > this:
> >
> > javax.xml.ws.soap.SOAPFaultException:
> MustUnderstand
> >
> headers:[{http://www.w3.org/2005/08/addressing}Action]
> are not understood
> > at
> >
> com.sun.xml.internal.ws.protocol.soap.MUTube.createMUS
> OAPFaultException(MUTube.java:140)
> > at
> >
> com.sun.xml.internal.ws.protocol.soap.ClientMUTube.pro
> cessResponse(ClientMUTube.java:82)
> > at
> com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.j
> ava:591)
> > at
> com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.ja
> va:540)
> > at
> com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.jav
> a:525)
> > at
> com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.j
> ava:422)
> > at
> com.sun.xml.internal.ws.client.Stub.process(Stub.java:
> 235)
> > at
> com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(S
> EIStub.java:120)
> > at
> >
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.i
> nvoke(SyncMethodHandler.java:230)
> > at
> >
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.i
> nvoke(SyncMethodHandler.java:210)
> > at
> com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIS
> tub.java:103)
> > at $Proxy34.submitTxn(Unknown Source)
> > at
> >
> com.trmi.lane.plazaproxy.PlazaProxyWSIntegrationTest.t
> estSubmitTransactionToWebService(PlazaProxyWSIntegrati
> onTest.java:91)
> > at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMeth
> odAccessorImpl.java:39)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Delega
> tingMethodAccessorImpl.java:25)
> > at
> java.lang.reflect.Method.invoke(Method.java:597)
> > at
> org.junit.internal.runners.TestMethod.invoke(TestMetho
> d.java:59)
> > at
> >
> org.junit.internal.runners.MethodRoadie.runTestMethod(
> MethodRoadie.java:98)
> > at
> org.junit.internal.runners.MethodRoadie$2.run(MethodRo
> adie.java:79)
> > at
> >
> org.junit.internal.runners.MethodRoadie.runBeforesThen
> TestThenAfters(MethodRoadie.java:87)
> > at
> org.junit.internal.runners.MethodRoadie.runTest(Method
> Roadie.java:77)
> > at
> org.junit.internal.runners.MethodRoadie.run(MethodRoad
> ie.java:42)
> > at
> >
> org.junit.internal.runners.JUnit4ClassRunner.invokeTes
> tMethod(JUnit4ClassRunner.java:88)
> > at
> >
> org.junit.internal.runners.JUnit4ClassRunner.runMethod
> s(JUnit4ClassRunner.java:51)
> > at
> >
> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUn
> it4ClassRunner.java:44)
> > at
> >
> org.junit.internal.runners.ClassRoadie.runUnprotected(
> ClassRoadie.java:27)
> > at
> >
> org.junit.internal.runners.ClassRoadie.runProtected(Cl
> assRoadie.java:37)
> > at
> >
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit
> 4ClassRunner.java:42)
> > at
> >
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestRefer
> ence.run(JUnit4TestReference.java:45)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.TestExecution.ru
> n(TestExecution.java:38)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
> .runTests(RemoteTestRunner.java:460)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
> .runTests(RemoteTestRunner.java:673)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
> .run(RemoteTestRunner.java:386)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
> .main(RemoteTestRunner.java:196)
> >
> > I can give some more information if needed but I
> was wondering if the
> > problem might be obvious to someone?
> > Thanks!
> > Tom
> > [Message sent by forum member 'tsegreti'
> (tsegreti)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=3343
> 35
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> users-unsubscribe@metro.dev.java.net
> > For additional commands, e-mail:
> users-help@metro.dev.java.net
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Exception-in-JAX-WS-client-tp222
> 54907p22257385.html
> Sent from the Metro - Users mailing list archive at
> Nabble.com.
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail:
> users-help@metro.dev.java.net