Mapping LiveCycle complex data types

Some LiveCycle operations require complex data types as input values. These complex data types define run-time values used by the operation. For example, the Customer service's createCustomer operation requires a Customer instance that contains run-time values required by the service. Without the complex type, the Customer service throws an exception and does not perform the operation.

When invoking a LiveCycle service, create ActionScript objects that map to required LiveCycle complex types. For each complex data type that an operation requires, create a separate ActionScript object.

In the ActionScript class, use the RemoteClass metadata tag to map to the LiveCycle complex type. For example, when invoking the Customer service's createCustomer operation, create an ActionScript class that maps to com.adobe.livecycle.sample.customer.Customer data type.

The following ActionScript class named Customer shows how to map to the LiveCycle data type com.adobe.livecycle.sample.customer.Customer.

package customer 
 
{ 
    [RemoteClass(alias="com.adobe.livecycle.sample.customer.Customer")] 
    public class Customer 
    { 
           public var name:String; 
           public var street:String; 
           public var city:String; 
           public var state:String; 
           public var phone:String; 
           public var zip:int; 
       } 
}

The fully qualified data type of the LiveCycle complex type is assigned to the alias tag.

The ActionScript class's fields match the fields that belong to the LiveCycle complex type. The six fields located in the Customer ActionScript class match the fields that belong to com.adobe.livecycle.sample.customer.Customer. (See Defining the Customer class.)

A good way to determine the field names that belong to a LiveCycle complex type is to view a service's WSDL in a web browser. A WSDL specifies a service's complex types and the corresponding data members. The following WSDL is used for the Customer service: http://[yourServer]:[yourPort]/soap/services/CustomerService?wsdl.

The Customer ActionScript class belongs to a package named customer. It is recommended that you place all ActionScript classes that map to complex LiveCycle data types in their own package. Create a folder in the Flex project's src folder and place the ActionScript file in the folder, as shown in the following illustration.