baalexander / node-xmlrpc

A pure JavaScript XML-RPC client and server for Node.js.
MIT License
295 stars 150 forks source link

Ignore non-value whitespacing in method calls #10

Closed baalexander closed 13 years ago

baalexander commented 13 years ago

When using Python's XML-RPC library to call a node-xmlrpc server, the xmlrpc server gets hung up on the newlines Python inserts in its method calls.

Example Python XML-RPC method call:

<?xml version='1.0'?>
<methodCall>
<methodName>getPublications</methodName>
<params>
<param>
<value><string>/ohyeah</string></value>
</param>
</params>
</methodCall>

Python code:

import xmlrpclib
caller_id = "/ohyeah"
m = xmlrpclib.ServerProxy("http://localhost:9098")
code, msg, val = m.getPublications(caller_id)

Testing shows the parser is the culprit and is including the newlines in its parsing.

baalexander commented 13 years ago

A test case has been added locally and a fix is in progress.

baalexander commented 13 years ago

The issue was the parser was interpreting the new lines between elements as data, resulting in junk. This only seemed to arise with method calls (there were already whitespace fixes for params). I went ahead and refactored the whitespace handling to ignore the whitespace in the future.

Added a test case using the exact XML that Python sends with its xmlrpclib. Also tested with a node-xmlrpc server and made calls to using Python.