我承认我是SOAP和Savon的新手,但是我让它与其他服务合作,但是这个服务让我感到难过。
WSDL在这里: http://stg-wholesale.carsdirect.com/ws/services/Ping?WSDL
完成后的文档应如下所示:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<dealerPing xmlns="http://wholesale.carsdirect.com">
<request>
<partner>
<pricePlan>integer</pricePlan>
<id>integer</id>
</partner>
<vehicle>
<year>integer</year>
<make>string</make>
<model>string</model>
<trim>string</trim>
</vehicle>
<zipcode>integer</zipcode>
</request>
</dealerPing>
</soap:Body>
</soap:Envelope>
如果有人能够接近生成这样的文档或给我一些指示,我将非常感激。
我尝试过这样的事情:
client = Savon::Client.new{|wsdl| wsdl.document = @cp.wsdl}
@response = client.dealer_ping do |soap|
...
end
但是,我收到了这个错误:#
的未定义方法`dealer_ping'我几乎陷入困境。我对这个等式的两个部分的了解都很缺乏。
感谢。
答案 0 :(得分:0)
我无法访问该服务,因此我无法尝试它是否有效......但这应该可行:
client = Savon::Client.new do
wsdl.endpoint = "http://stg-wholesale.carsdirect.com/ws/services/Ping"
wsdl.namespace = "http://wholesale.carsdirect.com"
end
client.request(:dealer_ping) do
soap.body = {
:request => {
:partner => {
:price_plan => 123,
:id => 1222
},
:vehicle => {
:year => 2010,
:make => "Aston Martin",
:model => "DBS",
:trim => ""
},
:zipcode => 90245
}
}
end