Creating an XML-RPC Handler

Any Java class can take XML-RPC method calls, as long as it has public methods with return types and arguments that correspond properly with XML-RPC data types.

These classes are called XML-RPC handlers, because a server gives them the job of handling an incoming request.

Every public method of the class can be called over XML-RPC, as it is implemented by Apache XML-RPC, so you must keep this in mind when declaring methods.

The LottoCounter class in Listing 25.1 can handle XML-RPC calls. This class receives lottery results, storing them in an XML file named lotto.log.

This class and the rest of the hour's projects require XOM, the class library introduced in Hour 21. Download the library from the website http://www.cafeconleche.org/XOM ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.