2016-04-19 97 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,並且它開始正常工作。