Friday, October 24, 2008

Creating your own Web Service with different session scopes

When creating a Web service you can create Web services of different session scopes. There are four session types in Axis2 such as,
1. SOAP Session Scope
2. Transport Session Scope
3. Request Scope
4. Application Session Scope

I will briefly explain how one can create Web service with each of these different session scopes.

Once you have created your Java class and complied it, you will need to write a services.xml before converting it into an archive file.

In order to create a service with a SOAP session scope all you have to do is add the following to your services.xml

scope="soapsession"

E.g.:- <service name="<service_name>" scope="soapsession">



I will be providing a sample service.xml for your reference.

<service name="Adding" scope="soapsession">
<description>
This service is created to add two numbers.
</description>
<parameter name="ServiceClass" locked="false">com.math.add.Adding</parameter>
<operation name="add">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service>

2 comments:

RG Infotech said...

Thanks evanthika, keep it good, really cool information,

Evanthika said...

Thanks a lot for the feedback and I'm glad to know it was useful :-)