You can store it in ConfigurationContext as a property.

Deepal
>
> Thanks Deepal,
>
> I now have my handler running in the appropriate phase - I even
> dispensed with the module / mar file and put the handler config
> directly in my axis2.xml, which makes things easier for me. Your tip
> also solved my multiple config issue - I just initialise the stubs
> with the custom auth mechanism with my axis2.xml and use the default
> for everything else.
>
> My last question is, where is a good place to store the authentication
> token for subsequent calls? Ideally I'd like it to live somewhere
> inside the stub. To clarify:
>
> - I create the stub and make the login() call
> - InFlow Handler gets the authentication token and stores it (one auth
> token /per target endpoint/ and there /are/ several) - where?
> - I make another call
> - OutFlow Handler needs to find the auth token - from where?
>
> At the moment I've hacked something together with static members on
> the handler but it's ugly and wrong. Any suggestions? All I have to
> start with is the MessageContext.
>
> 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
>
>
>
> *Deepal Jayasinghe <dee...@opensource.lk>*
>
> 16/10/2010 04:32
> Please respond to
> java-user@axis.apache.org
>
>
>       
> To
>       java-user@axis.apache.org
> cc
>       
> Subject
>       Re: Custom handler for header with mustUnderstand=true
>
>
>
>       
>
>
>
>
>
>
>
> 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.
>
>
> ---
>
> 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.

Reply via email to