[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlrpc-dev
Subject:    RE: how can i test a simple client?
From:       _anthrazit () web ! de
Date:       2010-01-26 8:59:53
Message-ID: 2009849645 () web ! de
[Download RAW message or body]

Hi,

proxy Server was missing !
The following code runs :-)) 

-->

<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.xmlrpc.client.*"%>
<%@ page import="org.apache.xmlrpc.client.XmlRpcClientConfigImpl.*"%>
<%@ page import="org.apache.xmlrpc.XmlRpcException"%>

<%

String address = "http://test.xmlrpc.wordtracker.com/";
String message= "testmessage";

Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost","192.168.xx.xx") ; //your proxy server
systemSettings.put("http.proxyPort", "8080") ;

XmlRpcClientConfigImpl rpcconfig = new XmlRpcClientConfigImpl();
rpcconfig.setServerURL(new URL(address));
XmlRpcClient client = new XmlRpcClient();       
client.setConfig(rpcconfig);    

Vector params = new Vector ();   
params.addElement( "guest" );
    
String methodName = "ping";   

   
    try {
            //  client.execute(methodName, params);
            Object result=client.execute(methodName, params);  
           if (result instanceof Boolean) {
           Boolean b=(Boolean)result;
           System.out.println (result.toString());
           message=result.toString();
           }
	   /* for (int i=0; i < result.size(); i++) {
		System.out.println (result.elementAt(i));
	    }*/

	} catch (XmlRpcException e) {
	    //XmlRpcException ex =(XmlRpcException)e;
	    System.err.println ("client.excecute failed - " +e.toString());
	    message=e.toString()+" "+ e.getMessage()+ "Code="+e.code;
	}
	catch(Exception ex) {                
               message += ex.getMessage();
                }
	

%>
<html>
<body bgcolor="white">


<font size=4>
<br>
Message:<br>
<%= message%>
</font>

</body>
</html>


> -----Ursprüngliche Nachricht-----
> Von: _anthrazit@web.de
> Gesendet: 25.01.10 10:42:16
> An: xmlrpc-dev@ws.apache.org
> Betreff: how can i test a simple client?

> Hi,
> 
> i want to do a simple "ping" to any existing xml-rpc Server, so i cant test if i \
> have understand basically how xml-rpc works... 
> I tried this in a jsp-page and think it should work, but it doesn't . 
> ---------------------------->
> <%@ page import="java.net.*"%>
> <%@ page import="org.apache.xmlrpc.client.*"%>
> <%@ page import="org.apache.xmlrpc.client.XmlRpcClientConfigImpl.*"%>
> <%@ page import="org.apache.xmlrpc.XmlRpcException"%>
> 
> <%
> 
> String address = "http://test.xmlrpc.wordtracker.com/";
> String message= "testmessage";
> 
> XmlRpcClientConfigImpl rpcconfig = new XmlRpcClientConfigImpl();
> rpcconfig.setServerURL(new URL(address));
> XmlRpcClient client = new XmlRpcClient();       
> client.setConfig(rpcconfig);    
> 
> Vector params = new Vector ();   
> params.addElement( "guest" );
> 
> String methodName = "ping";   
> 
> 
> try {
> //  client.execute(methodName, params);
> Object[] result=(Object[]) client.execute(methodName, params);  
> 
> 	   /* for (int i=0; i < result.size(); i++) {
> 		System.out.println (result.elementAt(i));
> 	    }*/
> 
> 	} catch (XmlRpcException e) {
> 	    //XmlRpcException ex =(XmlRpcException)e;
> 	    System.err.println ("client.excecute failed - " +e.toString());
> 	    message=e.toString()+" "+ e.getMessage()+ "Code="+e.code;
> 	}
> 	catch(Exception ex) {                
> message = ex.getMessage();
> }
> 	
> 
> %>
> <html>
> <body bgcolor="white">
> 
> 
> <font size=4>
> <br>
> <%= message%>
> </font>
> 
> </body>
> </html>
> 
> 
> <----------------------------------------------------------------
> 
> 
> error Message ---->
> 
> org.apache.xmlrpc.client.XmlRpcHttpTransportException: 
> HTTP server returned unexpected status: Method Not Allowed 
> 
> 
> Am I totally wrong with that code?
> 
> Have anyone a realy easy testing code and a server-adress where i can test it?
> I dont want to create an Server, i only want to write an client which can connect \
> to an existing xml-server... 
> 
> Anthrazit


______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic