I\'m sending a SOAP request and the server is complaining that the SOAPAction header is empty. I think I\'m setting it right, but obviously I\'m not. Wireshark shows it\'s
While you are using WebServiceTemplate as a class to communicate with the Webservice, I do not understand why but it does not properly fill the HTTP Header.
Some WSDL have a part saying:
And the WebServiceTemplate ignores this part. The above error means that your soapAction parameter in the header is empty. And it should be not. Check with Wireshark. I did - using some Chrome Soap client and Spring. The second one has an invalid header.
To fix this you need to follow Section 6.2.4 in here: http://docs.spring.io/spring-ws/sites/2.0/reference/html/client.html
What it says is basically add the header part on your own, with WebServiceMessageCallback interface. You can read more in the reference.
Basically it ends up like this:
webServiceTemplate.marshalSendAndReceive(o, new WebServiceMessageCallback() {
public void doWithMessage(WebServiceMessage message) {
((SoapMessage)message).setSoapAction("http://tempuri.org/Action");
}
});
Where you can set up properly the header value. Worked for me too. Whole day of reading.