Powered By

Free XML Skins for Blogger

Powered by Blogger

Friday, January 16, 2009

XSLT Mapping

Use

Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how an XML structure is transformed into another XML structure.

Features

XPath and

You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.

You can use the XSLT tags and to include predefined templates for substructures in a complete mapping definition. In this way, you can reuse mappings for data types.

Runtime Constants

In the same way as in Java mappings, the mapping runtime in XSLT programs also returns parameters that you can use to evaluate information in the XSLT program that is not known until runtime:

Mapping Runtime Constants

Constant

Meaning

Relevant for PCK

$MessageClass

Classification of message. Possible values:

· ApplicationMessage:
Asynchronous or synchronous request message

· ApplicationResponse:
Response to request message

· SystemAck, ApplicationAck, SystemError, ApplicationError:
Acknowledgment messages

Yes

$VersionMajor

XI message protocol version. Example: For the XI 3.0 message protocol VERSION_MAJOR = 3 and VERSION_MINOR = 0.

No

The PCK only uses message protocol XI 3.0.

$VersionMinor


No

$ProcessingMode

The mode of a message can be synchronous or asynchronous. Correspondingly, these constants can have the value synchronous or asynchronous.

Yes

$MessageId

The message ID. It can change during communication:

· Response messages get a new message ID.

· If new messages result from a message (the message is copied at multiple receivers), the new messages get new message IDs.

Yes

$RefToMessageId

The ID of a referenced message that belongs semantically to this message. For example, a response message uses this field to note which request message it belongs to.

Yes

$ConversationId

This field is not mandatory in the message. It enables an ID to be used to group messages that belong together. This field is not intended to be used for message serialization and has nothing to do with the serialization context (ABAP proxy runtime, Java proxy runtime).

Yes

$TimeSent

Time stamp specifying when the message was sent by the sender. The format of the time stamp is as follows:

YYYY-MM-DDTHH:MM:SSZ

The letter ‘T’ separates the date from the time, which is generally specified in UTC. If it is a local time, the closing ‘Z’ is omitted.

Yes

$Interface

Name of the sender interface. As of SAP XI 3.0, use this constant instead of the constant SENDER_NAME used previously.

Yes

$InterfaceNamespace

Namespace of the sender interface.

As of SAP XI 3.0, use this constant instead of the constant SENDER_NAMESPACE used previously.

Yes

$SenderParty

Communication party that sent the message.

Yes

See also: Structure linkCommunication party

$SenderPartyAgency

Issuing agency for the message sender.

Yes

$SenderPartyScheme

Identification scheme used by the sender.

Yes

$SenderService

Service on the sender side that sent the message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant SENDER_SYSTEM used previously.

Yes

See also: Structure linkService

$ReceiverName

Name of the receiver interface.

Yes

$ReceiverNamespace

Namespace of the receiver interface.

Yes

$ReceiverParty

Communication party to receive the message.

Yes

See also: Structure linkCommunication party

$ReceiverPartyAgency

Issuing agency for the message receiver.

Yes

$ReceiverPartyScheme

Identification scheme used by the receiver.

Yes

$ReceiverService

Service on the receiver side that receives the message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant RECEIVER_SYSTEM used previously.

Yes

See also: Structure linkService

$MappingTrace

Returns a MappingTrace object that you can use to write messages in the monitoring.

No

If you want to access one of the constants in the XSLT program, you first have to declare the constant as a parameter, for example:

Java Enhancements

Moreover, using an XSLT definition you can call external Java methods to convert XML structures. This procedure gives you more flexibility when defining mappings. For more information about XSLT mapping with Java enhancement, see further documentation.

This graphic is explained in the accompanying text

For more information about XSL/XSLT and XPath, see the Web page of the W3 Consortium.

Example

The function for booking a flight contains a parameter for the flight class. The outbound interface represents flight classes as symbolic values; in the inbound interface, flight classes have numerical values. The XSLT section converts the symbolic representation of the source system into the numerical representation of the target system.

The XPath expression match=“//hh:class“ selects the node in the outbound interface. The XSLT statement <xsl:choose> then defines the mapping rule for how the Integration Engine converts the symbolic values in the source system into the numerical values in the target system.

This graphic is explained in the accompanying text

No comments:

Archives