【问题标题】:Postman returns an invalid hostname邮递员返回无效的主机名
【发布时间】:2022-01-24 04:00:03
【问题描述】:

我有一个在 AWS 实例上运行的 Web 服务。可以在这里到达http://mqlistener-dev.us-east-2.elasticbeanstalk.com/WebService.asmx。当我将此 url 输入浏览器时,我被带到实例并显示一个页面。这是我预期会发生的。我在创建 SOAP 请求的 c# 应用程序中有代码,我能够发送该请求并返回响应。

我现在希望能够从 Postman 中创建 SOAP 请求。我相信我已经完成了所有设置,但我不断收到无效的主机名 HTTP 错误 400 消息。这是 Postman 的 CURL 代码:

curl --location --request POST 'http://mqlistener-dev.us-east-2.elasticbeanstalk.com/WebService.asmx' \
--header 'SOAPAction: http://jrstestsite.org/mq' \
--header 'Content-Type: text/xml;charset="utf-8"' \
--header 'Accept: text/xml' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-   instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <mq xmlns="http://jrstestsite.org/">
            <mqRequest> </mqRequest>
        </mq>
    </soap:Body>
</soap:Envelope>'

知道为什么 Postman 无法联系到http://mqlistener-dev.us-east-2.elasticbeanstalk.com/WebService.asmx吗?

谢谢。

【问题讨论】:

    标签: soap postman


    【解决方案1】:

    通过 Postman 应用程序(安装在 Win10 上)手动输入并导入 curl 请求,两者都返回状态 200 OK - 请参阅下面的控制台输出

    导入的 curl 请求执行以下操作:

    1. 打开邮递员。
    2. 点击左上角的“导入”标签。
    3. 选择原始文本选项并粘贴您的 cURL 命令。
    4. 单击导入按钮,请求将内置在 Postman 选项卡中
    5. 点击发送以发布请求。

    POST http://mqlistener-dev.us-east-2.elasticbeanstalk.com/WebService.asmx: {
      "Network": {
        "addresses": {
          "local": {
            "address": "192.168.1.206",
            "family": "IPv4",
            "port": 52349
          },
          "remote": {
            "address": "3.133.251.28",
            "family": "IPv4",
            "port": 80
          }
        }
      },
      "Request Headers": {
        "soapaction": "http://jrstestsite.org/mq",
        "content-type": "text/xml;charset=\"utf-8\"",
        "accept": "text/xml",
        "user-agent": "PostmanRuntime/7.28.4",
        "cache-control": "no-cache",
        "postman-token": "32bc8802-5fcb-430e-9cd4-73cbdd0809a0",
        "host": "mqlistener-dev.us-east-2.elasticbeanstalk.com",
        "accept-encoding": "gzip, deflate, br",
        "connection": "keep-alive",
        "content-length": "364"
      },
      "Request Body": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-   instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n    <soap:Body>\r\n        <mq xmlns=\"http://jrstestsite.org/\">\r\n            <mqRequest> </mqRequest>\r\n        </mq>\r\n    </soap:Body>\r\n</soap:Envelope>",
      "Response Headers": {
        "cache-control": "private, max-age=0",
        "content-type": "text/xml; charset=utf-8",
        "server": "Microsoft-IIS/10.0",
        "x-aspnet-version": "4.0.30319",
        "x-powered-by": "ASP.NET",
        "date": "Sun, 23 Jan 2022 19:47:22 GMT",
        "content-length": "505"
      },
      "Response Body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><mqResponse xmlns=\"http://jrstestsite.org/\"><mqResult><mqReturnCode>0</mqReturnCode><mqReturnMessage>999EC60001MISSING RESPONSE GENERATED DB0E01-INVALID STORAGE ADDRESS SUPPLIED TO FREE STORAGE REQUEST 'F'            </mqReturnMessage></mqResult></mqResponse></soap:Body></soap:Envelope>"
    }
    

    【讨论】:

    • 那不是很好。我在 Windows 机器上按照您的步骤操作并得到了有效响应。我想知道它是否与在mac上运行有关。我将尝试在我的 Mac 上将 CURL 导入邮递员,看看是否可行。谢谢!
    • 也适用于 mac。很奇怪。当我导入由不起作用的条目生成的 CURL 时,它可以工作。太奇怪了。
    • 当时可能在 mac 上存在间歇性传输问题。无论如何,这一切都有效!
    猜你喜欢
    • 2018-08-14
    • 1970-01-01
    • 2019-03-27
    • 2020-09-20
    • 2021-10-10
    • 2020-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多