Issue Details (XML | Word | Printable)

Key: XMLRPC-108
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Catalin Hritcu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XML-RPC

Many broken code examples in the documentation

Created: 25/Aug/06 05:35 PM   Updated: 05/Oct/06 08:57 PM
Return to search
Component/s: Source, Website
Affects Version/s: 3.0rc1
Fix Version/s: 3.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File xmlrpc3-doc.patch 2006-08-25 05:35 PM Catalin Hritcu 4 kB

Resolution Date: 25/Aug/06 09:06 PM


 Description  « Hide
Had to learn to use xmlrpc these days, and the good documentation helped a lot. However, many of the code examples on the website and in the java-docs won't even compile - outdated. They are mostly minor glitches but still annoying. Here are some examples I can remember:

http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/webserver/WebServer.html

   final int portNumber = 8088;
   final String propertyFile = "MyHandler.properties";

   PropertyHandlerMapping mapping = new PropertyHandlerMapping();
   ClassLoader cl = Thread.currentThread().getContextClassLoader();
   mapping.load(cl, propertyFile);
   WebServer webServer = new WebServer(port);
   XmlRpcServerConfigImpl config = new XmlRpcServerConfigImpl();
   XmlRpcServer server = server.getXmlRpcServer();
   server.setConfig(config);
   server.setHandlerMapping(mapping);
   server.start();

- "port" should be "portNumber"
- "server.getXmlRpcServer()" should be "webServer..getXmlRpcServer()"
- "server.start()" should be "webServer.start()"


http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/webserver/ServletWebServer.html

        final int portNumber = 8088;

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        XmlRpcServlet servlet = new XmlRpcServlet();
        ServletWebServer webServer = new ServletWebServer(servlet, port);
        webServer.start();

- "port" should be "portNumber"
- "cl" is never used


http://ws.apache.org/xmlrpc/client.html

    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerUrl("http://127.0.0.1:8080/XmlRpcServlet");
    XmlRpcClient client = new XmlRpcClient();
    client.setTransportFactory(new XmlRpcCommonsTransportFactory());
    client.setConfig(config);
    Object[] params = new Object[]{new Integer(2), new Integer(3)};
    Integer result = (Integer) client.execute("Calculator.add", params);

- "config.setServerUrl("http://127.0.0.1:8080/xmlrpc");" should be "config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc"));"
- "new XmlRpcCommonsTransportFactory()" should be "new XmlRpcCommonsTransportFactory(client)"


There are probably more lurking around. For the ones I knew how to fix I attached a patch (). What I couldn't fix was:
http://ws.apache.org/xmlrpc/server.html -> Basic Authentication - since PropertyHandlerMapping.newXmlRpcHandlerMapping no longer exists.

PS: I grant license to ASF for inclusion in ASF works (as per the Apache Software License §5) ... the create issue form is broken and won't ask about this.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jochen Wiedmann made changes - 25/Aug/06 09:06 PM
Field Original Value New Value
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 [ 12312023 ]
Jochen Wiedmann made changes - 05/Oct/06 08:57 PM
Status Resolved [ 5 ] Closed [ 6 ]