首页 > 解决方案 > 由于 SOAPAction 标头,“EndpointDispatcher 的 ContractFilter 不匹配”

问题描述

我正在尝试处理一些使用 SOAP 但面临问题的 API。我想通过 Javascript + PHP + cUrl 从我的网站使用该 API。

老实说,我从未使用过 SOAP,所以我最好学习它,但似乎我非常接近解决方案,所以,请帮助我。

我需要调用LoginRequest通过发送 post 请求调用的方法https://aisws.ingos.ru/sales-test/SalesService.svc(您将无法访问它,因为它只处理 IP 列表)。

所以我发送帖子请求:

POST /sales-test/SalesService.svc HTTP/1.1
Host: aisws.ingos.ru
User-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Accept: */*
Accept-Encoding: UTF-8
Content-Type: text/xml
SOAPAction: "https://aisws.ingos.ru/sales-test/SalesService.svc"
Content-Length: 346

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://aisws.ingos.ru/services/b2b/sales/agents/1.0/"><soapenv:Header/><soapenv:Body><ns:LoginRequest><User>Тут логин</User><Password>Тут пароль</Password></ns:LoginRequest></soapenv:Body></soapenv:Envelope>
 

并得到回应:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 748
Connection: keep-alive
Date: Fri, 06 Nov 2020 17:42:31 GMT
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported
</faultcode>
<faultstring xml:lang="ru-RU">
The message with Action 'https://aisws.ingos.ru/sales-test/SalesService.svc' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
</faultstring>
</s:Fault>
</s:Body>
</s:Envelope> 

似乎我在SOAPAction标题中传递了错误的东西。

我该怎么办?

标签: phpsoap

解决方案


SOAPAction路径值可以通过添加到您发送请求的脚本中找到?wsdl。就我而言https://aisws.ingos.ru/sales-test/SalesService.svc?wsdl

请注意,仅通过在浏览器中打开您不会看到它,因为它返回内容类型 xml。要阅读它,您应该使用 cUrl 或其他任何东西。


推荐阅读