Re: Error in Java XML RPC code
On 2/9/2014 5:50 AM, Ojesh Dugar wrote:
I am trying to access a webservice api through XMLRPC from java client code.
But getting some error.Pls Help.
My Code:
import org.apache.commons.httpclient.HttpClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
HttpClient httpClient = new HttpClient();
XmlRpcClient rpcClient = new XmlRpcClient();
XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(rpcClient);
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
factory.setHttpClient(httpClient);
Error:
BugCreator2.java:20: error: cannot find symbol factory.setHttpClient(httpClient); ^ symbol: method setHttpClient(HttpClient) location: variable factory of type XmlRpcCommonsTransportFactor Note: BugCreator2.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
Jars Used:
commons-httpclient-3.0.1
java-rt-jar-stubs-1.5.0
ws-commons-util-1.0.1
ws-commons-util-1.0.1-sources
xmlrpc-3.0
xmlrpc-3.0-common
setHttpClient is is latest XML-RPC version 3.1.3 but is not in the
version you are using 3.0.
My suggestion: try update.
Arne