Forum: Ruby ruby xmlrpc call not working

Posted by Mohammed Yasin Rahman (Guest)
on 2012-11-08 11:28
(Received via mailing list)
I wrote this code in ruby for calling remote API using xmlrpc/client in 
ruby, but it's not working:


require "xmlrpc/client"
require "pp"

XMLRPC::Config.module_eval do
  remove_const :ENABLE_NIL_PARSER
  const_set :ENABLE_NIL_PARSER, true
end


ret = XMLRPC::Client.new2("http://demo.myslice.info:7080/")


# Authentication token
auth = {"AuthMethod" => "password", "Username" => "demo", "AuthString" 
=> "demo"}

pp ret.call("Get", auth, "slice",  {"slice_hrn" => 
"ple.upmc.myslicedemo"}, ["slice_hrn", "slice_description", 
"resources.network", "resources.type", "resources.hrn", 
"resources.hostname"])


But the same call using python is working:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Connection to XMLRPC server
import xmlrpclib
srv = xmlrpclib.ServerProxy("http://demo.myslice.info:7080/", 
allow_none=True)

# Authentication token
auth = {"AuthMethod": "password", "Username": "demo", "AuthString": 
"demo"}

print ret = srv.Get(auth, "slice", [["slice_hrn", '=', 
"ple.upmc.myslicedemo"]], {}, ["slice_hrn",  "resource.network", 
"resource.type", "resource.hrn", "resource.hostname"])


I tried many places, nobody could give me any solution. Please help me.





-----
Best Regards,

Mohammed Yasin Rahman
Software Engineer
UPMC, CNRS
Paris, France

Email: mohammed-yasin.rahman@lip6.fr
Posted by Humza Yaqoob (Guest)
on 2012-11-13 18:03
(Received via mailing list)
Could you post the the error you are receiving from the interpreter as a 
Gist?

On Thu, Nov 8, 2012 at 5:25 AM, Mohammed Yasin Rahman
Posted by Brian Candler (candlerb)
on 2012-11-13 19:47
Mohammed Yasin Rahman wrote in post #1083536:
> But the same call using python is working:

Since this is not encrypted, using tcpdump or wireshark will show you 
what's being sent "on the wire", so you can easily see what's different 
in the request.

tcpdump -i eth0 -nn -s1500 -A tcp port 7080
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.