在HTTP头中使用SOAPAction使用JAVA中的SOAP服务

在HTTP头中使用SOAPAction使用JAVA中的SOAP服务,java,web-services,spring-mvc,curl,soap-client,Java,Web Services,Spring Mvc,Curl,Soap Client,我正试图用Java实现soap服务消费者,使用springWebServiceGatewaySupport 当我使用curl使用下面的服务时,它给出了正确的响应 curl-d@request.xml-H'SOAPAction:abc:mnEvent#DoAction'https://myhost.org/cd/doAction.jsp 我试图使用JAVA实现同样的功能,方法是在继承自WebServiceGatewaySupport的模板类中添加以下HttpHeaders public O ca

我正试图用Java实现soap服务消费者,使用spring
WebServiceGatewaySupport

当我使用
curl
使用下面的服务时,它给出了正确的响应

curl-d@request.xml-H'SOAPAction:abc:mnEvent#DoAction'https://myhost.org/cd/doAction.jsp
我试图使用JAVA实现同样的功能,方法是在继承自
WebServiceGatewaySupport
的模板类中添加以下
HttpHeaders

public O callWebService(字符串url,I请求){
return(O)getWebServiceTemplate().marshalSendAndReceive(url、请求、新WebServiceMessageCallback()){
@凌驾
公共无效doWithMessage(WebServiceMessage消息){
TransportContext TransportContext=TransportContextHolder.getTransportContext();
HttpComponentsConnection连接=(HttpComponentsConnection)transportContext.getConnection();
connection.getHttpPost().addHeader(“SOAPAction”、“abc:mnEvent#DoAction”);
}
});
}
有了这段代码,我得到了如下的错误消息

SOP-330006 SOAP服务“abc:mnEvent”中未定义方法“DoAction”


curl
命令移动到JAVA时,我在这里错过了什么?

错误消息
SOP-330006方法“DoAction,””未在SOAP服务“abc:mnEvent”中定义。
指出,请求中有两个SOAP操作

  • HttpHeader中添加了显式SoapAction
  • SoapMessage中的隐式SoapAction
  • 为了避免这个问题,我们需要从标头中删除soapAction并在SoapMessage中设置它

    SaajSoapMessage soapMessage = (SaajSoapMessage) message;
    soapMessage.setSoapAction("abc:mnEvent#DoAction");
    

    错误消息
    SOP-330006在SOAP服务“abc:mnEvent”中未定义方法“DoAction”“”。
    表明,请求中有两个SOAP操作

  • HttpHeader中添加了显式SoapAction
  • SoapMessage中的隐式SoapAction
  • 为了避免这个问题,我们需要从标头中删除soapAction并在SoapMessage中设置它

    SaajSoapMessage soapMessage = (SaajSoapMessage) message;
    soapMessage.setSoapAction("abc:mnEvent#DoAction");