Spring Invalid SOAPAction WebServiceTemplate in HTTP header

I find it difficult to call SOAP 1.2 WebService through Spring -ws WebServiceTemplate. The SOAPAction request in the Http header is executed, and the server displays the error message "Unable to process the request without a valid action parameter. Please put a valid action with soap." I was able to find out that SOAP Action is missing when monitoring through wirehark. I also do not support proxy server.

I made sure that the SOAP XML I am trying to send is valid by running the request through TCP Mon (a tool such as SOAP UI) and was able to get a response.

Here is my spring config:

<?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans  
                        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/util
                        http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<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>

<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
 <constructor-arg ref="messageFactory" />
<property name="defaultUri" value="https://ecomapi.networksolutions.com/soapservice.asmx" />
<property name="messageSender">
    <bean class="org.springframework.ws.transport.http.CommonsHttpMessageSender" />     </property>
</bean>

And this is my Java code:

            public void simpleSendAndReceive() {
            try{
            StreamSource source = new StreamSource(new StringReader(MESSAGE));
            StreamResult result = new StreamResult(System.out);
            SoapActionCallback actionCallBack = new SoapActionCallback("https://ecomapi.networksolutions.com/soapservice.asmx") {
                public void doWithMessage(WebServiceMessage msg) {
                    SoapMessage smsg = (SoapMessage)msg;
                    smsg.setSoapAction("http://networksolutions.com/ReadOrder");
                }
            };
            webServiceTemplate.sendSourceAndReceiveToResult(
                    "https://ecomapi.networksolutions.com/soapservice.asmx",
                     source,
                     new SoapActionCallback("http://networksolutions.com/ReadOrder"),
     //                      actionCallBack,
                     result);


            System.out.println(source.getInputStream().toString());
            System.out.println(result.getWriter().toString());

            }catch (SoapFaultClientException e) {
                System.out.println(e.getFaultCode());
                System.out.println(e.getFaultStringOrReason());
                System.out.println(e.fillInStackTrace().getLocalizedMessage());
            } catch (WebServiceIOException we) {
                System.out.println(we.getRootCause());
            }
        }
+5
source share
3 answers

, 1.3.2 com.sun.xml.messaging.saaj.soap.MessageImpl(http://java.net/jira/browse/SAAJ-37).   1.3.19, .

: -

saveChanges(). 1.3.2 Content-Type saveChanges.

+1

, , XmlSchema package-info.java , . , xjc jaxb xsd, wsdl xsd , , , , .

0

SOAPAction is required only in SOAP 1.1; see Content Type .

The required SOAPAction SOAP 1.1 HTTP header has been removed in SOAP 1.2. In its place there is an optional action parameter in the media type application / soap + xml.

0
source

All Articles