axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jatinder Kaur" <jatinder.k...@gmail.com>
Subject Re: [axis2] How to add custom SOAP Headers in Client Code
Date Tue, 28 Nov 2006 18:12:51 GMT
OK..so this way I will be able to add headers.

The way this web service works is that the first time we invoke the web
service, we need to pass in the username and password and the response will
contain a session ID that needs to be used in the subsequent calls.

So:

1. How do I add specific headers using the addHeader -- basically, what is
the syntax for using OMElement? How do I add header?
2. How do I retrieve the session ID from the response.

Thanks in advance.
Jatinder

On 11/27/06, Sanka Samaranayke <ssanka@gmail.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I agree with Robert. You you custom class to create the appropriate
> header element as
> an OMElement and add it to the ServiceClient that is used inside the
> stub.
>
>
> Stub stub = new AddressBookServiceStub();
> OMElement header = <get the header from your custom class>;
>
> ServiceClient serviceClient = stub._getServiceClient();
> serviceClient.addHeader(header)
>
>
> Best,
> Sanka
>
>
> robert lazarski wrote:
> > A simple solution in you case may be just
> > ServiceClient.addHeader(OMElement)  .
> >
> > HTH, Robert
> >
> > On 11/27/06, *robert lazarski* < robertlazarski@gmail.com
> > <mailto:robertlazarski@gmail.com>> wrote:
> >
> > Forwarding with the correct prefix.
> >
> > Back in my axis 1.x days I did that type of thing. In axis2 try
> > ServiceClient --> AxisService, using that you can get access to
> > handler chains via AxisOperation.
> >
> > Do we have docs for client side handler chains? If not, Jatinder,
> > when you get this working you can help us with that if you'd like.
> >
> > HTH, Robert
> >
> >
> > ---------- Forwarded message ---------- From: *Jatinder Kaur*
> > <jatinder.kaur@gmail.com <mailto:jatinder.kaur@gmail.com> > Date:
> > Nov 27, 2006 5:58 PM Subject: How to add custom SOAP Headers in
> > Client Code To: axis-user@ws.apache.org
> > <mailto:axis-user@ws.apache.org>
> >
> > Hi All,
> >
> > I am a newbie in this field -- so any help is greatly appreciated.
> >
> > I've a custom class file that implements javax.xml.rpc.Handler
> > class. In this custom class, I am setting the username and password
> > in the handleRequest method. The server returns a session ID back
> > that I am extracting in handleResponse method implementation.
> >
> > How can I link my custom class to the client code that I've
> > generated using Axis2. In Axis 1.4, I used something like this:
> >
> > java.util.List list =
> > service.getHandlerRegistry().getHandlerChain(new QName("
> > http://xyz.com/webservices", "createResponse")); list.add(new
> > javax.xml.rpc.handler.HandlerInfo
> > (WebSessionHandler.class,null,null));
> >
> > WebMarketingPort myProxy = (WebMarketingPort) service.getPort(new
> > QName("http://xyz.com/webservices", "createResponse"),
> > WebMarketingPort.class );
> >
> > Since I don't have the Port classes in Axis2 ( I just have the stub
> > class), what is the best way to incorporate my custom class in the
> > client code. If you can please provide some code or point me to
> > some documentation, that would be great.
> >
> > Thanks, Jatinder
> >
> >
>
>
> - --
> Sanka Samaranayake
> WSO2 Inc.
>
> http://sankas.blogspot.com/
> http://www.wso2.net/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.1 (GNU/Linux)
>
> iD8DBQFFa7SB/Hd0ETKdgNIRArz0AJ0WaTuYQbkVnuXmvN63H5imM+gUNwCeMS5T
> 4YksrgAtRqCPpRtyHC/ucpo=
> =a39J
> -----END PGP SIGNATURE-----
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Mime
View raw message