我将我的Savon版本更新为0.9.6,我的服务器请求似乎是错误的。在更新之前,我使用的是Savon 0.9.2。
我遇到与下面帖子中提到的人类似的问题,但不同之处在于重复的项目包括完整的对象。我试过使用数组,没有运气。 Savon: How can I specify a custom XML in a hash body for a SOAP request?
请求以这种方式构建:
#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>
有没有人有任何想法? 我非常感谢您愿意提供的任何建议。
谢谢!