[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

xmlrpc client (HttpBadResponse error

Nate Leavitt

4/24/2008 5:44:00 PM

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.
--
Posted via http://www.ruby-....

3 Answers

Simon Krahnke

4/24/2008 6:28:00 PM

0

* Nate Leavitt <nateleavitt@gmail.com> (19:43) schrieb:

> 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

Michael Neumann

4/24/2008 6:53:00 PM

0

Nate Leavitt 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/xm...)

Regards,

Michael

Nate Leavitt

4/24/2008 7:07:00 PM

0

Simon Krahnke wrote:
> * Nate Leavitt <nateleavitt@gmail.com> (19:43) schrieb:
>
>> 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
--
Posted via http://www.ruby-....