wiki:ExampleUsingXmlRpcBeans

Version 2 (modified by lauer, 18 years ago) (diff)

--

Using XmlRpcBeans in you API

What are XmlRpcBeans??

Sometimes parameter conversion is a straight-forward task which can be handed over to the XML-RPC runtime system. When a java class fulfills certain conditions (roughly, being a java bean with complatible types) it can be turned into a XmlRpcBean by annotating it with the @XmlRpcBean annotation. It then can be used in every XML-RPC call without restriction. A XmlRpcBean must have

  • a public constructor taking no arguments
  • like a java bean: for each property which is supposed to be transported over XML-RPC there has to exist a public getter and setter method
  • each peroperty type has to be XML-RPC compliant, that is it has to have one of the follwoing properties:
  • it is a standard XML-RPC type
  • it is annotated with a @XmlRpc annotation and defines proper conversion methods
  • a conversion mapping for that type is put at the XmlRpcBean (which then acts as an API itself)
  • it is an XmlRpcBean (that is, XmlRpcBeans can be nested)

See also How to use own types in Collections an Maps.