gpt4 book ai didi

java - 为什么 SOAP 请求在 Eclipse WSE 中正确返回 RESPONSE,但在使用 Postman 时却不能?

转载 作者:行者123 更新时间:2023-12-02 10:36:58 25 4
gpt4 key购买 nike

我有一个 WSDL 应用程序生成的骨架,我使用 Web Service Explorer 来测试一个调用,它在 Eclipse WSE 中工作正常,但当我使用 POSTMAN 时,我收到一条响应错误:

<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>

这是请求代码:

SOAP 请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://biller.com/onlinebilling" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<q0:sendPmtNotification>
<PmtNotificationRequest>
<RequestId>3454</RequestId>
<InqDate>2018-11-08T20:35:44.626Z</InqDate>
<PaidInvoices>
<InvoiceId>123</InvoiceId>
<PaidValue>2333</PaidValue>
<BankSrc>wqewqe</BankSrc>
<BankAuthCŪode>123</BankAuthCode>
<ValuesDetail>
<Description>wqeweqweqwe</Description>
<Value>123</Value>
</ValuesDetail>
</PaidInvoices>
</PmtNotificationRequest>
</q0:sendPmtNotification>
</soapenv:Body>
</soapenv:Envelope>

SOAP 响应

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<sendPmtNotificationResponse xmlns="http://biller.com/onlinebilling">
<PmtNotificationResponse xmlns="">
<Status>OK</Status>
<RequestId>1002</RequestId>
<Message>MESSAGE_RESPONSE</Message>
<PartnerAuthCode>partnerAUTH_CODE</PartnerAuthCode>
</PmtNotificationResponse>
</sendPmtNotificationResponse>
</soapenv:Body>
</soapenv:Envelope>

postman 中的 SOAP 响应

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">BATTLES_WINNER</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

postman 截图

enter image description here

最佳答案

在 Soap 1.1 中,SOAPAction HTTP header 需要由客户端发送。这允许防火墙和服务器识别 SOAP 请求,而无需询问请求的完整正文。它可用于智能路由或一般情况下更好地管理 Web 服务请求。

该值可以是任意的,如果需要特定值,它将在 WSDL 中;通常,它是一个 URI。 Section 6.1 of the SOAP 1.1 spec简单地描述了行为。

在 Postman 中,您可以通过请求部分上的“ header ”点击来添加 header 。如果操作需要特定值,请检查 WSDL。根据评论,您的情况可以接受空白标题。

由于 WSE 是一个专用的 Web 服务测试工具,我猜它很友好并且会自动增加值(value)。 Postman 是一个更通用的 HTTP 测试工具,因此它可能不太友好,这可能解释了行为差异。

关于java - 为什么 SOAP 请求在 Eclipse WSE 中正确返回 RESPONSE,但在使用 Postman 时却不能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53217856/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com