IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing using the web service API

Passing and retrieving variables

You can pass variables to the web API by mapping IBM BPM simple variable types to XML data.


Passing simple variable types

You can pass simple variables types to the web API. In general, the web API uses the same simple types as the XML schema.

For example, if you pass in an XSD simple string, the web API will use the same data type. For more information, consult the web service documentation for the toolkit that you are using.


Passing complex variable types

You can pass external complex variable types to the web API after converting them to XML and wrapping them in a ComplexValue object.

You can use tools to convert your data structures to and from XML.

For example, for Java classes, you can use a JAXB implementation, Apache XMLBeans, or Castor. In Microsoft .NET, you can use the XML serialization APIs provided in the platform libraries.

For example, the following code sample shows how to serialize data to XML:

protected String toCustomerXml(String id, String firstName, String lastName)
{
  return "<customer xmlns=\"urn:testcases.webapi.common\">" +
  "<id>" + id + "</id>" +
  "<firstName>" + firstName + "</firstName>" +
  "<lastName>" + lastName + "</lastName>" +
  "</customer>";}


The ComplexValue object

The ComplexValue object is part of the IBM BPM web API. You can use the ComplexValue object to wrap complex type values to pass to and from web API operations. The ComplexValue object can contain a single element from any namespace.

When passing an external complex type value, ensure that there is a corresponding complex type in IBM BPM that has its advanced XML properties configured to match the schema of the complex type you would like to pass.

Developing using the web service API


Related reference:
Wrapping a complex type value in a ComplexValue object