Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 51448 invoked from network); 24 Apr 2007 22:27:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2007 22:27:59 -0000 Received: (qmail 20754 invoked by uid 500); 24 Apr 2007 22:27:55 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 20737 invoked by uid 500); 24 Apr 2007 22:27:55 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 20726 invoked by uid 99); 24 Apr 2007 22:27:55 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 15:27:55 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of anilchukkapalli@gmail.com designates 64.233.162.228 as permitted sender) Received: from [64.233.162.228] (HELO nz-out-0506.google.com) (64.233.162.228) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 15:27:48 -0700 Received: by nz-out-0506.google.com with SMTP id m7so5302nzf for ; Tue, 24 Apr 2007 15:27:27 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=mdYCmhk5XUimcbwdNnw7NO9wUeuYr3qUjWrR3vhvwJW7KnPWO11KwCQth3NEqgRCNGwX/v8hGidK7HkgiQwL8LLFPmK+LIZkeiOmCcg8nbdvrMTXrRXQwr08lKFKkMgJODYSWQf289GM/jHxy+0q1EdchfdwlFLHRZWplAEXF5k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ZSzewmkkvNhepAFKXWy0APWMqRSxy+8rU4GeSKY0h1h81vBULiZcuACw0IOKmqFSD/SiPryeZMKWQeekk5WKB+axobaOjd+tlomg5b/vSoWMXl86suKD5MW70yLuehjRKoIa8ZB2u7OlAH/QLLD1LVUAIeBEKObKyTW01/FPucE= Received: by 10.114.89.1 with SMTP id m1mr3466096wab.1177453646720; Tue, 24 Apr 2007 15:27:26 -0700 (PDT) Received: by 10.114.52.7 with HTTP; Tue, 24 Apr 2007 15:27:26 -0700 (PDT) Message-ID: <6c029ec80704241527t5311d829t876b69ac8277e29f@mail.gmail.com> Date: Tue, 24 Apr 2007 17:27:26 -0500 From: "Anil Chukkapalli" To: axis-user@ws.apache.org Subject: Re: Axis2 Manage Session Cookie Manually In-Reply-To: <462D8A57.4050302@opensource.lk> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_34407_12980857.1177453646642" References: <6c029ec80704231525k54cb3d81vbd7591cac79681ea@mail.gmail.com> <462D8A57.4050302@opensource.lk> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_34407_12980857.1177453646642 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Deepal In your article "Invoking Web Services using Axis 2 ", in the section "Working with operationclient" in step6 it is stated that the same method works and you can access the response message context Thanks Anil On 4/23/07, Deepal Jayasinghe wrote: > > Hi Anil, > > Anil Chukkapalli wrote: > > > Hi > > > > The problem that i am having is > > > > MessageContext inMsgCtx = MessageContext.getCurrentMessageContext(); > > Yes , at the client side this method return null, and it only work > inside the server side. > > To set the cookie try to do smt like below, (I never tried , but hope it > will work) > > ServiceClient sc= new ServiceClient(); > sc.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING ,"Cookie > Value"); > > > > > is returning me a null, is inMsgCtx a predefined class or an object, > > when should i call " MessageContext.getCurrentMessageContext()", i > > called it after i got the response. I am using the stub created using > > wsdl2java tool to create the stub so i had to do something in the > > effect of > > > > xyzStub.OpenDBResponse response = xyzStub.OpenDB(openDB); > > > > Thank you > > Anil > > > > On 4/23/07, *James Arbo* > > wrote: > > > > I've successfully retrieved and returned http session cookies. > > > > > > > > Here's a snippet for reading a cookie from an axis2 client: > > > > String incomingCookie = (String) > > inMsgCtx.getServiceContext().getProperty(HTTPConstants.COOKIE_STRING > ); > > > > > > > > > > Here's one for writing a cookie. > > > > > > > > /* > > > > * This is how to add a custom header, such as a > > cookie > > > > */ > > > > Header hdr = new Header("Cookie","my_cookie=xyz;"); > > > > ArrayList headers = new ArrayList(); > > > > headers.add(hdr); > > > > opts = outMsgCtx.getOptions(); > > > > opts.setProperty(HTTPConstants.HTTP_HEADERS > ,headers); > > > > > > > > You could do something similar to the above but the easiest way > > for me to get this working was to set the > > manageTransportSession=true in axis2.xml and then use the > > following on the client side: > > > > opts.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,true); > > > > > > > > This tells axis to re-use the httpclient object for second, third, > > etc.. requests. If this is done, the http-client remembers the > > JSESSIONID from the first request and sends it back to the server > > on subsequent requests. > > > > > > > > > > > > -Jay > > > > > > > > > > > > -----Original Message----- > > *From:* Anil Chukkapalli [mailto:anilchukkapalli@gmail.com > > ] > > *Sent:* Monday, April 23, 2007 2:48 PM > > *To:* axis-user@ws.apache.org > > *Subject:* Axis2 Manage Session Cookie Manually > > > > > > > > Hi > > > > Is there any way we can manage sessions manually using Axis2, my > > non java web service maintains session using cookies. Is there a > > way my Axis2 client can read the soap/http header to extract the > > session information and use the extracted infromation for further > > web service calls, example getting the UUID from the header and > > use the UUID to create a cookie in my Axis2 client using > > setProperty. I have tried using the set manage session method to > > true but that does not work. > > > > Can you please point me to another thread that answers my > > question if you are unable to answer this question. > > > > Thanks > > Anil > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org > For additional commands, e-mail: axis-user-help@ws.apache.org > > ------=_Part_34407_12980857.1177453646642 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Deepal

 In your article "Invoking Web Services using Axis 2 ", in the section "Working with operationclient" in step6 it is stated that the same method works and you can access the response message context

Thanks
Anil

On 4/23/07, Deepal Jayasinghe <deepal@opensource.lk> wrote:
Hi Anil,

Anil Chukkapalli wrote:

> Hi
>
>   The problem that i am having is
>
>  MessageContext inMsgCtx = MessageContext.getCurrentMessageContext();

Yes , at the client side this method return null, and it only work
inside the server side.

To set the cookie try to do smt like below, (I never tried , but hope it
will work)

ServiceClient sc= new ServiceClient();
sc.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING ,"Cookie
Value");

>
>  is returning me a null, is inMsgCtx a predefined class or an object,
> when should i call " MessageContext.getCurrentMessageContext()", i
> called it after i got the response. I am using the stub created using
> wsdl2java tool to create the stub so i had to do something in the
> effect of
>
>  xyzStub.OpenDBResponse response = xyzStub.OpenDB(openDB);
>
> Thank you
> Anil
>
> On 4/23/07, *James Arbo* < arboj@copyright.com
> <mailto:arboj@copyright.com>> wrote:
>
>     I've successfully retrieved and returned http session cookies.
>
>
>
>     Here's a snippet for reading a cookie from an axis2 client:
>
>                     String incomingCookie = (String)
>     inMsgCtx.getServiceContext().getProperty( HTTPConstants.COOKIE_STRING);
>
>
>
>
>     Here's one for writing a cookie.
>
>
>
>                     /*
>
>                      * This is how to add a custom header, such as a
>     cookie
>
>                      */
>
>                     Header hdr = new Header("Cookie","my_cookie=xyz;");
>
>                     ArrayList headers = new ArrayList();
>
>                     headers.add(hdr);
>
>                     opts = outMsgCtx.getOptions();
>
>                     opts.setProperty(HTTPConstants.HTTP_HEADERS,headers);
>
>
>
>     You could do something similar to the above but the easiest way
>     for me to get this working was to set the
>     manageTransportSession=true in axis2.xml and then use the
>     following on the client side:
>
>     opts.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,true);
>
>
>
>     This tells axis to re-use the httpclient object for second, third,
>     etc.. requests. If this is done, the http-client remembers the
>     JSESSIONID from the first request and sends it back to the server
>     on subsequent requests.
>
>
>
>
>
>     -Jay
>
>
>
>
>
>     -----Original Message-----
>     *From:* Anil Chukkapalli [mailto:anilchukkapalli@gmail.com
>     <mailto:anilchukkapalli@gmail.com>]
>     *Sent:* Monday, April 23, 2007 2:48 PM
>     *To:* axis-user@ws.apache.org <mailto:axis-user@ws.apache.org>
>     *Subject:* Axis2 Manage Session Cookie Manually
>
>
>
>     Hi
>
>      Is there any way we can manage sessions manually using Axis2, my
>     non java web service maintains session using cookies. Is there a
>     way my Axis2 client can read the soap/http header to extract the
>     session information and use the extracted infromation for further
>     web service calls, example getting the UUID from the header and
>     use the UUID to create a cookie in my Axis2 client using
>     setProperty. I have tried using the set manage session method to
>     true but that does not work.
>
>       Can you please point me to another thread that answers my
>     question if you are unable to answer this question.
>
>     Thanks
>     Anil
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


------=_Part_34407_12980857.1177453646642--