Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, August 6, 2008

Java Proxy Objects Developing Message Interfaces

Definition

All Java objects that are created from a message interface from the Integration Repository in an SAP system, are called Java Proxy Objects. Multiple proxy objects are created in the system for each message interface (Java classes or Java interfaces).

Message interfaces contain message types, and these in turn contain data types.All objects referenced to message interfaces (including fault message types), are also called Interface Objects. They are the counterparts of the generated proxy objects.

Structure

You can divide the different interface objects into two classes: The message interface itself and the corresponding parameters and data types (also see: Converting WSDL to the Target Language).

Each generated proxy object can be assigned to its corresponding interface object in the Integration Repository even after generation.

Interfaces

Interfaces have a direction (outbound or inbound) and a mode (synchronous or asynchronous). For more information, see Communication Parameters.

The Java runtime is at present still unable to provide queues for the asynchronous processing of messages. If an error occurs when sending an asynchronous message, an exception is thrown.

Depending on the interface direction, the following proxy objects are generated:

· You call an inbound interface to start a service that, in the synchronous case, returns a result. Proxy generation generates a Java interface for an inbound interface. To make this service available, implement this interface using a Java class. Note the following for the implementing class: If the name of the generated Java interface is JavaInterface, then the implementing class must be JavaInterfaceImpl and it must be located in the same package as the generated Java interface.

· You call an outbound interface to send a message to an inbound interface. An outbound interface is mapped to a Java class.

· You must generate additional bean classes for J2EE applications. In this case, send and receive messages by using the bean classes and not directly by using the proxy classes. These classes are not required for Java standalone applications.

In general, the signature of the generated method for a message interface MI from the Integration Repository, looks as follows (in the synchronous case, without return parameters):

· Outbound: public MI()

· Inbound: public MI()

The class for the input or output message corresponds to the data type referenced by the message type used. No public global classes are generated for message types (fault message types are the only exception here).

Parameters and Data Types

The following objects are generated, regardless of whether they are inbound or outbound:

· A class for each complex data type generated that contains set/get methods for accessing the respective fields.

· No classes are required for simple data types. For example, if a simple data type of type xsd:string is used, Java proxy generation does not generate a separate global class for the data type. Instead, it uses the corresponding Java data type java.lang.String directly.

In XSD, you can also define elements that can occur infinitely in the message. This exceptional case is described in Tables.

Example

The following graphic illustrates how an interface from the Integration Repository is mapped to a Java proxy:

This graphic is explained in the accompanying text

The original names of the interface objects are highlighted in bold. You can see that proxy generation had enhanced the names (see also:Naming Java Proxy Objects). The method bookOutexpects the formal parameter om of type Ct_Type. Therefore, you transfer the data type directly. The message type is included internally by the proxy runtime by using the private class Om_Message.

No comments:

Archives