Pat,

I'm glad the thread helped you. 

I have not tried the KEEP_ALIVE option. If I have time I will try today
and let you know what I find.

-Jay

-----Original Message-----
From: pat [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 8:55 AM
To: [email protected]
Subject: RE: Axis2 Manage Session Cookie Manually

Hi,

1st THANKS a lot for this thread !!! It helped me a lot !!!

I have question: How to setup commecion to be "keep-alive"?
I've tried this:
opts.setProperty(HTTPConstants.HEADER_CONNECTION,
HTTPConstants.HEADER_CONNECTION_KEEPALIVE);

but without luck :-(

Thanks a lot.

     Pat

On Tue, 24 Apr 2007 17:01:38 -0400, James Arbo wrote 
> Anil, 
>    
> That was a method I had written. Below is the body: 
>    
>     public static SOAPEnvelope createSOAPEnvelope(String
personToGreet) { 
>              SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); 
>              SOAPEnvelope envelope = fac.getDefaultEnvelope(); 
>              OMNamespace omNs =  
fac.createOMNamespace("http://example1.org/example1";, "example1"); 
>           
>              // creating the payload 
>              OMElement method = fac.createOMElement("sayHello", omNs);

>              OMElement value = fac.createOMElement("personToGreet",
omNs); 
>              value.addChild(fac.createOMText(value, personToGreet)); 
>              method.addChild(value); 
>              envelope.getBody().addChild(method); 
>              return envelope; 
>      } 
>    
>    
>    
> -----Original Message----- 
> From: Anil Chukkapalli [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 24, 2007 4:43 PM 
> To: [email protected] 
> Subject: Re: Axis2 Manage Session Cookie Manually 
>    
> Jay 
> 
>  Thanks for the reply one last question in the line "
outMsgCtx.setEnvelope(createSOAPEnvelope("Fred"));" createSOAPEnvelope
is a
member of SOAPfactory, which is an interface. Is there a particular
implementation of createSOAPEnvelope that you suggest i use. 
> 
> Thanks 
> Anil 
> 
>   
> 
> On 4/24/07, James Arbo <[EMAIL PROTECTED]> wrote: 
> 
> It's part of axiom 
>    
> axiom-api-1.2.2.jar 
>    
>    
>    
>    
>    
> -----Original Message----- 
> From: James Arbo 
> Sent: Monday, April 23, 2007 6:41 PM 
> To: [email protected] 
> Subject: RE: Axis2 Manage Session Cookie Manually 
>    
> Anil, 
>    
> Below is the client side code that produces a valid response
(MessageContext) from the server: 
>        
>            ServiceClient sender = new ServiceClient(); 
>                  OperationClient opClient =
sender.createClient(ServiceClient.ANON_OUT_IN_OP); 
>    
>                  MessageContext outMsgCtx = new MessageContext(); 
>                  Options opts = outMsgCtx.getOptions(); 
>    
>                  opts.setTo(targetEPR); 
>
opts.setTransportInProtocol(Constants.TRANSPORT_HTTP); 
>                  opts.setTimeOutInMilliSeconds(300000); 
>                  opts.setAction("urn:sayHello"); 
>                   
>
opts.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,true); 
>    
>                  outMsgCtx.setEnvelope(createSOAPEnvelope("Fred")); 
>    
>                  //now add the outgoing msg context to our client. 
>                  opClient.addMessageContext(outMsgCtx); 
>    
>                  //make the call   
>                  opClient.execute(true);                
>    
>                  /* 
>                   * print the calls response 
>                   */ 
>                  //retrieve the messageContext for the "in"coming
response. 
>                  MessageContext inMsgtCtx =
opClient.getMessageContext("In");              
>                  SOAPEnvelope response = inMsgtCtx.getEnvelope(); 
>                  System.out.println(response); 
>    
> Hope that helps. It took me quite a while to get an example of the
http
session and another of the soap session working. I find the
documentation weak
at best. 
>    
> Good luck. 
>    
> -Jay 
> -----Original Message----- 
> From: Anil Chukkapalli [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 23, 2007 6:26 PM 
> To: [email protected] 
> Subject: Re: Axis2 Manage Session Cookie Manually 
>    
> Hi 
> 
>   The problem that i am having is 
> 
>  MessageContext inMsgCtx = MessageContext.getCurrentMessageContext(); 
> 
>  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 < [EMAIL PROTECTED]> 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:[EMAIL PROTECTED] ] 
> Sent: Monday, April 23, 2007 2:48 PM  
> To: [email protected] 
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to