使用此 WSDL 处理项目:http: //developer.ebay.com/webservices/latest/ebaysvc.wsdl
$client = Savon.client(
:wsdl => "http://developer.ebay.com/webservices/latest/ebaysvc.wsdl",
:endpoint => "https://api.sandbox.ebay.com/wsapi?callname=AddItem&siteid=0&version=733& Routing=new",
:headers => { "Content-Type" => "application/soap+xml", "SOAPAction" => "AddItemRequest"},
:namespace => "urn:ebay:apis:eBLBaseComponents",
:soap_header => { CREDENTIALS GO HERE: SEE BELOW }
)
我需要的是一种复杂类型的 xml 格式。soap_header 的第一部分是 RequestCredentials 并且有几个子节点,其中一个(Credentials)有 3 个子节点......我还需要转义小驼峰大小写,只使用驼峰大小写。
xml 输出的最终结果应类似于:
<urn:RequestCredentials>
<urn:eBayAuthToken>
AUTH TOKEN HERE
</urn:eBayAuthToken>
<urn:Credentials>
<urn:DevId>DEVID HERE</urn:DevId>
ect..... (two more child nodes (AppId, and AuthCert)
</urn:Credentials>
</urn:RequestCredentials>
这是我收到的错误:14007 Error SOAP Authentication failed due to missing or invalid security header。
关于如何使用 savon gem 正确格式化 xml 的任何想法?