Red Hat Training

A Red Hat training course is available for JBoss Enterprise SOA Platform

13.3.6. ObjectToXStream

Input Type User Object
Output Type java.lang.String
Class org.jboss.soa.esb.actions.converters.ObjectToXStream
Takes the Object bound as the Message payload and converts it into XML using the XStream processor. .

Table 13.4. ObjectToXStream Properties

Property Description Required
class-alias
Class alias used in call to XStream.alias(String, Class) prior to serialization. Defaults to the input Object's class name.
No
exclude-package
Exclude the package name from the generated XML. Default is true. Not applicable if a class-alias is specified.
No
aliases
Specify additional aliases in order to help XStream to convert the XML elements into Objects.
No
namespaces
Specify namespaces that should be added to the XML generated by XStream. Each namespace-uri is associated with a local-part which is the element on which this namespace should appear.
No
xstream-mode
Specify the XStream mode to use. Possible values are XPATH_RELATIVE_REFERENCES (the default), XPATH_ABSOLUTE_REFERENCES, ID_REFERENCES or NO_REFERENCES.
No
fieldAliases
Field aliases to be added to Xstream.
No
implicit-collections
Which will be registered with Xstream
No
converters
List of converters that will be registered with Xstream
No

Example 13.5. Sample Configuration

<action name="transform" class="org.jboss.soa.esb.actions.converters.ObjectToXStream">
    <property name="class-alias" value="MyAlias" />
    <property name="exclude-package" value="true" />
    <property name="aliases">
        <alias name="alias1" class="com.acme.MyXXXClass1" />
        <alias name="alias2" class="com.acme.MyXXXClass2" />
        <alias name="xyz" class="com.acme.XyzValueObject"/>
        <alias name="x" class="com.acme.XValueObject"/>
        ...
    </property>
    <property name="namespaces">
        <namespace namespace-uri="http://www.xyz.com" local-part="xyz"/>
        <namespace namespace-uri="http://www.xyz.com/x" local-part="x"/>
        ...
    </property>
    <property name="fieldAliases">
        <field-alias alias="aliasName" definedIn="className" fieldName="fieldName"/>
        <field-alias alias="aliasName" definedIn="className" fieldName="fieldName"/>
        ...
    </property>
    <property name="implicit-collections">
        <implicit-collection class="className" fieldName="fieldName" 
            fieldType="fieldType" itemType="itemType"/>
        ...
    </property>
    <property name="converters">
        <converter class="className" fieldName="fieldName" fieldType="fieldType"/>
        ...
    </property>
</action>