Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to build a stateful web service with spring ws? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to build a stateful web service with spring ws?

    I know one can do this with JAX-WS.

  • #2
    The only way I have come across to do so is to setup the state on the client.

    Code:
    	CommonsHttpMessageSender commons = new CommonsHttpMessageSender();
    		//Defines the methods for classes capable of sending and receiving
    		//WebServiceMessage instances across a transport. 
    		WebServiceMessageSender[] senders = {commons};
    		webServiceTemplate.setMessageSenders(senders);
    		
    		//Allows to use a pre-configured HttpClient instance
    		CommonsHttpMessageSender commonsHttpMessageSender = (CommonsHttpMessageSender) senders[0];
    		
            //A container for HTTP attributes that may persist from request to request such as cookies
    		HttpState state = new HttpState();
    		//HttpClient maintains the session state using an instance of a class called HttpState.
    		getHttpclient().setState(state);
    		commonsHttpMessageSender.setHttpClient(getHttpclient());

    Comment

    Working...
    X