xmlrpc client (HttpBadResponse error)

N

Nate Leavitt

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.
 
S

Simon Krahnke

* Nate Leavitt said:
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
 
M

Michael Neumann

Nate said:
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
 
N

Nate Leavitt

Simon said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top