ActionWebService Struct member name including '-'

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},@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")

Ouch, that hurts…

Kent S. wrote:

AWS requires all struct’s members to be a valid ruby identifier.

On 7/28/06, Andrew K. [email protected] wrote:

end
I can make the call OK (as below)
@password=“pass”, @username=“user”>, number=>"+00000000")

AWS requires all struct’s members to be a valid ruby identifier.

On 7/28/06, Andrew K. [email protected] wrote:

end
I can make the call OK (as below)
@password=“pass”, @username=“user”>, number=>"+00000000")


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


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Kent

http://www.datanoise.com

On Fri, Jul 28, 2006 at 06:21:39PM +0200, Andrew K. wrote:

However this does not work… Should :“remote-ip” be a valid member
name?

Not for AWS’ purposes. Just use a mock object for testing purposes,
instead, or use Ruby’s internal web services servers for your testing.

  • Matt