wsdl2ruby help

K

Kelsen23

Hello -

I've been trying to figure out if and what I need to modify to get
Ruby to access these web services. In lieu of those of us who would
much rather see code than listen to someone rant about their problem,
I provided a simplified version of the WSDLs I am using.

My question is below the WSDL definitions~

####
# Security WSDL
####

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:s0="http://randomsite.com/wsapi/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://
schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://
randomsite.com/
wsapi/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
randomsite.com/wsapi/">
<s:element name="Login">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="usrLogin"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="usrPassword"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="LoginResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="token"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="LoginSoapIn">
<part name="parameters" element="s0:Login" />
</message>
<message name="LoginSoapOut">
<part name="parameters" element="s0:LoginResponse" />
</message>
<portType name="SecuritySoap">
<operation name="Login">
<documentation>Login to web service.</documentation>
<input message="s0:LoginSoapIn" />
<output message="s0:LoginSoapOut" />
</operation>
</portType>
<binding name="SecuritySoap" type="s0:SecuritySoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="Login">
<soap:eek:peration soapAction="http://randomsite.com/wsapi/Login"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Security">
<port name="SecuritySoap" binding="s0:SecuritySoap">
<soap:address location="https://randomsite.com/security.asmx" />
</port>
</service>
</definitions>

#####
# Contact WSDL
#####

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:s0="http://randomsite.com/wsapi/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://
schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://
randomsite.com/
wsapi/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
randomsite.com/wsapi/">
<s:import namespace="http://www.w3.org/2001/XMLSchema" />
<s:element name="GetContacts">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="bogusName"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetContactsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetContactsResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Authentication" type="s0:Authentication" />
<s:complexType name="Authentication">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="token"
type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
<message name="GetContactsSoapIn">
<part name="parameters" element="s0:GetContacts" />
</message>
<message name="GetContactsSoapOut">
<part name="parameters" element="s0:GetContactsResponse" />
</message>
<message name="GetContactsAuthentication">
<part name="Authentication" element="s0:Authentication" />
</message>
<portType name="ContactSoap">
<operation name="GetContacts">
<documentation>Retrieves contact information.</documentation>
<input message="s0:GetContactsSoapIn" />
<output message="s0:GetContactsSoapOut" />
</operation>
</portType>
<binding name="ContactSoap" type="s0:ContactSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="GetContacts">
<soap:eek:peration soapAction="http://randomsite.com/wsapi/
GetContacts" style="document" />
<input>
<soap:body use="literal" />
<soap:header d5p1:required="true"
message="s0:GetContactsAuthentication" part="Authentication"
use="literal" xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Contact">
<port name="ContactSoap" binding="s0:ContactSoap">
<soap:address location="https://randomsite.com/contact.asmx" />
</port>
</service>
</definitions>

I downloaded the most recent (that I know of) gem of soap4r (1.5.7)
and httpclient (2.1.0.90.20070807) and used wsdl2ruby on both WSDLs.
I tested the security objects and everything worked great, no problems
whatsoever. When I tried to test the contact objects however there
was no mechanism to pass in the authentication value. As defined in
the Contact WSDL, the authentication token must be provided via the
SOAP header but it seems wsdl2ruby did not parse that out.

Do I need to doctor up the WSDL in order for wsdl2ruby to parse it
correctly or is this functionality not available at this time? If
it's not, do you have any idea where the best place to start would
be. I was diving into the SOAP::RPC::Driver and SOAP::RPC::proxy
classes but I wasn't sure where to start.

Thanks in advance.

Regards,

Kelsen
 
F

Felipe Contreras

Hello -

I've been trying to figure out if and what I need to modify to get
Ruby to access these web services. In lieu of those of us who would
much rather see code than listen to someone rant about their problem,
I provided a simplified version of the WSDLs I am using.

My question is below the WSDL definitions~

####
# Security WSDL
####

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:s0="http://randomsite.com/wsapi/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://
schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://
randomsite.com/
wsapi/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
randomsite.com/wsapi/">
<s:element name="Login">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="usrLogin"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="usrPassword"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="LoginResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="token"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="LoginSoapIn">
<part name="parameters" element="s0:Login" />
</message>
<message name="LoginSoapOut">
<part name="parameters" element="s0:LoginResponse" />
</message>
<portType name="SecuritySoap">
<operation name="Login">
<documentation>Login to web service.</documentation>
<input message="s0:LoginSoapIn" />
<output message="s0:LoginSoapOut" />
</operation>
</portType>
<binding name="SecuritySoap" type="s0:SecuritySoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="Login">
<soap:eek:peration soapAction="http://randomsite.com/wsapi/Login"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Security">
<port name="SecuritySoap" binding="s0:SecuritySoap">
<soap:address location="https://randomsite.com/security.asmx" />
</port>
</service>
</definitions>

#####
# Contact WSDL
#####

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:s0="http://randomsite.com/wsapi/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://
schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://
randomsite.com/
wsapi/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
randomsite.com/wsapi/">
<s:import namespace="http://www.w3.org/2001/XMLSchema" />
<s:element name="GetContacts">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="bogusName"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetContactsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetContactsResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Authentication" type="s0:Authentication" />
<s:complexType name="Authentication">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="token"
type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
<message name="GetContactsSoapIn">
<part name="parameters" element="s0:GetContacts" />
</message>
<message name="GetContactsSoapOut">
<part name="parameters" element="s0:GetContactsResponse" />
</message>
<message name="GetContactsAuthentication">
<part name="Authentication" element="s0:Authentication" />
</message>
<portType name="ContactSoap">
<operation name="GetContacts">
<documentation>Retrieves contact information.</documentation>
<input message="s0:GetContactsSoapIn" />
<output message="s0:GetContactsSoapOut" />
</operation>
</portType>
<binding name="ContactSoap" type="s0:ContactSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="GetContacts">
<soap:eek:peration soapAction="http://randomsite.com/wsapi/
GetContacts" style="document" />
<input>
<soap:body use="literal" />
<soap:header d5p1:required="true"
message="s0:GetContactsAuthentication" part="Authentication"
use="literal" xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Contact">
<port name="ContactSoap" binding="s0:ContactSoap">
<soap:address location="https://randomsite.com/contact.asmx" />
</port>
</service>
</definitions>

I downloaded the most recent (that I know of) gem of soap4r (1.5.7)
and httpclient (2.1.0.90.20070807) and used wsdl2ruby on both WSDLs.
I tested the security objects and everything worked great, no problems
whatsoever. When I tried to test the contact objects however there
was no mechanism to pass in the authentication value. As defined in
the Contact WSDL, the authentication token must be provided via the
SOAP header but it seems wsdl2ruby did not parse that out.

Do I need to doctor up the WSDL in order for wsdl2ruby to parse it
correctly or is this functionality not available at this time? If
it's not, do you have any idea where the best place to start would
be. I was diving into the SOAP::RPC::Driver and SOAP::RPC::proxy
classes but I wasn't sure where to start.

Thanks in advance.

You might have better luck in http://groups.google.com/group/soap4r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top