Xmlrpc client (HttpBadResponse error)

Hey guys… I’m having some issues connecting to an xmlrpc server.

Here is my code below:

require “xmlrpc/client”

server = XMLRPC::Client.new(“webservice.com”, “/api/xmlrpc”, 443)
result = server.call(‘ContactService.load’, ‘4525435214321543’,
[“FirstName”, “LastName”])

when doing the code above in irb… i keep getting the following error:

Net::HTTPBadResponse: wrong status line: “\025\003\001\000\002\002”
from /usr/local/lib/ruby/1.8/net/http.rb:2031:in read_status_line' from /usr/local/lib/ruby/1.8/net/http.rb:2018:in read_new’
from /usr/local/lib/ruby/1.8/net/http.rb:1059:in request' from /usr/local/lib/ruby/1.8/net/http.rb:1046:in request’
from /usr/local/lib/ruby/1.8/net/http.rb:547:in start' from /usr/local/lib/ruby/1.8/net/http.rb:1044:in request’
from /usr/local/lib/ruby/1.8/net/http.rb:1001:in post2' from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:535:in do_rpc’
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2’
from (irb):22
from :0

I have searched everywhere trying to figure out what this means. Please
help.

server = XMLRPC::Client.new(“webservice.com”, “/api/xmlrpc”, 443)

Port 443 is https, that is http over ssl. I don’t know the XMLRPC-API,
but you have to tell it to use TLS/SSL.

mfg, simon … hth

Simon K. wrote:

server = XMLRPC::Client.new(“webservice.com”, “/api/xmlrpc”, 443)

Port 443 is https, that is http over ssl. I don’t know the XMLRPC-API,
but you have to tell it to use TLS/SSL.

mfg, simon … hth

Wow! Thanks for the tip Michael… Yes, I did have to specify the
‘use_ssl’ parameter for the xmlclient.

I now use this:

server = XMLRPC::Client.new3({‘host’ =>“website.com”, ‘path’ =>
“/api/xmlrpc”, ‘port’ => 443, ‘use_ssl’ => true})

I should also try the new_from_uri.

It’s working now! Thanks guys!

Nate

Nate L. wrote:

Hey guys… I’m having some issues connecting to an xmlrpc server.

Here is my code below:

require “xmlrpc/client”

server = XMLRPC::Client.new(“webservice.com”, “/api/xmlrpc”, 443)
result = server.call(‘ContactService.load’, ‘4525435214321543’,
[“FirstName”, “LastName”])

XMLRPC::Client.new_from_uri(“https://webservice.com/api/xmlrpc”)

Regards,

Michael