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 aleks <al...@telus.net> on 2005/04/16 23:24:43 UTC

service scope

I have a Service called Property ... what I am trying to do is to populate this service object's instance variables and then retreive those instance variables with get methods . I gave the service session scope ...  The following code is not giving me correct output . I always retreive null instance variables ... 

Is what I am trying to achieve possible and can the following code do it ? If so , then the problem is elsewhere ... the populate method is using database code to access mysql ...

String endpointURL = "http://localhost:8080/axis/services/Property";

Service service = new Service();

Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpointURL) );


call.setOperationName("setPropertyID");


Integer integer = new Integer(1);

call.invoke(new Object[] {integer});

call.setOperationName("populate");

call.invoke(new Object[] {});





call.setOperationName("getPropertyID");

call.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT );

Integer outPut1 = (Integer) call.invoke(new Object[] {});

out.println("Property ID: " + outPut1.toString());

call.setOperationName("getAddress");

call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );

out.println("Address: " + (String) call.invoke(new Object[] {}));

R: service scope

Posted by "I.Venuti" <i....@caribel.pisa.it>.
the problem is if your client is session enabled or not.
I thing that a java application doesn't support sessions...

Maybe you can try with a Web application (never do it: I think this could
work)

-- Ivan
  -----Messaggio originale-----
  Da: aleks [mailto:aleks.n@telus.net]
  Inviato: domenica 17 aprile 2005 0.51
  A: axis-user@ws.apache.org
  Oggetto: Re: service scope


  Let me rephrase my question .... is it possible to have the following
service class MyService so that I can first set the private instance
variable ( with setVar) and then immediately after on the next call ( with
getVar) retrieve it ? So far , I haven't been able to get it to work ...



  public class MyService {

      private String var;

     public void setVar(String var) {

                this.var = var;

     }

     public String getVar() {

              return var;

    }


  }

    ----- Original Message -----
    From: aleks
    To: axis-user@ws.apache.org
    Sent: Saturday, April 16, 2005 2:24 PM
    Subject: service scope


    I have a Service called Property ... what I am trying to do is to
populate this service object's instance variables and then retreive those
instance variables with get methods . I gave the service session scope ...
The following code is not giving me correct output . I always retreive null
instance variables ...

    Is what I am trying to achieve possible and can the following code do it
? If so , then the problem is elsewhere ... the populate method is using
database code to access mysql ...

    String endpointURL = "http://localhost:8080/axis/services/Property";

    Service service = new Service();

    Call call = (Call) service.createCall();

    call.setTargetEndpointAddress( new java.net.URL(endpointURL) );


    call.setOperationName("setPropertyID");


    Integer integer = new Integer(1);

    call.invoke(new Object[] {integer});

    call.setOperationName("populate");

    call.invoke(new Object[] {});





    call.setOperationName("getPropertyID");

    call.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT );

    Integer outPut1 = (Integer) call.invoke(new Object[] {});

    out.println("Property ID: " + outPut1.toString());

    call.setOperationName("getAddress");

    call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );

    out.println("Address: " + (String) call.invoke(new Object[] {}));


Re: service scope

Posted by aleks <al...@telus.net>.
Let me rephrase my question .... is it possible to have the following service class MyService so that I can first set the private instance variable ( with setVar) and then immediately after on the next call ( with getVar) retrieve it ? So far , I haven't been able to get it to work ...



public class MyService {

    private String var;

   public void setVar(String var) {

              this.var = var;

   }

   public String getVar() {

            return var;

  }


}

  ----- Original Message ----- 
  From: aleks 
  To: axis-user@ws.apache.org 
  Sent: Saturday, April 16, 2005 2:24 PM
  Subject: service scope


  I have a Service called Property ... what I am trying to do is to populate this service object's instance variables and then retreive those instance variables with get methods . I gave the service session scope ...  The following code is not giving me correct output . I always retreive null instance variables ... 

  Is what I am trying to achieve possible and can the following code do it ? If so , then the problem is elsewhere ... the populate method is using database code to access mysql ...

  String endpointURL = "http://localhost:8080/axis/services/Property";

  Service service = new Service();

  Call call = (Call) service.createCall();

  call.setTargetEndpointAddress( new java.net.URL(endpointURL) );


  call.setOperationName("setPropertyID");


  Integer integer = new Integer(1);

  call.invoke(new Object[] {integer});

  call.setOperationName("populate");

  call.invoke(new Object[] {});





  call.setOperationName("getPropertyID");

  call.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT );

  Integer outPut1 = (Integer) call.invoke(new Object[] {});

  out.println("Property ID: " + outPut1.toString());

  call.setOperationName("getAddress");

  call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );

  out.println("Address: " + (String) call.invoke(new Object[] {}));