2016-04-19 64 views
0

我正在尝试将SOAPAction添加到我的SOAP Web请求中。SOAPAction设置不正确 - Java

以下是我的代码:

return (TPResponse) getWebServiceTemplate().marshalSendAndReceive(genTP, message -> { 
     ((SaajSoapMessage)message).setSoapAction("http://tempuri.org/IntegrationService/GenerateParam"); 
    }); 

预期是,该代码应为SOAPAction: "http://tempuri.org/IntegrationService/GenerateParam"我的HTTP请求添加一个单独报头字段。但是,以下是形成什么最后的包:

POST /redirect/q2.php?rf=xml&url=http://endpointurl:8080/IntegrationServiceBasic HTTP/1.1 
Accept-Encoding: gzip 
Accept: application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 
Content-Type: application/soap+xml; charset=utf-8; 
    action="http://tempuri.org/IntegrationService/GenerateParam" 
Cache-Control: no-cache 
Pragma: no-cache 
User-Agent: Java/1.8.0_73 
Host: 127.0.0.1 
Connection: keep-alive 
Content-Length: 578 

请注意,而不是添加单独的HTTP标头已修改Content-Type,并在它的增值action。什么可能是错的?

回答

0

发现此问题。我只是将我的SaajSoapMessageFactory的肥皂协议从SOAP_1_2_PROTOCOL更改为SOAP_1_1_PROTOCOL,并且它开始正常工作。