Forum: Italian Ruby user group Istanziare un client SOAP usando WSDLDriverFactory

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Pierluigi Lai (Guest)
on 2009-04-29 12:39
(Received via mailing list)
Ciao a tutti, ho realizzato questo server soap per provare un pò la
libreria soap4r

codice:
require 'soap/rpc/standaloneServer'

class MyServer < SOAP::RPC::StandaloneServer

  def initialize(*args)
    super(*args)
    add_method(self, "sayhelloto", "username")
  end

  def sayhelloto(username)
   "Hello, #{username}."
  end
end

server = MyServer.new("MyRubyServer", "urn:mySoapServer", "localhost",
12321)
trap('INT') {server.shutdown}
server.start


ho provato ad implementare un client in questo modo:

codice:
require "soap/wsdlDriver"
  url = "http://localhost:12321/"

 client = SOAP::WSDLDriverFactory.new(url).createDriver


lancio il server e poi il client ma mi viene restituito quest'errore:

codice:
/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:116:in `decode_tag': unknown
element: {}HTML (WSDL::XMLSchema::Parser::UnknownElementError)
  from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:82:in `start_element'
  from /usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in `start_element'
  from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:34:in `tag_start'
  from /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in `parse'
  from /usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream'
  from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in `do_parse'
  from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:63:in `parse'
  from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:42:in `parse'
  from /usr/lib/ruby/1.8/wsdl/importer.rb:31:in `parse'
  from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in `import'
  from /usr/lib/ruby/1.8/wsdl/importer.rb:18:in `import'
  from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import'
  from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize'
  from soapClient.rb:14:in `new'
  from soapClient.rb:14


ho forse sbagliato l'url per recuperare il file WSDL ?

I manuali da cui ho preso spunto sono principalmente Programming Ruby e
CookBook, ma qui non si capisce bene (o meglio, io non l'ho capito)
come deve essere formato l' url per recuperare il file WSDL.
Ho provato anche le seguenti combinazioni:

codice:
  url = "http://localhost:12321/mySoapServer.wsdl"
  url = "http://localhost:12321/mySoapServer"
  url = "http://localhost:12321/urn:mySoapServer.wsdl"
  url = "http://localhost:12321/urn:mySoapServer"
  url = "http://localhost:12321/MyRubyServer.wsdl"
  url = "http://localhost:12321/MyRubyServer"


ma  dava sempre lo stesso errore.

In effetti non so di preciso come deve essere composto.

Qualcuno può aiutarmi porfavor?
This topic is locked and can not be replied to.