[Rails] ActionWebService Struct member name including '-'

Andrew Knott aknott at mac.com
Fri Jul 28 16:21:39 GMT 2006


Hi

I am tryng to mirror a locked away, secure web service for testing 
purposes and am almost there. Hoever as part of the definition for the 
structure of the call to the webservice, I have this struct.

class MyCall < ActionWebService::Struct
    member :username, :string
    member :password, :string
    member :"remote-ip", :string
end

However this does not work... Should :"remote-ip" be a valid member 
name?

I get the following syntax error

SyntaxError ((eval):1:in `member': compile error
(eval):1: parse error, unexpected '-', expecting '\n' or ';'
          def remote-ip; @remote-ip; end

I can make the call OK (as below)

server = XMLRPC::Client.new2("http://127.0.0.1:3001/api/checkNumber")
result = server.call("IsValid", 
{:username=>"user",:password=>"pass",:"remote-ip"=>request.remote_ip}, at formattedNumber)

You will notice I have to use :"remote-ip" instead of :remote-ip. This 
is because of the '-'. The XML is sent  perfectly fine and I can see the 
remote-ip in the sent XML, but it's NOT in the raw posted information.

Web Service Request: IsValid(param0=>#<MyCall:0x2414e90 
@password="pass", @username="user">, number=>"+00000000")

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list