1

我将我的 Savon 版本更新为 0.9.6,我的服务器请求似乎有问题。在更新之前,我使用的是 Savon 0.9.2。

我有一个与下面帖子中提到的人类似的问题,但是,它的不同之处在于重复的项目包括完整的对象。我试过使用数组,但没有运气。 Savon:如何在 SOAP 请求的散列体中指定自定义 XML?

请求是这样构建的:

#Address object
address =  {
      'AddressCode' => 'Dest',
      'Line1' => '1234 Anywhere Street',
      'City' => 'Anywhere',
      'Region' => 'Somewhere',
      'PostalCode' => '12345',
      'Country' => 'USA'
          }
#Building the request
request = {"Request" => {
      'CompanyCode' => 'DEFAULT',
      'DocType' => 'Word',
      'Addresses' => {'BaseAddress' => [address]}
          }}

0.9.6(损坏的)请求部分

   <ser:Request>
            <ser:CompanyCode>DEFAULT</ser:CompanyCode>
            <ser:DocType>Word</ser:DocType>            
            <ser:Addresses>
               <ins0:Addresses>
               <ins0:BaseAddress>AddressCodeDestLine11234 Anywhere StreetCityAnywhere RegionSomewherePostalCode12345CountryUS</ins0:BaseAddress>
            </ser:Addresses>           
         </ser:Request>

0.9.2(工作)请求部分

<ser:Request>
    <ser:CompanyCode>DEFAULT</ser:CompanyCode>
    <ser:DocType>Word</ser:DocType>            
    <ser:Addresses>
       <ser:BaseAddress>
          <ser:AddressCode>Dest</ser:AddressCode>
          <ser:Line1>1234 Anywhere Street</ser:Line1>
          <ser:City>Anywhere</ser:City>
          <ser:Region>Somewhere</ser:Region>
          <ser:PostalCode>12345</ser:PostalCode>
          <ser:Country>US</ser:Country>
       </ser:BaseAddress>
    </ser:Addresses>           
 </ser:Request>

有没有人有任何想法?我非常感谢您愿意提供的任何建议。

谢谢!

4

0 回答 0