SOAPUI和Node.JS / Request- AccessException

Shn*_*Dev 5 soap http soapui node.js

我正在尝试使用使用SOAP的Estes货运跟踪Web服务构建货运跟踪工具。我与他们的Web支持人员进行了交谈,他们可以使用SOAPUI创建工作请求,该SOAPUI使用我的凭据接收有效的响应。看来我的问题是无法使用node.js在SOAPUI中复制请求/响应。为什么我不能在node.js中复制SOAPUI请求/响应?

以下是Estes Web支持使用的来自SOAPUI的工作原始请求:

POST https://api.estes-express.com:443/ws/estesrtshipmenttracking.base.ws.provider.soapws:EstesShipmentTracking/estesrtshipmenttracking_base_ws_provider_soapws_EstesShipmentTracking_Port HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "estesrtshipmenttracking_base_ws_provider_soapws_EstesShipmentTracking_Binder_shipmentTracking"
Content-Length: 468
Host: api.estes-express.com:443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic XXXXX

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="https://api.estes-express.com/ws/tools/shipment/tracking/v1.1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:shipmentTracking>
         <search>
            <requestID>testroger</requestID>
            <!--Optional:-->
            <pro>XXXXXX</pro>
         </search>
         <debug>N</debug>
      </v1:shipmentTracking>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

我已经省略了上面的基本64位编码的基本身份验证信息,但是向您保证我在请求中使用的是完全相同的值。

我的请求在下面,使用node.js。我应该注意,我在请求中提供了代理信息,但是我已经验证了它可以在其他请求功能中使用。

function estes(obj) {

    var auth = 'Basic XXXXXXX'

    var url = 'https://api.estes-express.com:443/ws/estesrtshipmenttracking.base.ws.provider.soapws:EstesShipmentTracking/estesrtshipmenttracking_base_ws_provider_soapws_EstesShipmentTracking_Port'

    const request = require('request')
    const fs = require('fs');
    const xml = fs.readFileSync('estessample.xml', 'utf-8');

    request.post({
        uri: url,
        headers: {
            'SOAPAction': 'estesrtshipmenttracking_base_ws_provider_soapws_EstesShipmentTracking_Binder_shipmentTracking',
            'Content-Type': 'text/xml;charset=UTF-8',
            'Content-Length': xml.length,
            'Host': 'api.estes-express.com:443',
            'Authorization': auth
        },
        proxy: 'XXXXXX',
        body: xml
    }, function (error, response, body) {
        console.log(body)

        fs.writeFile("response.txt", body, (err) => {
            if (err) console.log(err);
            console.log("Successfully Written to File.");
        });
    })
}
Run Code Online (Sandbox Code Playgroud)

这是我要发布到他们的服务(estessample.xml)的XML,与Estes Web服务团队正在使用的XML相同:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="https://api.estes-express.com/ws/tools/shipment/tracking/v1.1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:shipmentTracking>
         <search>
            <requestID>testroger</requestID>
            <!--Optional:-->
            <pro>XXXXXXX</pro>
         </search>
         <debug>N</debug>
      </v1:shipmentTracking>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

最后,这是我在response.xml中收到的错误:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Client</faultcode>
         <faultstring>[ISS.0088.9164] Access to WSDescriptor estesrtshipmenttracking.base.ws.provider.soapws:EstesShipmentTracking denied.</faultstring>
         <faultactor>http://api.estes-express.com/tools</faultactor>
         <detail>
            <webM:exception xmlns:webM="http://www.webMethods.com/2001/10/soap/encoding">
               <webM:className>com.wm.app.b2b.server.AccessException</webM:className>
               <webM:message xml:lang="">[ISS.0088.9164] Access to WSDescriptor estesrtshipmenttracking.base.ws.provider.soapws:EstesShipmentTracking denied.</webM:message>
            </webM:exception>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

Sha*_*pac 0

在花了很多时间试图让 Estes 的 SOAP 服务在多个网络上运行之后,我却做不到。不过,我确实找到了一个可行的解决方法。

创建 HTTP 请求并 POST 到以下地址:https://myestes-api.estes-express.com/shipmenttracking/search

然后在您的请求正文中发送以下架构,并确保替换<MY_PRO_NUMBER>为您的 PRO 编号。

{
    "session": "",
    "type": "PRO",
    "search": "<MY_PRO_NUMBER>",
    "sort": "",
    "direction": "",
    "rowsPerPage": "25",
    "page": "1",
    "totalPages": "1"
}
Run Code Online (Sandbox Code Playgroud)