views:

298

answers:

1

Hello,

I have some very simple Ruby code that is attempting to do XML-RPC over SSL:


require 'xmlrpc/client'
require 'pp'

server = XMLRPC::Client.new2("https://%s:%d/" % [ 'api.ultradns.net', 8755 ])
pp server.call2('UDNS_OpenConnection', 'sponsor', 'username', 'password')

The problem is that it always results in the following EOFError exception:


/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:135:in `sysread': end of file reached (EOFError)

So it appears that after doing the POST, I don't get anything back. Interestingly, this is the behavior I would expect if I tried to make an HTTP connection on the HTTPS port (or visa versa), and I actually do get the same exact exception if I change the protocol. Everything I've looked at indicates that using "https://" in the URL is enough to enable SSL, but I'm starting wonder if I've missed something.

Note that Even though the credentials I'm using in the RPC are made up, I'm expecting to at least get back an XML error page (similar to if you access https://api.ultradns.net:8755/ with a web browser). I've tried running this code on OSX and Linux with the exact same result, so I have to conclude that I'm just doing something wrong here. Does anyone have any examples of doing XML-RPC over SSL with Ruby?

A: 

http://www.ultradns.net/api/NUS_API_XML.pdf explicitly states that the protocol is not compatible with standard XML-RPC clients. You need to add a toplevel transaction and session tag on top of method call.

<transaction>
  <methodCall>
     ...
  </methodCall>
</transaction>

So I guess the ruby xml-rpc parser is just not being able to parse the response. Just a theory. Have your tried other xml-rpc clients?

duncan
My understanding was that the transaction and session tags were optional. But even if I sent an invalid request, shouldn't I get some kind of error back? Anyway, It might be a moot point now, since UltraDNS is recommending use of their new SOAP API instead.http://www.ultradns.net/api/NUS_API_XML_SOAP.pdf
Michael Conigliaro