You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Nicola Turri <nt...@selin.it> on 2004/03/05 18:00:34 UTC

session problem with AXIS ?

I have the session problem with  AXIS versions 1.1 and tomcat 4.xxx
After one before demanded I have noticed that not  to maintain the sessions,
It generates always a new cockie.
How never happens this?

Thanks

this my example tipical code:

Client>>

 public Object Invoke(String serviceName,String allowedMethods,Object[]
params) throws Exception
  {
    Object resp=null;


    try {

      url = new URL(rpcRouterURL);
      service = new Service();
      Call call = (Call) service.createCall();
      call.setMaintainSession(true);
      call.getMaintainSession();
      call.getMessageContext();

      call.removeAllParameters();
      call.setTargetEndpointAddress(url);
      call.setOperationName( new QName(serviceName,allowedMethods) );


      for (int i=1; i<=params.length; i++)
        call.addParameter( "arg1", new QName(""), ParameterMode.IN );

      call.setReturnType(XMLType.QNAME_TEXT_SOAP12 );

      resp = call.invoke( params );

    }
    catch(Exception ex)
    {


      if (ex instanceof AxisFault) {
        if (!getResponse().equals("java.lang.NullPointerException"))
          throw new Exception(getResponse());
        else
          throw (AxisFault)ex;
      }

    }


    return resp;
  }

Server >>


      org.apache.axis.MessageContext mctx =
org.apache.axis.MessageContext.getCurrentContext();

      mctx.setTimeout(60000);

      ses =  mctx.getSession();

      ses.setTimeout(60000);

     // in order to recover after instance
      ses.get("myIstance");