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

lb3vh1jj  于 11个月前  发布在  Postman
关注(0)|答案(2)|浏览(150)

我有一个下面的XML请求,它在SOAP-UI中工作得很好,但是当我在POSTMAN上运行同一个请求时(即使头是相同的),也会出现以下错误
无效的SOAP请求。
同样,我尝试了相同的XML与CURL请求,但它给出了空响应
如果你们中的任何人请帮助我,我需要添加什么来运行在 Postman ?如果它运行在 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>````

字符串

7jmck4yq

7jmck4yq1#

您可以从SOAI get调用中复制succussed头参数。

Content-Type: text/xml;charset=UTF-8
SOAPAction: "getAvailability"
Host: 9p6.isaaviations.com
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.2)

字符串


的数据



WSDL

https://9p6.isaaviations.com/webservices/services/AAResWebServices?wsdl

dgsult0t

dgsult0t2#

我通过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();

字符串

相关问题