Greetings,

I'm trying to get Axis 1.4 to maintain a session for me.

Here is my Java class:

public class StatefulService {

private String keyValue; //this is the 'state' being maintained

   public String setKey() {
       keyValue = "theValue";
       return "value was set in private member variable";
   }

   public String getKey() {
       String msg = "";
       if(keyValue==null)msg = "Session state is not being maintained";
                    else msg += "keyValue= " + keyValue;
       return msg;
   }
}

Here is my client, a jsp being called via Ajax:

<%@ page language="java"
    import="org.apache.axis.client.Call,
        org.apache.axis.client.Service,
        org.apache.axis.encoding.XMLType,
        javax.xml.rpc.ParameterMode,
        javax.xml.namespace.QName,
        java.net.URL" %>

<%
   String ret = "yada";
String endpointURL = "http://localhost:8080/axis/services/StatefulService";;
       try {
           Service  service = new Service();
           Call     call    = (Call) service.createCall();
           call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
           call.setReturnType( XMLType.XSD_STRING );
call.setMaintainSession(true); call.setOperationName( "getKey" );
           ret = ret + (String) call.invoke( new Object[] { } );
       ret = ret + "\n";
           call.setOperationName( "setKey" );
ret = ret + (String) call.invoke( new Object[] { } ); ret = ret + "\n";
           call.setOperationName( "getKey" );
           ret = ret + (String) call.invoke( new Object[] { } );
       } catch (Exception e) {
      ret = e.toString();
       }
out.println(ret);

%>

Here is my WSDD file I am using to deploy the web service:

<deployment xmlns="http://xml.apache.org/axis/wsdd/";
           xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>

<service name="StatefulService" provider="java:RPC">
 <parameter name="className" value="StatefulService"/>
 <parameter name="allowedMethods" value="*"/>
 <parameter name="scope" value="session"/>
</service>

</deployment>



When I call this the first time I get:
   Session State is not being maintained
   value was set in private member variable
   keyValue=theValue

When I call it the second time I get the same thing, but I expect:

   keyValue=theValue
   value was set in private member variable
   keyValue=theValue


What in the world am I doing wrong? I've been baning my head against a wall over this for 2 days reading and trying every example online that I can find.

Much Thanks in Advance,
Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to