php - 由于 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
标题中传递了错误的东西。
我该怎么办?
解决方案
SOAPAction
路径值可以通过添加到您发送请求的脚本中找到?wsdl
。就我而言https://aisws.ingos.ru/sales-test/SalesService.svc?wsdl
。
请注意,仅通过在浏览器中打开您不会看到它,因为它返回内容类型 xml。要阅读它,您应该使用 cUrl 或其他任何东西。
推荐阅读
- python - 由于 IOpub 数据速率超出,无法读取 txt 文件
- c# - 我的 UI 在尝试连接到套接字时滞后?
- android - 列表视图中的搜索过滤器在项目单击时返回错误值
- reactjs - 将文本添加到 Switch formcontrol 并使用材质 ui 在切换中更改它
- git - 如何在脚本化管道中使用 SkipDefaultCheckout
- javascript - 原子中的代码在html中显示不同的颜色
- python - 如何使装饰器功能成为类的一部分
- javascript - 如何将查询字符串参数从数据传递给ajax调用
- node.js - Sequelize 有条件的订单
- javascript - html5的使用针对不同的浏览器