Hello Sajith,

Refer to the JAX-RPC1.1 spec to see how to use a client handler in a portable way. I believe it goes something like this:

  sf = javax.xml.rpc.ServiceFactory.newInstance();
  SEIService si = (SEIService)sf.loadService(SEIService.class);

  // register client handler
  javax.xml.rpc.handler.HandlerRegistry hr = si.getHandlerRegistry();
  java.util.List hl = new java.util.ArrayList();
hl.add(new javax.xml.rpc.handler.HandlerInfo(YourHandler.class,null,null));
  hr.setHandlerChain(new QName("http://localhost/xxx/","yourPort";),hl);

  SEI sei = si.getSEIPort();

((javax.xml.rpc.Stub)sei)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);

YourHandler should implement javax.xml.rpc.handler.Handler.

Hope that helps,
Dies


sajith wrote:
Hi Dies,

As you suggested I debugged both axis 1.1 and 1.3 it seems Axis 1.1 does not
handle "mustUnderstand", where as axis 1.3 provides a handle implementation
called "MustUnderstandChecker". This is the place where the error is
generated.
So either I could make changes to this class or I could have my own handler
instead. Since I'm very new to web services I don't know how to plug-in this
handler to axis. It doesn't seem like it cannot be externally plugged-in to
AxisClient without modifying the existing 1.3 code. Any thoughts on this will be highly appreciated.

Thanks and regards
Sajith.

-----Original Message-----
Sent: Wednesday, February 22, 2006 11:56 AM
To: [email protected]
Subject: Re: Problem with MustUnderstand headers when migrating from axis
1.1 to 1.3

Hello Sajith,

The stub seems to generate a Fault when it receives a SOAP message with a header with a mustUnderstand="1" attribute. I thought this was according to the spec, as the Axis generated stub does not understand your header. However, I believe some months ago there was some debate on this ML whether Axis should be doing this, or whether the client application should be responsible for this itself.
There was no conclusion.

If you get no response from others, you could try searching the source code for a comment regarding this change (as you said it used to work fine with Axis 1.1, maybe you can find why it was changed, and then judge whether that was a mistake or a new feature you'd have to work with). Otherwise, you could employ a client-side handler that understands the header and removes it from the SOAP message after processing it.

Good luck,
Dies


sajith wrote:
Hi,

I'm migrating from axis 1.1 to 1.3. My webservice client fails when
invoking
the method with following axis error.

I tested the same code with axis 1.1 and it works fine.

Axis fault

Exception in thread "main" AxisFault

 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand

faultSubcode:
 faultString: Did not understand "MustUnderstand" header(s):

faultActor: faultNode: faultDetail:
            {http://xml.apache.org/axis/}stackTrace:

            at

org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChe
cker.java:96)

            at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
            at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

            at org.apache.axis.client.Call.invoke(Call.java:2767)

            at org.apache.axis.client.Call.invoke(Call.java:2443)

            at org.apache.axis.client.Call.invoke(Call.java:2366)

            at org.apache.axis.client.Call.invoke(Call.java:1812)

            at

net.scandinavian.nibp2.SAPI_v2.AvailabilitySoap_BindingStub.getAvailabilityN
ewReservation(AvailabilitySoap_BindingStub.java:587)

            at Test.main(Test.java:21)

            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:585)

            at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)

            {http://xml.apache.org/axis/}hostname:sajith

Did not understand "MustUnderstand" header(s):

            at

org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChe
cker.java:96)

            at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
            at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

            at org.apache.axis.client.Call.invoke(Call.java:2767)

            at org.apache.axis.client.Call.invoke(Call.java:2443)

            at org.apache.axis.client.Call.invoke(Call.java:2366)

            at org.apache.axis.client.Call.invoke(Call.java:1812)

            at

net.scandinavian.nibp2.SAPI_v2.AvailabilitySoap_BindingStub.getAvailabilityN
ewReservation(AvailabilitySoap_BindingStub.java:587)

            at Test.main(Test.java:21)

            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:585)

            at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)

Soap Response.

<soap:Header>

        <SHAvailHandle soap:mustUnderstand="1"
xmlns="https://nibp2.scandinavian.net/SAPI";>

            <hAvail>some encoded data</hAvail>

.

.

.

Thanks in advance.

Sajith


Reply via email to