0

我正在尝试将 SOAPAction 添加到我的 SOAP Web 请求中。

以下是我的代码:

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

期望此代码应在我的 HTTP 请求中添加一个单独的标头字段,如SOAPAction: "http://tempuri.org/GenerateParam". 但以下是最终形成的数据包:

POST /myscripts/script.php?somedetails 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/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了值。有什么问题?

4

1 回答 1

0

发现问题。我刚刚将我的肥皂协议SaajSoapMessageFactory从更改SOAP_1_2_PROTOCOLSOAP_1_1_PROTOCOL,它开始正常工作。

于 2016-04-19T09:10:55.513 回答