You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mingqing Zheng <zh...@gmail.com> on 2009/06/03 19:25:27 UTC

How to add JSESSIONID to the following requests' header in java rpc client using Axis2 1.4 stub classes generated by WSDL2JAVA

hi,

I'm using Axis2 1.4 to call a WS. I generated the stub classes using the
WSDL2Java tool. The java rpc client using stub classes to send requests to
WS. After the client sends the first request to WS, it can get JSESSIONID in
the first response's header (Set-Cookie). I want to add the JSESSIONID to
the following requests' header (Cookie). Could someone give me a sample
about this? I just need a code snippet like:

         MyServiceStub stub = new MyServiceStub(MyServiceUrl);
         ServiceClient sender = _stub._getServiceClient();
         sender.getOptions().setManageSession(true);
         sender.getOptions().setProperty(HTTPConstants.HEADER_COOKIE,
"JSESSIONID=**************");          // *********** is the JSESSIONID in
the first response's header
(I use these code, but can't find the "Cookie: JSESSIONID=********" part in
the following requests' header using TCPMon.)

Note: 1. The client is a java rpc client using stub classes but not jsp or
other http request.
         2. The container of the WS may be Tomcat, JBoss, WebLogic or
similar ones.

Thanks

Kevin