私は wsdl のサービス API を与えられましたが、一度もやったことがなく、どうすればよいかわかりません。
ファイルは、彼らが私たちに送ろうとしているものの説明です:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://moneysupermarket.com/callback" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://moneysupermarket.com/callback" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://moneysupermarket.com/callback">
<s:element name="SendRequestCallBack">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="requestCallBack" type="tns:RequestCallBack" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="RequestCallBack">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="QuoteId" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PhoneNumber" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="CallTime" nillable="true" type="s:dateTime" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="SendRequestCallBackSoapIn">
<wsdl:part name="parameters" element="tns:SendRequestCallBack" />
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="SendRequestCallBack">
<wsdl:input message="tns:SendRequestCallBackSoapIn" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="SendRequestCallBack">
<soap:operation soapAction="http://moneysupermarket.com/callback/SendRequestCallBack" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="SendRequestCallBack">
<soap12:operation soapAction="http://moneysupermarket.com/callback/SendRequestCallBack" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
これまでのところ、機能しない次のコードがあります。
class PhonebackRequest < ActiveRecord::Base
attr_reader :callTime, :phoneNumber, :quoteId
validates_presence_of :phoneNumber, :quoteId
def self.retrive_new_requests
# create a client for the service
client = Savon::Client.new File.path(Rails.public_path+"/moneysupermarket/Service.xml")
response = client.request(:wsdl, "send_request_call_back"){soap.body = { :requestCallBack => 'true' }}
#not sure what goes next
end
end