axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Suriarachchi" <>
Subject Generating Custom Schemas with Axis2 rmi.
Date Tue, 21 Aug 2007 03:15:35 GMT

There is no control to the user about the generated schema with the basic
Axis2 -rmi functionalities. but with the custom schema support users have a
lot of controll over the generated schema.

Specifiying java Bean properties as attributes and setting xml names.

(Please see the advanced-rmi sample which has a working sample)

Lets take this java bean.

public class TestClass {

private int param1;

private String param2;

private int param3;

 the generated complex type for this bean would be

<xsd:complexType name="TestClass">


<xsd:element name="param1" type="xsd:int"/>

<xsd:element name="param2" type="xsd:string"/>

<xsd:element name="param3" type="xsd:int"/>



 but what if some one needs to generate the sechma so that pama1 and param2
as attributes, and generate xml at runtime as it is. Further what if you
want to use as the xmlParam1 instead of java param name param1.

The only thing you have to do is to add declare the CustomClassInfo in
config.xml at the server side and load this data to configurator at client
side. (please see the advanced-rmi sample)



<classInfo className="TestClass1">

<fieldInfo isElement="false" javaName="param1" xmlName="xmlParam1"/>

<fieldInfo isElement="false" javaName="param3" xmlName="xmlParam3"/>



 this would generate the xmlschema with attributes and parse and serialize
the xml stream as it is.

 at client user has to load these details to configurator

ClassInfo classInfo = new ClassInfo(TestClass1.class);

classInfo.addFieldInfo(new FieldInfo("param1", "xmlParam1", false));

classInfo.addFieldInfo(new FieldInfo("param3", "xmlParam3", false));


On the other hand this feature can be used to map an existing java object
structure to an xml stream. The only requrement is to have a same structure
on both xml document and java objects.


Amila Suriarachchi,
WSO2 Inc.

View raw message