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 "M. Goodell" <fr...@yahoo.com> on 2006/08/11 01:48:32 UTC

Scope

I have a question regarding scope and would like clarification on something to be sure I understand things.
   
  I have a sample class called AxisTest deployed on a local server that looks like:
   
  public class AxisTest {
    
    private String lastName;
    private String firstName;
    private String middleName;
    
    public AxisTest() {
    }
    
    public String getLastName() {
        return this.lastName;
    }
      public void setLastName(String lastName) {
        this.lastName = lastName;
    }
      public String getFirstName() {
        return this.firstName;
    }
      public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
      public String getMiddleName() {
        return this.middleName;
    }
      public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }
}
   
  Here is the client class I use to talk to the server.
   
  public class AxisTest {
   
      public AxisTest() {
    }
    
    public static void main(String[] args)  throws Exception {
        
        AxisTestService ams = new AxisMathServiceLocator();
        AxisTest am = ams.getAxisTest();
   
          am.setFirstName("Willy");
        am.setLastName("Wonka");
        am.setMiddleName("Wilbur");
        
        System.out.println("First Name = " + am.getFirstName());
        System.out.println("Last Name = " + am.getLastName());
        System.out.println("Middle Name = " + am.getMiddleName());
          
    }
    
}
  
 
  When I run the client subsequent the calls to:
   
          System.out.println("First Name = " + am.getFirstName());
        System.out.println("Last Name = " + am.getLastName());
        System.out.println("Middle Name = " + am.getMiddleName());
   
  all come back as null values.
   
  I have read in the users guide about "scope" and if I change the scope to "Application" as in:
   
  <parameter name="scope" value="Application"/>
   
  then the name values are returned as they were assigned.
   
  My question is this: 
   
  Is each method call considered a "SOAP Request" hence:
   
  1. The object is created.
  2. The method is called / data created.
  3. The object / data is destroyed.
   
  What I "think" I need is "Session-Enabled" objects and NOT application scope becuase multiple users of the object will share data. 
   
  Quesiton: How do you set the session-enabled attribute per object?
   
  Finally, are the scope of objects in Axis similar in concept to the JSP request, session, application scopes?
   
  Thank You!
   

 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.