axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Savantraj, Chennamakal Subramanian" <Savant....@ap.sony.com>
Subject Question on scope="session"
Date Thu, 10 Apr 2003 01:34:39 GMT
Dear All,

I am new to Axis and trying out its options  one by one. I am trying to
deploy a simple web service with scope=session.
This service have 3 methods. 
	1. Will set the Name
	2. Will set the Address
	3. Will return Name & Address
What I am expecting is ,the web service to remember the values set during
each call from the same client. The execution 
of the client program is as below.
	1. Call the method to set the name
	2. Call the method to set the address
	3. Call the method which will return the name & address

My expectation here is to get the value whichever I set from my call 1 & 2.
But call 3 will just retun empty. 
Am I trying the wrong thing? Is there any way to do this way of programming
with axis?

Pls help..

Here is the source codes
===================================
Service: ScopeTest.java
===================================
package wsaxis;

public class ScopeTest 
{
  String myName="";
  String myAddress="";
  public ScopeTest()
  {      
  }

  public void setMyName(String mName)
  {
    myName=mName;
  }

  public void setMyAddress(String mAddress)
  {
    myAddress=mAddress;
  }

  public String display()
  {
   return "My Name is "+myName+" and my Address is "+myAddress;
  }
} 
===================================
WSDD: Deploy.wsdd
===================================
<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" 
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  <service name="ScopeTest" provider="java:RPC">
    <parameter name="className" value="wsaxis.ScopeTest"/>
    <parameter name="allowedMethods" value="*"/>
    <parameter name="scope" value="session"/>
  </service>
</deployment>

===================================
WSDD: Client
===================================
package wsaxis;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import java.util.*;

public class TestClient
{

    public TestClient()
    {
    }

    public static void main(String args[])
    {
        try
        {

            String endpoint =
"http://localhost:1000/axis/services/ScopeTest";
            Service service = new Service();
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            call.setOperationName(new QName("ScopeTest", "setMyName"));
            call.invoke(new Object[] { "XXXYYY" });

            call.setOperationName(new QName("ScopeTest", "setMyAddress"));
            call.invoke(new Object[] { "AAABBB" });
            
            call.setOperationName(new QName("ScopeTest", "display"));
            String abc=(String)call.invoke(new Object[] { });
            System.out.println(abc);
           
        }
        catch(Exception e)
        {
            System.err.println(e.toString());
        }
    }
}









Savantraj C.S
Sony Information Systems Solutions (AP)
(A division company of Sony Electronics (S) Pte. Ltd.)
2 International Business Park #01-10
Tower One The Strategy Singapore 609930

Tel: (65) 6544 8000 DID:(65) 6544 7414
Fax : (65) 6544 7007
E-mail : Savant.Rcs@ap.sony.com



-------------------------------------------------------------------
This email is confidential and intended only for the use of the individual
or entity named above and may contain information that is privileged. If you
are not the intended recipient, you are notified that any dissemination,
distribution or copying of this email is strictly prohibited. If you have
received this email in error, please notify us immediately by return email
or telephone and destroy the original message. Thank you. - This mail is
sent via Sony Asia Pacific Mail Gateway. 
-------------------------------------------------------------------


Mime
View raw message