trying to make a soap request

G

Gregory Dyke

Hi,

I'm trying to connect to a webservice which is only "documented" by
its wsdl. So far I have the following code:

require 'soap/wsdlDriver'
server=3DSOAP::WSDLDriverFactory.new('http://people.epfl.ch/wsdl/PeopleWS.w=
sdl')
driver=3Dserver.createDriver
driver.wSgetProfiles(["147980"])
ArgumentError: wrong number of arguments (1 for 2)
from /usr/local/lib/ruby/1.8/soap/wsdlDriver.rb:448:in `wSgetProfil=
es'
from /usr/local/lib/ruby/1.8/soap/wsdlDriver.rb:448:in `wSgetProfil=
es'
from (irb):7

I don't know whether the wsdl is accessible from outside, so I've
copied it at the end of the email.

I can't figure out what the two arguments that it is asking for are.
From what I understand, it's asking for a list of strings. Is this a
problem with ruby-understanding or with wsdl understanding?

Greg

----------------------------------------------------------------

-
=09<definitions name=3D"PeopleWS" targetNamespace=3D"http://people.epfl.ch/=
PeopleWS">
-
=09<types>
-
=09<s:schema elementFormDefault=3D"qualified"
targetNamespace=3D"http://people.epfl.ch/PeopleWS">
-
=09<s:element name=3D"WSgetProfiles">
-
=09<s:complexType>
-
=09<s:sequence>
<s:element name=3D"ScipersList" type=3D"s:string"/>
</s:sequence>
</s:complexType>
</s:element>
+
=09<s:element name=3D"WSgetProfilesByUnit">
-
=09<s:complexType>
-
=09<s:sequence>
<s:element minOccurs=3D"0" maxOccurs=3D"1" name=3D"unitID" type=3D"s:string=
"/>
<s:element minOccurs=3D"0" maxOccurs=3D"1" name=3D"funct" type=3D"s:string"=
/>
<s:element minOccurs=3D"0" maxOccurs=3D"1" name=3D"subtree" type=3D"s:strin=
g"/>
</s:sequence>
</s:complexType>
</s:element>
-
=09<s:element name=3D"UnitResponse">
-
=09<s:complexType>
-
=09<s:sequence>
<s:element minOccurs=3D"0" maxOccurs=3D"unbounded" name=3D"UnitResult"
type=3D"s0:profileType"/>
</s:sequence>
</s:complexType>
</s:element>
+
=09<s:complexType name=3D"ProfileType">
-
=09<s:all>
<s:element name=3D"nom" type=3D"s:string"/>
<s:element name=3D"prenom" type=3D"s:string"/>
<s:element name=3D"sciper" type=3D"s:string"/>
<s:element name=3D"mail" type=3D"s:string"/>
<s:element name=3D"rooms" type=3D"s:string"/>
<s:element name=3D"phones" type=3D"s:string"/>
<s:element name=3D"origine" type=3D"s:string"/>
<s:element name=3D"nat" type=3D"s:string"/>
<s:element name=3D"fax" type=3D"s:string"/>
<s:element name=3D"tel_prive" type=3D"s:string"/>
<s:element name=3D"web_perso" type=3D"s:string"/>
<s:element name=3D"photourl" type=3D"s:string"/>
<s:element name=3D"affects" type=3D"s0:ArrayOfAffects"/>
<s:element name=3D"frcv" type=3D"s0:refCV"/>
<s:element name=3D"encv" type=3D"s0:refCV"/>
</s:all>
</s:complexType>
+
=09<s:complexType name=3D"ArrayOfAffects">
-
=09<s:sequence>
<s:element minOccurs=3D"0" maxOccurs=3D"unbounded" name=3D"Affects"
type=3D"s0:Affects"/>
</s:sequence>
</s:complexType>
+
=09<s:complexType name=3D"Affects">
-
=09<s:all>
<s:element name=3D"sigle_unite" type=3D"s:string"/>
<s:element name=3D"hier_unite" type=3D"s:string"/>
<s:element name=3D"fonction" type=3D"s:string"/>
<s:element name=3D"accred_ordre" type=3D"s:string"/>
<s:element name=3D"accred_statut" type=3D"s:string"/>
</s:all>
</s:complexType>
+
=09<s:complexType name=3D"refCV">
-
=09<s:all>
<s:element name=3D"creator" type=3D"s:string"/>
<s:element name=3D"lastmodby" type=3D"s:string"/>
<s:element name=3D"datecr" type=3D"s:string"/>
<s:element name=3D"datemod" type=3D"s:string"/>
<s:element name=3D"cvlang" type=3D"s:string"/>
<s:element name=3D"titre" type=3D"s:string"/>
<s:element name=3D"curriculum" type=3D"s:string"/>
<s:element name=3D"expertise" type=3D"s:string"/>
<s:element name=3D"mission" type=3D"s:string"/>
<s:element name=3D"arrayOfPubItems" type=3D"s0:ArrayOfPubItems"/>
<s:element name=3D"arrayOfBoxes" type=3D"s0:ArrayOfBoxes"/>
</s:all>
</s:complexType>
+
=09<s:complexType name=3D"ArrayOfBoxes">
-
=09<s:sequence>
<s:element minOccurs=3D"0" maxOccurs=3D"unbounded" name=3D"Boxes" type=3D"s=
0:Box"/>
</s:sequence>
</s:complexType>
+
=09<s:complexType name=3D"ArrayOfPubItems">
-
=09<s:sequence>
<s:element minOccurs=3D"0" maxOccurs=3D"unbounded" name=3D"PubItems"
type=3D"s0:pubItem"/>
</s:sequence>
</s:complexType>
+
=09<s:complexType name=3D"Box">
-
=09<s:all>
<s:element name=3D"boxlabel" type=3D"s:string"/>
<s:element name=3D"boxcontent" type=3D"s:string"/>
<s:element name=3D"boxpos" type=3D"s:string"/>
<s:element name=3D"boxordre" type=3D"s:string"/>
<s:element name=3D"boxlang" type=3D"s:string"/>
</s:all>
</s:complexType>
+
=09<s:complexType name=3D"PubItem">
-
=09<s:all>
<s:element name=3D"item" type=3D"s:string"/>
</s:all>
</s:complexType>
<s:element name=3D"ProfileType" type=3D"s0:profileType"/>
<s:element name=3D"ArrayOfAffects" type=3D"s0:ArrayOfAffects"/>
</s:schema>
</types>
-
=09<message name=3D"ScipersIn">
<part name=3D"parameters" element=3D"s0:WSgetProfiles"/>
</message>
+
=09<message name=3D"UnitIn">
<part name=3D"parameters" element=3D"s0:WSgetProfilesByUnit"/>
</message>
+
=09<message name=3D"UnitOut">
<part name=3D"parameters" element=3D"s0:UnitResponse"/>
</message>
-
=09<portType name=3D"peopleSOAP">
+
=09<operation name=3D"WSgetProfilesByUnit">
<input message=3D"s0:UnitIn"/>
<output message=3D"s0:UnitOut"/>
</operation>
-
=09<operation name=3D"WSgetProfiles">
<input message=3D"s0:ScipersIn"/>
<output message=3D"s0:UnitOut"/>
</operation>
</portType>
-
=09<binding name=3D"peopleSOAP" type=3D"s0:peopleSOAP">
<soap:binding transport=3D"http://schemas.xmlsoap.org/soap/http"
style=3D"document"/>
+
=09<operation name=3D"WSgetProfilesByUnit">
<soap:eek:peration
soapAction=3D"http://people.epfl.ch/PeopleWS#WSgetProfilesByUnit"/>
-
=09<input>
<soap:body use=3D"literal"/>
</input>
-
=09<output>
<soap:body use=3D"literal"/>
</output>
</operation>
-
=09<operation name=3D"WSgetProfiles">
<soap:eek:peration soapAction=3D"http://people.epfl.ch/PeopleWS#WSgetProfiles"=
/>
-
=09<input>
<soap:body use=3D"literal"/>
</input>
-
=09<output>
<soap:body use=3D"literal"/>
</output>
</operation>
</binding>
-
=09<service name=3D"PeopleWS">
-
=09<port name=3D"peopleSOAP" binding=3D"s0:peopleSOAP">
<soap:address location=3D"http://people.epfl.ch/cgi-bin/PeopleWS.pl"/>
</port>
</service>
</definitions>
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Gregory said:
I'm trying to connect to a webservice which is only "documented" by
its wsdl. So far I have the following code:

require 'soap/wsdlDriver'
server=SOAP::WSDLDriverFactory.new('http://people.epfl.ch/wsdl/PeopleWS.wsdl')
driver=server.createDriver

Method WSDLDriver#createDriver wass deprecated. Please use
WSDLDriver#create_rpc_method instead.
driver.wSgetProfiles(["147980"])
ArgumentError: wrong number of arguments (1 for 2)
from /usr/local/lib/ruby/1.8/soap/wsdlDriver.rb:448:in `wSgetProfiles'
from /usr/local/lib/ruby/1.8/soap/wsdlDriver.rb:448:in `wSgetProfiles'
from (irb):7

I don't know whether the wsdl is accessible from outside, so I've
copied it at the end of the email.

This seems to work. But I don't know what 's-gensym3' means which is
included in the response from the server. I cannot find anything about
s-gensym3 in the WSDL...

require 'soap/wsdlDriver'
server =
SOAP::WSDLDriverFactory.new('http://people.epfl.ch/wsdl/PeopleWS.wsdl')
#driver=server.createDriver
driver = server.create_rpc_driver
p driver.wSgetProfiles:)ScipersList => "147980")

You may need to update your ruby or soap4r module. What version of ruby
are you using?

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFC6vBdf6b33ts2dPkRAoaCAJ9o9naVL/UhMM5J55ZYVaX3WtB75QCgrEZ+
vewZCRiD6+OoUuKTkgb+U1E=
=p1qr
-----END PGP SIGNATURE-----
 
G

Gregory Dyke

This seems to work. But I don't know what 's-gensym3' means which is
included in the response from the server. I cannot find anything about
s-gensym3 in the WSDL...
=20
require 'soap/wsdlDriver'
server =3D
SOAP::WSDLDriverFactory.new('http://people.epfl.ch/wsdl/PeopleWS.wsdl')
#driver=3Dserver.createDriver
driver =3D server.create_rpc_driver
p driver.wSgetProfiles:)ScipersList =3D> "147980")

Nice, that works for me. But I think you're right: the soap4r module
needed updating. After I'd done that, it told me that create_driver
was deprecated.

how do you figure out what to pass to :ScipersList? I don't understand
the wsdl too well, but it seems to want a *sequence* of strings. As it
happens, passing one number works out fine for me, but I'd like to
figure out how this mapping works.

Greg
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Gregory said:
Nice, that works for me. But I think you're right: the soap4r module
needed updating. After I'd done that, it told me that create_driver
was deprecated.

how do you figure out what to pass to :ScipersList? I don't understand
the wsdl too well, but it seems to want a *sequence* of strings. As it
happens, passing one number works out fine for me, but I'd like to
figure out how this mapping works.

<sequence> just says that child elements (only 1 element for the schema
though) must appear in the same order as they defined.

By the way, you can create request class definition by wsdl2ruby.rb.

0% wsdl2ruby.rb --wsdl http://people.epfl.ch/wsdl/PeopleWS.wsdl --classdef
I, [2005-07-30T22:20:52.350115 #2888] INFO -- app: Creating class
definition.
I, [2005-07-30T22:20:52.350115 #2888] INFO -- app: Creates file
'PeopleWS.rb'.
I, [2005-07-30T22:20:52.421115 #2888] INFO -- app: End of app. (status: 0)

0% cat PeopleWS.rb
require 'xsd/qname'

# {http://people.epfl.ch/PeopleWS}WSgetProfiles
class WSgetProfiles
@@schema_type = "WSgetProfiles"
@@schema_ns = "http://people.epfl.ch/PeopleWS"
@@schema_element = [["scipersList", ["SOAP::SOAPString",
XSD::QName.new(nil, "ScipersList")]]]

def ScipersList
@scipersList
end

def ScipersList=(value)
@scipersList = value
end

def initialize(scipersList = nil)
@scipersList = scipersList
end
end
[snip]

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFC64Dif6b33ts2dPkRArARAJ9j/lex2amL++81J4+IqvL8FlrgHgCfdTjb
GLw8n9CE46vt1TtCGmJkGQY=
=PK8T
-----END PGP SIGNATURE-----
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top