axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: Custom handler for header with mustUnderstand=true
Date Sat, 16 Oct 2010 03:32:53 GMT


On 10/15/2010 9:50 AM, Stephanos Piperoglou wrote:
>
> Hi everyone,
>
> I'm trying to use Axis2 to build a client that communicates with a
> third-party web service that uses a proprietary authentication
> mechanism involving a SOAP header. It works like this:
>
> 1. You call a login() method in the usual way (no extra headers) and
> the SOAP envelope in the response contains a header (with
> mustUnderstand="true") with an authentication token
> 2. Subsequent request need to contain this token in an authentication
> header
>
> I've created an ADB stub using wsdl2java and (after a bit of tinkering
> to set Expect: 100-continue HTTP header) I am able to call the login()
> method but the client chokes on the header in the response:
>
> Exception in thread "Main Thread" _java.lang.NullPointerException_
>         at
> org.apache.axis2.engine.AxisEngine.checkMustUnderstand(_AxisEngine.java:97_)
>
>         at
> org.apache.axis2.engine.AxisEngine.receive(_AxisEngine.java:163_)
>         at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(_OutInAxisOperation.java:364_)
>
>         at
> org.apache.axis2.description.OutInAxisOperationClient.send(_OutInAxisOperation.java:417_)
>
>         at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(_OutInAxisOperation.java:229_)
>
>         at
> org.apache.axis2.client.OperationClient.execute(_OperationClient.java:165_)
>
>         at
> com.db.pvsax.idssoap.MarketDataServiceStub.loginXML(_MarketDataServiceStub.java:849_)
>
>         at com.db.pvsax.idssoap.IdsSample.main(_IdsSample.java:24_)
>
> From what I can gather I need to write a module with a handler that
> will deal with this error. I wrote a Module and a Handler class,
> created module.xml, packaged them all into a .mar file put that and an
> axis2.xml (with references to the module and the new phases) in the
> classpath but nothing seems to be changing.
>
> Questions for you fine people:
>
> 1. How can I figure out why my handler isn't being invoked? Is it
> enough to put axis2.xml in the classpath? Any way to confirm (e.g. via
> debug logging) that the module is being loaded?
This is not enough, if you change the default axis2.xml, then you need
to create your stub with that axis2.xml. Create a configurationContext
by pointing to your axis2.xml and the create the stub using that
configuration context.
>
>
> 2. How can my handler tell Axis that it understood the mustUnderstand
> header to prevent the NPE above?
Once you process the soap header, you can set the processed flag to true.
>
> 3. How can I configure the handler to only be used with this
> particular web service and not the others I access from the same
> system that don't have this authentication system? axis2.xml seems to
> be a global config that would break everything else.
If there is a name space or something in the header then you can use
that as a way of telling your handle. Another option is to configure it
to use the URL based filtering.
>
> Regards,
> Stephanos Piperoglou
> Price Control
> GTO - BAC IT
> +44 20 754 59007
>
> This mail is transmitted to you on behalf of the Great East London
> Software Company
> Diese Post wird Ihnen im Namen der Great East London Software Company
> ├╝bermittelt
>
>
> ---
>
> This e-mail may contain confidential and/or privileged information. If
> you are not the intended recipient (or have received this e-mail in
> error) please notify the sender immediately and delete this e-mail.
> Any unauthorized copying, disclosure or distribution of the material
> in this e-mail is strictly forbidden.
>
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.

Mime
View raw message