Sessions in JAX-RPC web service implementation

From: Andreas Frey <>
Date: Thu, 08 Sep 2005 16:12:42 +0200


I would like to maintain sessions in my JAX-RPC-client. I start the client via an dynamic proxy and I cant figure out how to set the SESSION_MAINTAIN_PROPERTY = true. Because I'm generating the bindings dynamic I cant set the property in my stub because I dont have any stub.

Heres my code:

String nameSpaceUri = "urn:Foo";
        String serviceName = "Auth";
        String portName = "AuthIFPort";
   // Specify the location of the WSDL file
         URL url = new URL("http://localhost:8080/MyAuth/MyAuth?WSDL");

// THIS DIDNT WORK Stub doesnt have getVendorStub()-method
  //javax.xml.rpc.Stub jaxrpcStub = (javax.xml.rpc.Stub) getVendorSpecificStub();
 // jaxrpcStub._setProperty(javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
         // Create an instance of service factory
         ServiceFactory serviceFactory = ServiceFactory.newInstance();

         // Create a service object to act as a factory for proxies.
         Service mathService = serviceFactory.createService(url,
                    new QName(nameSpaceUri, serviceName));

         // Create a proxy
         AuthService.AuthIF myProxy = (AuthService.AuthIF) mathService.getPort(new QName(nameSpaceUri,portName), AuthService.AuthIF.class);

Please reply direct to my email.

Best regards!


// Andreas Frey