Andrew Knott
2006-Jul-28 16:22 UTC
[Rails] 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")
--
Posted via http://www.ruby-forum.com/.
Kent Sibilev
2006-Jul-28 16:30 UTC
[Rails] ActionWebService Struct member name including ''-''
AWS requires all struct''s members to be a valid ruby identifier. On 7/28/06, Andrew Knott <aknott@mac.com> wrote:> 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") > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Kent --- http://www.datanoise.com
Andrew Knott
2006-Jul-28 16:44 UTC
[Rails] Re: ActionWebService Struct member name including ''-''
Ouch, that hurts... Kent Sibilev wrote:> AWS requires all struct''s members to be a valid ruby identifier. > > On 7/28/06, Andrew Knott <aknott@mac.com> wrote: >> end >> I can make the call OK (as below) >> @password="pass", @username="user">, number=>"+00000000")-- Posted via http://www.ruby-forum.com/.
Matthew Palmer
2006-Jul-29 23:12 UTC
[Rails] Re: ActionWebService Struct member name including ''-''
On Fri, Jul 28, 2006 at 06:21:39PM +0200, Andrew Knott wrote:> 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?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