Gabriel
Gabriel

Reputation:

Ruby web service

I am new to Ruby. I am having trouble passing the parameters to a web method.

factory = SOAP::WSDLDriverFactory.new('https://api.affili.net/V2.0/Logon.svc?wsdl')
driver = factory.create_rpc_driver

driver.Logon(...)

How can I pass in the required parameters? I have tried passing in an array, but the paramters are made nil, I tried creating a class for the paramters .. but the same problems occur.

The WSDL for the log on is

<xsd:complexType name="Logon">
     <xsd:sequence>
     <xsd:element minOccurs="0" name="Username" nillable="true" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Password" nillable="true" type="xsd:string"/>
     <xsd:element name="WebServiceType" type="tns:WebServiceTypes"/>
     <xsd:element minOccurs="0" name="DeveloperSettings" nillable="true"          type="tns:TokenDeveloperDetails"/>
  <xsd:element minOccurs="0" name="ApplicationSettings" nillable="true" type="tns:TokenApplicationDetails"/>
</xsd:sequence>
</xsd:complexType>
  <xsd:element name="Logon" nillable="true" type="tns:Logon"/>

How can I pass the params to the Logon method?

Thank you

Upvotes: 0

Views: 954

Answers (1)

Srinivas M.V.
Srinivas M.V.

Reputation: 6608

Pass parameters as Hash to the Logon method

factory = SOAP::WSDLDriverFactory.new('https://api.affili.net/V2.0/Logon.svc?wsdl')
driver = factory.create_rpc_driver

parameters = {
                'Username' => 'your-username',
                'Password' => 'your-password',
                'WebServiceType' => 'your-webservicetype',
                'DeveloperSettings' => 'your-settings',
                'ApplicationSettings' => 'your-appsettings'
              }

driver.Logon(parameters)

Good luck !

Upvotes: 2

Related Questions