ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Ruediger <christian.ruedi...@gmail.com>
Subject Re: handler not found, not registered
Date Wed, 06 Oct 2004 10:27:56 GMT
I fixed it: the String "location.locate" in addHandler is wrong.
It must be "location" only
The method is invoced via introspection!


On Wed, 6 Oct 2004 11:05:02 +0200, Christian Ruediger
<christian.ruediger@gmail.com> wrote:
> Hi there,
> 
> as described on the hp i implemented a somple class with a methos to
> be invoced.
> classname = Location ; methodname = locate
> I registered the class in the init method of my servlet, but on some
> reasons, when i try to access the server i get this message (code of
> clesses beneath):
> 
> java.lang.Exception: RPC handler object "location" not found and no
> default handler registered
> org.apache.xmlrpc.XmlRpcException: java.lang.Exception: RPC handler
> object "location" not found and no default handler registered
>        at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:457)
>        at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
>        at gsmadaptateurs.OrangeGSMAdaptateur.demandePosition(OrangeGSMAdaptateur.java:115)
>        at testgroupe1.GSMAdaptateurOrangeTest.testAdaptateur(GSMAdaptateurOrangeTest.java:54)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at junit.framework.TestCase.runTest(TestCase.java:154)
>        at junit.framework.TestCase.runBare(TestCase.java:127)
>        at junit.framework.TestResult$1.protect(TestResult.java:106)
>        at junit.framework.TestResult.runProtected(TestResult.java:124)
>        at junit.framework.TestResult.run(TestResult.java:109)
>        at junit.framework.TestCase.run(TestCase.java:118)
>        at junit.framework.TestSuite.runTest(TestSuite.java:208)
>        at junit.framework.TestSuite.run(TestSuite.java:203)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
> 
> So can anyone give me a hint what went wrong?
> Thanx in advance
> 
> Christian Ruediger
> 
> public class Location {
> 
>    public Vector locate(Vector input){
>        Iterator iterator = input.iterator();
> 
>        return input;
>    }
> }
> 
> public static XmlRpcServer xmlrpc = new XmlRpcServer();
> 
>    public void init (ServletConfig config) throws ServletException   {
> 
>        xmlrpc = new XmlRpcServer();
>        System.out.println("Serveur initialisation avec Location handler");
>        XmlRpc.setEncoding("ISO-8859-1");
>        xmlrpc.addHandler("location.locate", new Location());
> 
>        XmlRpcHandlerMapping hmp = xmlrpc.getHandlerMapping();
>        try {
>            System.out.println(hmp.getHandler("location.locate").toString());
>        } catch (Exception e) {
>            e.printStackTrace();
>            System.out.println("location.locate not registered");
>        }
> 
>    }
> 
> protected void doPost(HttpServletRequest req,
>            HttpServletResponse res)
>    throws ServletException, IOException
>    {
> 
>        //get authorization header from request
>        String auth=req.getHeader("Authorization");
>        if (!auth.toUpperCase().startsWith("BASIC")) {
>           throw new ServletException("wrong kind of authorization!");
>        }
> 
>        //get encoded username and password
>        String userPassEncoded=auth.substring(6);
> 
>        //create a base64 decoder using Sun utility class
>        sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder(  );
>        String userPassDecoded= new String(dec.decodeBuffer(userPassEncoded));
> 
>        //split decoded username and password
>        StringTokenizer userAndPass=new StringTokenizer(userPassDecoded,":");
>        String username=userAndPass.nextToken(  );
>        String password=userAndPass.nextToken(  );
> 
>        //send input stream, username, and password to xmlrpc.execute
> 
>        byte[] result = xmlrpc.execute(req.getInputStream(), username,
> password);
> 
>        //byte[] result = "Eine Menge Text!".getBytes();
> 
>        res.setContentType("text/xml");
>        res.setContentLength(result.length);
>        OutputStream output = res.getOutputStream();
>        output.write(result);
>        output.flush();
>    }
> 
> }
>

Mime
View raw message