# Re: XMLRPC Question

**URL:** <https://www.ruby-forum.com/t/re-xmlrpc-question/142477>\
**Category:** Ruby\
**Created:** [July 8, 2008, 11:15am UTC](https://www.ruby-forum.com/t/re-xmlrpc-question/142477 "2008-07-08T11:15:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [July 8, 2008, 11:15am UTC](https://www.ruby-forum.com/t/re-xmlrpc-question/142477/1 "2008-07-08T11:15:04Z")

</div>

> So what I entered into telnet was just:

That definitely isn’t XMLRPC. The XMLRPC spec is very simple, see  
[http://www.xmlrpc.com/spec](http://www.xmlrpc.com/spec)

Since the root element isn’t then it isn’t XMLRPC, so you  
won’t  
be able to use an xmlrpc client library.

What you seem to have is an ad-hoc XML-over-TCP exchange. So you need  
to:

(1) Open a TCPSocket to connect to the server  
(2) Squirt your XML request down it  
(3) Perhaps: half-close the connection (\*)  
(4) Read the response  
(5) Either wait for the connection to close, or wait for the closing tag  
of the response (\*\*)

(\*) This depends on how the server detects the end of the request - does  
it  
look for the closing tag, or does it wait for the connection to close?

(\*\*) The first case lets you read a blob and parse it afterwards. The  
second  
requires you to parse as you read, e.g. with a stream parser.

If the server side closes the connection after sending the response, you  
might be able to start with something as simple as

require ‘socket’  
conn = TCPSocket.new(‘1.2.3.4’, 1234) # Destination hostname and port  
conn.puts “”  
#conn.close\_write # maybe not needed  
res = conn.read  
conn.close  
puts res

Then pass res to a parser like REXML. If not, then you should pass the  
open  
conn object to something like an REXML StreamParser to read element at a  
time.

You’ll just have to play with it to make it work, or talk to the server  
designer, since there are some unknowns in the above. If they were using  
XML-over-HTTP then it would be clearer, because the semantics of  
end-of-request and end-of-response for HTTP are well-defined.

HTH,

Brian.
