Hi,

I am trying to write a java xmlrpc client. However, I got the "org.xml.sax.SAXParseException: Content is not allowed in prolog" error when I tried to call "system.connect()" of my drupal site

After some searching, I found this: http://www.openrdf.org/forum/mvnforum/viewthread?thread=86
"Java doesn't handle BOMs on UTF-8 files properly, making the three header bytes appear as being part of the document. ..."

Is this the problem or something else?

Thanks!

Ethan

package com.test;
import java.net.URL;
import java.util.Vector;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;


public class MyDrupal {
public static void main( String[] args ) throws Exception
     {
   XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
            config.setServerURL(new URL("http://speakingx.com/services/xmlrpc/"));

            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);
            Vector params = new Vector();
            
            Object result =  client.execute("system.connnect", params);
            System.out.println( result );

              
     }
}

[Fatal Error] :1:1: Content is not allowed in prolog.
Exception in thread "main" org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse servers response: Content is not allowed in prolog.
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:177)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
at com.test.MyDrupal.main(MyDrupal.java:18)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:175)
... 8 more
Caused by:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:175)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
at com.test.MyDrupal.main(MyDrupal.java:18)


A simple test with Python shows the site is configured correctly
import xmlrpclib
url = "http://speakingx.com/services/xmlrpc"
drupal = xmlrpclib.ServerProxy(url)
res = drupal.system.connect()
print res