# Istanziare un client SOAP usando WSDLDriverFactory

**URL:** <https://www.ruby-forum.com/t/istanziare-un-client-soap-usando-wsdldriverfactory/166763>\
**Category:** IT\
**Created:** [April 29, 2009, 10:39am UTC](https://www.ruby-forum.com/t/istanziare-un-client-soap-usando-wsdldriverfactory/166763 "2009-04-29T10:39:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierluigi\_Lai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@Pierluigi\_Lai](https://www.ruby-forum.com/u/Pierluigi_Lai)\
**Post date:** [April 29, 2009, 10:39am UTC](https://www.ruby-forum.com/t/istanziare-un-client-soap-usando-wsdldriverfactory/166763/1 "2009-04-29T10:39:39Z")

</div>

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/](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](http://localhost:12321/mySoapServer.wsdl)”  
url = “[http://localhost:12321/mySoapServer](http://localhost:12321/mySoapServer)”  
url = “[http://localhost:12321/urn:mySoapServer.wsdl](http://localhost:12321/urn:mySoapServer.wsdl)”  
url = “[http://localhost:12321/urn:mySoapServer](http://localhost:12321/urn:mySoapServer)”  
url = “[http://localhost:12321/MyRubyServer.wsdl](http://localhost:12321/MyRubyServer.wsdl)”  
url = “[http://localhost:12321/MyRubyServer](http://localhost:12321/MyRubyServer)”

ma dava sempre lo stesso errore.

In effetti non so di preciso come deve essere composto.

Qualcuno può aiutarmi porfavor?
