Trying to make a soap request

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=SOAP::WSDLDriverFactory.new('http://people.epfl.ch/wsdl/PeopleWS.wsdl')
driver=server.createDriver
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.

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

···

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

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

Hi,

Gregory Dyke wrote:

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&#39;\)
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&#39;\)
  #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

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

···

On 7/30/05, NAKAMURA, Hiroshi <nakahiro@sarion.co.jp> wrote:

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&#39;\)
  #driver=server.createDriver
  driver = server.create_rpc_driver
  p driver.wSgetProfiles(:ScipersList => "147980")

Hi,

Gregory Dyke wrote:

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&quot;
  @@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