savon(SOAP:Server)无法找到用于解组SOAP主体有效负载的处理程序

时间:2014-08-21 05:43:35

标签: ruby-on-rails ruby soap wsdl savon

目的

通过savon v2构建Soap调用

我尝试了什么:

我的肥皂叫RQ,这是文档中给出的

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.opentravel.org/OTA/2003/05">
   <soapenv:Header/>
   <soapenv:Body>
      <OTA_AirLowFareSearchRQ TimeStamp="2012-04-18T07:30:42.663Z" Target="Production" Version="1.0" PrimaryLangID="en" AltLangID="en" RetransmissionIndicator="false" xmlns="http://www.opentravel.org/OTA/2003/05">
         <POS>
            <Source ISOCountry="ZA" ISOCurrency="ZAR" DisplayCurrency="ZAR" DisplayRate="1.0" FirstDepartPoint="CPT" FinalDestinationPoint="JNB">
               <RequestorID Type="Company" ID="website" ID_Context="ts" TSAffiliateID="<AFFILIATE_ID>" MessagePassword="<AFFILIATE_PASSWORD>">
                  <CompanyName><AFFILIATE_ID></CompanyName>
               </RequestorID>
            </Source>
         </POS>
         <OriginDestinationInformation RefNumber="0">
            <DepartureDateTime>2012-07-26T00:00:00CAT</DepartureDateTime>
            <OriginLocation LocationCode="CPT" CodeContext="iata"/>
            <DestinationLocation LocationCode="JNB" CodeContext="iata"/>
         </OriginDestinationInformation>
         <OriginDestinationInformation RefNumber="1">
            <DepartureDateTime>2012-07-29T00:00:00CAT</DepartureDateTime>
            <OriginLocation LocationCode="JNB" CodeContext="iata"/>
            <DestinationLocation LocationCode="CPT" CodeContext="iata"/>
         </OriginDestinationInformation>
         <TravelPreferences>
        <FlightTypePref FlightType="Nonstop" DirectAndNonStopOnlyInd="true"/> <!-- This line is optional – include to filter direct flights only -->    
            <CabinPref Cabin="Economy"/>
         </TravelPreferences>
         <TravelerInfoSummary>
            <AirTravelerAvail>
               <PassengerTypeQuantity Code="7" Quantity="0"/>
               <PassengerTypeQuantity Code="8" Quantity="0"/>
               <PassengerTypeQuantity Code="9" Quantity="0"/>
               <PassengerTypeQuantity Code="10" Quantity="1"/>
            </AirTravelerAvail>
         </TravelerInfoSummary>
      </OTA_AirLowFareSearchRQ>
   </soapenv:Body>
</soapenv:Envelope> 

我的目标网址:例如:http://www.example.com?wsdl

操作名称:搜索

@client = Savon.client(wsdl: ' http://www.example.com?wsdl')

@client.call(:search, message: { 'RefNumber' => '1','DepartureDateTime'=>'2014-09-26T00:00:00CAT','ArrivalDateTime'=>'2012-10-26T00:00:00CAT','OriginLocation'=>'CPT','DestinationLocation'=>'JNB' })   

我得到的内容:

 (SOAP:Server) No handlers could be found for unmarshalling the SOAP body payload

我构建的Soap调用是正确的还是我必须构建整个xml的Soap体?

任何帮助表示赞赏!!

1 个答案:

答案 0 :(得分:1)

我的标准答案:

  1. 下载SoapUI
  2. 构建有效的SOAP请求。
  3. 确保它有效
  4. 然后使用Ruby / Savon
  5. 复制请求
  6. 如果仍然无效,请再次询问