Salve a tutti, sto cercando ( da un po’ ormai ) di capire come
realizzare un servizio soap che possa girare su apache con mod_ruby
In rete la totalità degli esempi riguarda server standalone
server.rbx
require ‘soap/rpc/cgistub’
class CalcServer < SOAP::RPC::CGIStub
def on_init
add_method( self, ‘add’, ‘lhs’, ‘rhs’ )
end
end
def add( lhs, rhs )
rhs + lhs
end
name = “CalcServer”
status = CalcServer.new( name, ‘urn:ruby:calculation’ ).start
##################################################################
#client.rb #############################################################
require ‘soap/rpc/driver’
server = ‘http://localhost/server.rbx’
uri = ‘urn:ruby:calculation’
calc = SOAP::RPC::Driver.new(server, uri )
calc.wiredump_dev = STDERR if $DEBUG
calc.add_method( ‘add’, ‘lhs’, ‘rhs’ )
puts ‘add: 1 + 2 # => 3’
puts calc.add(1, 2)
##########################################################################
Errore:
################################################################
SecurityError: Insecure: can’t intern tainted string
from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:210:in const_defined?' from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:210:in
const_from_name’
from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:202:in each' from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:202:in
const_from_name’
from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:221:in
class_from_name' from /usr/lib/ruby/1.8/soap/mapping/rubytypeFactory.rb:424:in
unknownstruct2obj’
from /usr/lib/ruby/1.8/soap/mapping/rubytypeFactory.rb:405:in
unknowntype2obj' from /usr/lib/ruby/1.8/soap/mapping/rubytypeFactory.rb:251:in
soap2obj’
from /usr/lib/ruby/1.8/soap/mapping/registry.rb:479:in _soap2obj' from /usr/lib/ruby/1.8/soap/mapping/registry.rb:428:in
soap2obj’
from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:146:in _soap2obj' from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:59:in
soap2obj’
from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:360:in
protect_threadvars' from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:55:in
soap2obj’
from /usr/lib/ruby/1.8/soap/rpc/router.rb:434:in request_rpc_enc' from /usr/lib/ruby/1.8/soap/rpc/router.rb:418:in
request_rpc’
from /usr/lib/ruby/1.8/soap/rpc/router.rb:391:in call' from /usr/lib/ruby/1.8/soap/rpc/router.rb:168:in
route’
from /usr/lib/ruby/1.8/soap/rpc/soaplet.rb:88:in do_POST' from /usr/lib/ruby/1.8/soap/rpc/cgistub.rb:170:in
run’
from /usr/lib/ruby/1.8/logger.rb:659:in start' from /home/onip/public_html/server.rbx:18 from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in
load’
from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in handler' from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:354:in
raise_fault’
from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:147:in call' from /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in
call’
from /usr/lib/ruby/1.8/soap/rpc/driver.rb:232:in `add’
###########################################################################
Attualmente sto utilizzando ruby-1.8.6_p369, mod_ruby-1.2.6 e le
librerie soap4r incluse nella distribuzione di ruby (ho provato anche a
sostituire i file con la nuova versione della libreria, ma l’errore
rimane)
Grazie a tutti per l’aiuto