[ http://issues.apache.org/jira/browse/XMLRPC-114?page=comments#action_12435720 ] Jochen Wiedmann commented on XMLRPC-114: ----------------------------------------
Ok, I have worked out the problem. You are using the CommonsHttpTransport as a client and the WebServer as a server. The client is using the chunked encoding, because you enable "ContentLengthOptional". In other words, the first bytes that the server sees are <length>\r\n <?xml ... Which is quite right, because the first line indicates the requests length. Unfortunately, the WebServer class isn't able to deal with chunked encoding. I haven't yet decided how to deal with that. I am absolutely uninterested with working on the WebServer class. It is an ugly hack, nice for testing, but nothing else. I never recommended using it. If someone else is ready to add support for chunked encoding, well. Your current options are: - Use a real webserver (recommended) - Disable contentlengthoptional > Exception thrown when "content length optional" is true > ------------------------------------------------------- > > Key: XMLRPC-114 > URL: http://issues.apache.org/jira/browse/XMLRPC-114 > Project: XML-RPC > Issue Type: Bug > Affects Versions: 3.0 > Environment: OpenSuse 10.0 > JDK/JRE 1.5.0_06-b05 > Reporter: Jimisola Laursen > Assigned To: Jochen Wiedmann > Attachments: XMLRPC-114.zip > > > I created a small prototype to test sending files over XMLRPC using byte[]. > It fails however and it fails even with a simply RPC method (echo) that just > returns the String parameter. > I'll provide a test project in an attachment. > Client: > Exception in thread "main" java.lang.reflect.UndeclaredThrowableException > at $Proxy0.echo(Unknown Source) > at xmlrpctest.Client.main(Client.java:32) > Caused by: org.apache.xmlrpc.XmlRpcException: Failed to parse XML-RPC > request: Content is not allowed in prolog. > at > org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186) > 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.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53) > at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166) > at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136) > at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125) > at > org.apache.xmlrpc.client.util.ClientFactory$1.invoke(ClientFactory.java:108) > ... 2 more > Server: > [Fatal Error] :1:1: Content is not allowed in prolog. > Sep 18, 2006 10:23:13 PM org.apache.xmlrpc.server.XmlRpcStreamServer execute > SEVERE: execute: Error while performing request > org.apache.xmlrpc.XmlRpcException: Failed to parse XML-RPC request: Content > is not allowed in prolog. > at > org.apache.xmlrpc.server.XmlRpcStreamServer.getRequest(XmlRpcStreamServer.java:66) > at > org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:190) > at org.apache.xmlrpc.webserver.Connection.run(Connection.java:176) > at > org.apache.xmlrpc.util.ThreadPool$MyThread.runTask(ThreadPool.java:71) > at org.apache.xmlrpc.util.ThreadPool$MyThread.run(ThreadPool.java:87) > Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1269) > at > org.apache.xmlrpc.server.XmlRpcStreamServer.getRequest(XmlRpcStreamServer.java:60) > ... 4 more > Caused by: > org.xml.sax.SAXParseException: Content is not allowed in prolog. > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1269) > at > org.apache.xmlrpc.server.XmlRpcStreamServer.getRequest(XmlRpcStreamServer.java:60) > at > org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:190) > at org.apache.xmlrpc.webserver.Connection.run(Connection.java:176) > at > org.apache.xmlrpc.util.ThreadPool$MyThread.runTask(ThreadPool.java:71) > at org.apache.xmlrpc.util.ThreadPool$MyThread.run(ThreadPool.java:87) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
