|
From: Victor A. [ M. - A. H. (Y. ]
<vic...@mt...> - 2009-09-09 12:41:25
|
Hi,
I'm using the Redstone XML-RPC as a Servlet (extending XmlRpcServlet).
Here's the Servlet:
public class SCServlet extends XmlRpcServlet {
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
getXmlRpcServer().addInvocationHandler("URequest", new URequestImpl());
}
}
URequest is an Interface and URequestImpl is the implementation class (Find them below)
public interface URequest {
Object handleURequest(String TransactionId, String UCode, String URequestString, String m, Date TransactionTime);
}
Here's my Client:
public class SCUTest {
public static void main(String[] args) throws Exception {
new SCUTest();
}
public SCUTest () throws Exception {
XmlRpcClient client = new XmlRpcClient("http://localhost:8780/sc-web/xml-rpc/", false);
Object token = client.invoke("URequest.handleURequest", new Object[]{new String("1234567890"), new String("134"), new String("*134*977654321#"), new String("9712345678"), new Date()});
XmlRpcStruct struct = (XmlRpcStruct) token;
System.out.println("Returned Map" + struct.toString());
}
}
Here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>xml-rpc</servlet-name>
<servlet-class>com.xmlrpc. SCServlet </servlet-class>
<init-param>
<param-name>streamMessages</param-name>
<param-value>1</param-value>
</init-param>
<init-param> <!-- Optional! Defaults to text/xml and ISO-8859-1 -->
<param-name>contentType</param-name>
<param-value>text/xml; charset=ISO-8859-1</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>xml-rpc</servlet-name>
<url-pattern>/xml-rpc/*</url-pattern>
</servlet-mapping>
</web-app>
I keep seeing on my Jboss4.3eap console:
ERROR [STDERR] 09-Sep-2009 13:30:01 redstone.xmlrpc.XmlRpcDispatcher writeError
WARNING: Invalid method name format
Please could someone kindly Help... what's the right way of calling client.invoke ???
Victor Akinola
|