Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Spring Boot: Error “The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://testuri.org/test/testclientMessage' ”

I'm using Spring boot application and trying to call .net services with WebServiceTemplate.

I'm getting below error when calling marshalSendAndReceive method of WebServiceTemplate

Also, please specify how to pass "To" header.

public class SOAPConnector extends WebServiceGatewaySupport {

public byte[] callWebService(String url, Object request){

    return (byte[]) getWebServiceTemplate().marshalSendAndReceive(url, request, new WebServiceMessageCallback() {

        public void doWithMessage(WebServiceMessage message) {



            QName name = new QName("https://example.com/test.svc/secure","To");


            SoapHeaderElement  sh = ((SoapMessage)message).getEnvelope().getHeader().addHeaderElement(name);

             ((SoapMessage)message).setSoapAction("http://testuri.org/test/testclientMessage");


        }
    });
}

}

I've tried with SOAP UI it's working, but with below modifications

  1. I have taken soap request from console of eclipse and replaced all env tags with soap tags
  2. Enable WS-A addressing

Please help.

Comments