Reputation: 201
I created a webservice and enabled session management on both server and client. It works FINE until I enable REST on the client by adding the 3rd line of code in the serviceStub.java. The session management stops working.
// session management
_serviceClient.getOptions().setManageSession(true);
_serviceClient.engageModule("addressing");
// enable REST
_serviceClient.getOptions().setProperty(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
Again if a comment the last line of code, session management is re-enabled.
Is that a bug or am I missing something?
I am using:
Upvotes: 0
Views: 844
Reputation: 201
Session management for RESTful webservices works at the transport level only as opposed to soap-based web services.
Thus, in order to enable session management for RESTful websevices, the following should be done.
In the Client stub code use the same code as above except that line about engaging addressing module should be commented or removed as REST does not support WS-addressing)
// enable session management
_serviceClient.getOptions().setManageSession(true);
// enable REST
_serviceClient.getOptions().setProperty(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
in services.xml the web service desciption file add 'transportsession' in the scope parameter
<service name="MyService" scope="transportsession"
class="myPackage.service.MyServiceClass">
Don't forget to redeploy the web service.
That's it!
Upvotes: 1