【问题标题】:CURL and Postman returning two different results for the same requestCURL 和 Postman 为同一请求返回两个不同的结果
【发布时间】:2019-08-12 15:37:57
【问题描述】:

我正在尝试向 SOAP 服务器发出 HTTP POST 请求。该请求在 Postman 中运行良好,但在 curl 中失败。这是一个身份验证请求,因此 Postman 响应是 200,而 curl 响应是 401。

卷曲请求:

curl -X POST 
-H "SOAPAction:urn:NETGEAR-ROUTER:service:DeviceConfig:1#SOAPLogin" 
-H "cache-control: 'no-cache'" 
-H "user-agent: 'node-test'" 
-H "Content-Type: text/plain" 
-H "connection: 'Keep-Alive'" 
http://routerlogin.net:5000/soap/server_sa/ 
-d "<?xml version='1.0' encoding= 'UTF-8'?>
<v:Envelope xmlns:v='http://schemas.xmlsoap.org/soap/envelope/'>
  <v:Header>
    <SessionID>********</SessionID>
  </v:Header>
  <v:Body>
    <M1:SOAPLogin xmlns:M1='urn:NETGEAR-ROUTER:service:DeviceConfig:1'>
      <Username>******</Username>
      <Password>******</Password>
    </M1:SOAPLogin>
  </v:Body>
</v:Envelope>"

邮递员请求只是上述请求的副本。我收到以下邮递员回复:

<soap-env:Body>
   <m:SOAPLoginResponse xmlns:m="urn:NETGEAR-ROUTER:service:DeviceConfig:1">
   </m:SOAPLoginResponse>
  <ResponseCode>000</ResponseCode>
</soap-env:Body>

虽然我收到以下卷曲:

<soap-env:Envelope
        xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
        soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        >
<soap-env:Body>
    <ResponseCode>401</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>

【问题讨论】:

    标签: xml curl soap postman


    【解决方案1】:

    -H 'SOAPAction:"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SOAPLogin"'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-25
      • 2019-06-17
      • 2015-01-19
      • 2013-11-08
      • 1970-01-01
      • 1970-01-01
      • 2017-09-25
      相关资源
      最近更新 更多