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 Loïc MAZE <lm...@geosphere.fr> on 2006/06/27 17:37:12 UTC

[Axis2] Need a small example with HttpSession

 Hi,

I'm a beginner with Axis 2 and I would like to know how to implement a stateful web service using HttpSession. I've spent several hours on this mailing but I've found absolutely nothing.
Can somebody supply a concrete example of axis session ? Any information in this regard will be highly appreciated.

Best regards,
Loïc

Re: [Axis2] Need a small example with HttpSession

Posted by Loïc MAZE <lm...@geosphere.fr>.
Thanks a lot for all the replies,

In order to manage HttpSession, I've tried the following code for my web 
service :

public class TestSessionService implements ServiceLifecycle {
    private ServletEndpointContext jaxrpcContext;

    public void init(Object context) throws ServiceException {
        jaxrpcContext = (ServletEndpointContext) context;
    }

    public void destroy() {
        jaxrpcContext = null;
    }

    public void tester() {
        HttpSession session = jaxrpcContext.getHttpSession();
        System.out.println("SESSION ID : "+session.getId());
    }

}

But I get this error when the getHttpSession() method is invoked :
org.apache.axis2.AxisFault: null; nested exception is: 
java.lang.NullPointerException

I think the object named jaxrpcContext isn't initialise in the init() method 
and is always null.
My source is this document : 
http://www-128.ibm.com/developerworks/xml/library/ws-tip-stateful.html

Any kind of help will be highly appreciated.

Best regards,
Loïc


----- Original Message ----- 
From: "Deepal Jayasinghe" <de...@opensource.lk>
To: <ax...@ws.apache.org>
Sent: Wednesday, June 28, 2006 9:06 AM
Subject: Re: [Axis2] Need a small example with HttpSession


>
>
> Loïc MAZE wrote:
>
>> Hi,
>>
>> I'm a beginner with Axis 2 and I would like to know how to implement a
>> stateful web service using HttpSession. I've spent several hours on
>> this mailing but I’ve found absolutely nothing.
>
> ya , we dont have enough documents explaining session management stuff
> (I am on the process of writing a document on this area).
>
>> Can somebody supply a concrete example of axis session ? Any
>> information in this regard will be highly appreciated.
>
> Managing transport level session require you to change axis2.xml , need
> to add the following parameter;
> <parameter name="manageTransportSession" locked="false">true</parameter>
>
> Then you need to deploy your services with its scope being
> "transportsession" .
>
> In the client side when you invoking the service you have an option to
> manage session as well.
>
> To understand the concept pls have a look at
> http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
>
>> Best regards,
>> Loïc
>
>
> -- 
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org 


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


Re: [Axis2] Need a small example with HttpSession

Posted by Deepal Jayasinghe <de...@opensource.lk>.

Loïc MAZE wrote:

> Hi,
>
> I'm a beginner with Axis 2 and I would like to know how to implement a
> stateful web service using HttpSession. I've spent several hours on
> this mailing but I’ve found absolutely nothing.

ya , we dont have enough documents explaining session management stuff
(I am on the process of writing a document on this area).

> Can somebody supply a concrete example of axis session ? Any
> information in this regard will be highly appreciated.

Managing transport level session require you to change axis2.xml , need
to add the following parameter;
<parameter name="manageTransportSession" locked="false">true</parameter>

Then you need to deploy your services with its scope being
"transportsession" .

In the client side when you invoking the service you have an option to
manage session as well.

To understand the concept pls have a look at
http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java

> Best regards,
> Loïc


-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



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