Implementing Multiple Interfaces

You can also implement multiple interfaces for a Serializable class or a Messenger class when you want to have a single class implementation and have more than one variation of an XML message returned from it.

To implement multiple interfaces for a Serializable class or a Messenger class, perform the following:

  1. In the Class View window, add a Serializable class or a Messenger class; for example, CustomerInfo.

  2. Add Serializations (Serializable interfaces) to define the XML messages; for example, ICustomerInfo and ICustInfoSummary.

  3. Implement the interfaces (once for each interface) for the Serializable class or the Messenger class.

    Note: You can also implement interfaces present anywhere within the model.

  4. When writing logic to return an XML message from a Respond() method you can specify the interface you want to use to serialize the class to XML by using the AsA command option in the Return logic command.

    For example:

    If FullDetails
           Return aCustInfo AsA ICustInfoSummary
    End
    Return aCustInfo AsA ICustInfoSummary

If you have a Messenger class that implements multiple interfaces you have to specify the interface to be used for de-serializing an input XML message.

To specify the interface to be used for de-serializing an input XML message, perform the following:

  1. In the Class View window, expand the Messenger class after creating the Implements relationship.

  2. Select the Serialization (serializable interface) that is to be used to de-serialize input XML messages, and then invoke the Properties window.

  3. Set the Use for Cycle property under the Misc group to True.

    The Use for Cycle property also specifies the interface to be used to serialize a method parameter that is being passed in an external method call.