>Hello All,
>
>I am using Twisted's xml-rpc implementation.
>
>I can connect to twisted with python clients using the standard
>xmlrpc lib client, and twisted clients.
>
>When I try a apache's 1.2 alpha java client, I can't connect.
>
>
>The java clients fails to connect to the twisted server.
>
>I am new to xmlrpc, but noticed some differences between
>the apache and twisted
>
>1) twisted uses HTTP 1.0, while Java uses HTTP 1.1.
>2) java adds the port to the host name
>... other issues
>
>
>Are these differences showstoppers?
>
>Any suggestions?
>
>Thanks
>Mike
>
>PS. below is the messages between twisted client, and java client
>and the xml-rpc server
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
Java client code
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Vector;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
/**
* @author scmikes
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class UgsXmlRpcClient {
public static void main(String[] args) {
try {
XmlRpcClient xmlrpc =
new XmlRpcClient
("http://127.0.0.1:16000/services/RPC2");
Vector params = new Vector();
params.addElement("foo");
try {
// this method returns a string
System.out.println("Before Call");
String result = (String) xmlrpc.execute("runJob",
params);
System.out.println("Result = " + result);
} catch (XmlRpcException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
====================
>
>
>
>
>Here is the twisted clients request:
>
>--------------------------------------------
>New connection
><== (0) 'POST /services/RPC2 HTTP/1.0\r'
><== (0) 'User-Agent: Twisted/XMLRPClib\r'
><== (0) 'Host: 127.0.0.1\r'
><== (0) 'Content-type: text/xml\r'
><== (0) 'Content-length: 203\r'
><== (0) '\r'
><== (0) '<?xml version="1.0"?>'
><== (0) '<methodCall>'
><== (0) '<methodName>runJob</methodName>'
><== (0) '<params>'
><== (0) '<param>'
><== (0) '<value><array><data>'
><== (0) '<value><string>dir c:\\</string></value>'
><== (0) '</data></array></value>'
><== (0) '</param>'
><== (0) '</params>'
><== (0) ''
><== (0) '</methodCall>'
>Sender connected
>-------------------------------------------
>
>
>
>
>Here is apache's xml-rpc 1.2_alpha
>
>
>
>---------------------------------------------------------
>New connection
>Sender connected
><== (0) 'POST /services/RPC2 HTTP/1.1\r'
><== (0) 'Content-Length: 149\r'
><== (0) 'Content-Type: text/xml\r'
><== (0) 'Cache-Control: no-cache\r'
><== (0) 'Pragma: no-cache\r'
><== (0) 'User-Agent: Java/1.4.2_03\r'
><== (0) 'Host: 127.0.0.1:16000\r'
><== (0) 'Accept: text/html, image/gif, image/jpeg, *; q=.2, */*;
q=.2
>\r'
><== (0) 'Connection: keep-alive\r'
><== (0) '\r'
>
>