SOAP/XML 请求在 SOAP UI 中工作正常,但在 Postman 或 CURL 上出现错误

问题描述 投票:0回答:1

我有一个以下 XML 请求,它在 SOAP-UI 中工作正常,但是当我在 POSTMAN 上运行时,相同的请求(即使标头相同)会出现以下错误

SOAP 请求无效。

类似地,我尝试使用 CURL 请求使用相同的 XML,但它给出了 空响应

如果有人请帮助我,我需要添加什么才能在 POSTMAN 中运行? 如果它在邮递员上运行,我可以使其在 CURL 上运行。

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
    <wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  <wsse:UsernameToken wsu:Id="UsernameToken-AAAKHI2521" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>BUKHARIAPI</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass1234</wsse:Password>
  </wsse:UsernameToken>
</wsse:Security>
</soap:Header>  
<soap:Body xmlns:ns2="http://www.opentravel.org/OTA/2003/05">
<ns2:OTA_AirAvailRQ EchoToken="11868765275150-1300252521" PrimaryLangID="en-us" SequenceNmbr="1" Target="TEST" TimeStamp="2024-01-02T23:29:27" Version="20061.00">
      <ns2:POS>
        <ns2:Source TerminalID="AAAKHI2521">
          <ns2:RequestorID ID="BUKHARIAPI" Type="4" />
          <ns2:BookingChannel Type="12" />
        </ns2:Source>
      </ns2:POS>
      <ns2:OriginDestinationInformation>
        <ns2:DepartureDateTime>2024-01-15T00:00:00</ns2:DepartureDateTime>
        <ns2:OriginLocation LocationCode="KHI" />
        <ns2:DestinationLocation LocationCode="ISB" />
      </ns2:OriginDestinationInformation>
      <ns2:TravelerInfoSummary>
        <ns2:AirTravelerAvail>
          <ns2:PassengerTypeQuantity Code="ADT" Quantity="1" />
        </ns2:AirTravelerAvail>
      </ns2:TravelerInfoSummary>
    </ns2:OTA_AirAvailRQ>
  </soap:Body>
</soap:Envelope>````
xml soap postman soapui
1个回答
0
投票

我设法使用 SSL 和 UTF 编码在 CURL 上获取它。下面我提到了我的代码供其他有同样问题的人参考。

$message = <<<EOM
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  <wsse:UsernameToken wsu:Id="UsernameToken-AAAKHI2521" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>BUKHARIAPI</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass1234</wsse:Password>
  </wsse:UsernameToken>
</wsse:Security>
</soap:Header>  
<soap:Body xmlns:ns2="http://www.opentravel.org/OTA/2003/05">
<ns2:OTA_AirAvailRQ EchoToken="11868765275150-1300252521" PrimaryLangID="en-us" SequenceNmbr="1" Target="TEST" TimeStamp="2024-01-02T23:29:27" Version="20061.00">
      <ns2:POS>
        <ns2:Source TerminalID="AAAKHI2521">
          <ns2:RequestorID ID="BUKHARIAPI" Type="4" />
          <ns2:BookingChannel Type="12" />
        </ns2:Source>
      </ns2:POS>
      <ns2:OriginDestinationInformation>
        <ns2:DepartureDateTime>2024-01-15T00:00:00</ns2:DepartureDateTime>
        <ns2:OriginLocation LocationCode="KHI" />
        <ns2:DestinationLocation LocationCode="ISB" />
      </ns2:OriginDestinationInformation>
      <ns2:TravelerInfoSummary>
        <ns2:AirTravelerAvail>
          <ns2:PassengerTypeQuantity Code="ADT" Quantity="1" />
        </ns2:AirTravelerAvail>
      </ns2:TravelerInfoSummary>
    </ns2:OTA_AirAvailRQ>
  </soap:Body>
</soap:Envelope>
EOM;

$soap_do = curl_init ("https://9p6.isaaviations.com/webservices/services/AAResWebServices");
$header = array(
"Content-Type: text/xml;charset=UTF-8", 
"Accept-Encoding: gzip,deflate",
"Connection: Keep-Alive", 
"User-Agent: TechTravel", 
"Host: 9p6.isaaviations.com",
"SOAPAction: \"getAvailability\"",
"Content-length: ".strlen($message),
); 
//curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 30); 
//curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); 
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, 1 );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($soap_do, CURLOPT_ENCODING, '');
$return = curl_exec($soap_do);
curl_close($soap_do);


var_dump($return);
wp_die();
© www.soinside.com 2019 - 2024. All rights reserved.