Java To XML

Java To XML is a synchronous activity. You can use this activity to convert Java object's data members into an XML document.

General

Note: If the class does not have a public data member and only has a Java bean modifier that sets the data, the input schema contains an element for the modifier, but the resulting XML document has no value set for the corresponding element. For example, the Java object has a method declared as public int setID(), but there is no method for getting the ID and the data member ID is not public. In this case, an element named ID in this activity’s output schema exists, but that element has no value because there is no public mechanism for getting the data.

The General tab has the following fields.

Field Module Property? Description
Name No The name to be displayed as the label for the resource.
Class Name No The class name in the Java schema to use.

Use the Browse button to bring up the dialog to select the Java class.

Click the Reload button to regenerate the schema.

Description

Provide a short description for the activity.

Advanced

The Advanced tab has the following fields.

Field Description
Instantiate the referenced class This field controls one of the following:
  • The referenced class must be constructed when the activity is executed.
  • An object reference must be supplied in the activity’s input schema.

Select this check box to construct the referenced class using the default constructor when the activity executes. In this case, the referenced class is not included in the activity’s input schema.

Do not select this check box if you want to provide an object reference for the class name specified on the General tab. The object must be created and contained in the output schema of a previously executed activity.

In this case, the referenced class is included in the activity’s input schema.

Cache the object This option is available only when you select the Instantiate the referenced class check box.

Select this check box to specify that all instances of this Java Invoke activity share the instance of the instantiated referenced class. A cached referenced object is kept in the memory until the process engine terminates.

Not selecting this check box leads to each instance of this Java To XML activity creating its own copy of the referenced class.

Input

The following is the input for the activity.

Input item Datatype Description
referenced class Java Object An object reference to the Class Name specified on the General tab. This element is only available when you do not select the Instantiate the referenced class check box on the Advanced tab.

Output

The following is the output of the activity.

Output Item Datatype Description
XML Schema varies The output is the XML schema from the converted Java object.

The elements in the schema display in alphabetical order.

Fault

The Fault tab lists the possible exceptions thrown by this activity. See Error Codes for more information about error codes and possible the corrective actions to take.

Fault Thrown When...
JavaToXMLConversionException An error occurred when converting the Java object to XML.