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 ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.