Webservice problem (cant make client)


#1

hey, i have made a webservice
http://twodecode.pilot.localhost.be:3000/backend/wsdl
here i can see the wsdl file

i have a method string Authenticate(string twa, string login, string
pass)
when i do /invoke i can test it, this all works

backend_api.rb
class BackendApi < ActionWebService::API::Base
api_method :authenticate,
:expects => [{:twa =>:string},{:login =>:string},{:pass =>:string}],
:returns => [{:responsecode =>:string}]
end

backend_controller.rb
class BackendController < ApplicationController
wsdl_service_name ‘Backend’
web_service_api BackendApi
web_service_scaffold :invoke

# Constants
TWA_INVALID 				= "TWA_INVALID"
USER_NOT_FOUND				= "USER_NOT_FOUND"
USER_FOUND				= "USER_FOUND"

def authenticate(twa, login, pass)
	user = User.authenticate(login,  pass)
	if user == nil then
		return USER_NOT_FOUND
	else
		return USER_FOUND
	end
end

end

Authenticate(‘xxx’,‘test’,‘test’) => returns “USER_NOT_FOUND”
Authenticate(‘xxx’,‘test’,‘testpass’) => returns “USER_FOUND”

No i want to write a client as a standalone program but he always get
parse
error xml, i have tried mutiple options, here are they, with an error
description above it

Anyone can help me get the right method…

require ‘action_web_service’
require ‘soap/rpc/driver’
require ‘uri’
require ‘soap/wsdlDriver’
require “xmlrpc/client”

Initialize the SOAP driver

wsdl = “http://twodecode.pilot.localhost.be:3000/backend/wsdl
wsdl2 = “http://twodecode.pilot.localhost.be:3000/backend/api/RPC2
ns = “urn:ActionWebService”

#xml parser error
#~ proxy = SOAP::RPC::Driver.new(wsdl, ‘urn:ActionWebService’)
#~ proxy.add_method(‘Authenticate’, ‘twa’, ‘login’, ‘pass’)
#~ result = proxy.Authenticate(‘xxx’, ‘test’,‘test’)

#xml parser error
#~ @drv = SOAP::RPC::Driver.new(wsdl, ‘urn:ActionWebService’)
#~ @drv.add_rpc_method_with_soapaction(‘Authenticate’,
‘urn:ActionWebService#Authenticate’, ‘twa’, ‘login’, ‘pass’)
#~ result = @drv.Authenticate(‘xxx’, ‘test’,‘test’)

#xml parser error
#~ drv = SOAP::RPC::Driver.new(wsdl,‘urn:ActionWebService’)
#~ drv.add_method_with_soapaction(“Authenticate”, ‘urn:ActionWebService’
+
“/#Authenticate”, ‘twa’, ‘login’, ‘pass’)
#~ @result = drv.Authenticate(‘xxx’,‘test’,‘test’)

#post not supported,xml parser error
#~ wiredump_dev=STDERR
#~ service = SOAP::RPC::Driver.new(wsdl, ns)
#~ service.wiredump_dev=wiredump_dev
#~ service.add_method_with_soapaction(“Authenticate”, ns +
“/Authenticate”,
‘twa’, ‘login’, ‘pass’)
#~ @result = service.Authenticate(‘xxx’,‘test’,‘test’)

#undefined method Authenticate
#wsdl = “http://localhost/Twodecode.Webservices/Webservices.asmx?WSDL
#~ factory = SOAP::WSDLDriverFactory.new(wsdl)
#~ @driver = factory.createDriver
#~ result = @driver.Authenticate(‘xxx’,‘test’,‘test’)

#undefined mehtod create_rpc_driver
#~ drv = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
#~ drv.wiredump_dev = STDOUT
#~ dwml = drv.Authenticate(‘xxx’,‘test’,‘test’)

#uninitialized constant ActionWebService
#~ soap_client = ActionWebService::Client::Soap.new(‘BackendApi’, wsdl2)
#~ result = soap_client.Authenticate(‘xxx’,‘test’,‘test’)

Thanks in advance
Nick