Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify which kind of version of soap do I use with webServiceTemplate?

I am developing a soap web service client with spring.

I am using webServiceTemplate

How do I specify which kind of version of soap do I use?

I can see that it s using soap 1.1 by default.

I want to force it to use soap 1.2

How can I do that?

like image 747
storm_buster Avatar asked Apr 10 '12 20:04

storm_buster


People also ask

What is WebServiceTemplate in Spring?

The WebServiceTemplate is the core class for client-side Web service access in Spring-WS. It contains methods for sending Source objects, and receiving response messages as either Source or Result .

What is SoapActionCallback used for?

Class SoapActionCallback. WebServiceMessageCallback implementation that sets the SOAP Action header on the message. A usage example with WebServiceTemplate : WebServiceTemplate template = new WebServiceTemplate(messageFactory); Result result = new DOMResult(); template.

What is marshalSendAndReceive?

marshalSendAndReceive. Sends a web service message that contains the given payload, marshalled by the configured Marshaller . Returns the unmarshalled payload of the response message, if any. This will only work with a default uri specified!


2 Answers

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    <property name="soapVersion">
        <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>
    </property>
</bean>

i just found, i need to pass a message Factory

like image 187
storm_buster Avatar answered Nov 15 '22 19:11

storm_buster


You just specify the soap version in the configuration file of spring usually spring.cfg.xml in the following way:

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    <property name="soapVersion">
        <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>
    </property>
</bean>
like image 30
GingerHead Avatar answered Nov 15 '22 21:11

GingerHead