SAP XI Adapter

The SAP XI adapter, with the GIS Resource Adapter (GIS RA), provides integration capability between Sterling B2B Integrator and SAP® NetWeaver™ through the SAP Exchange Infrastructure (XI) component of SAP NetWeaver.

Note: SAP Exchange Infrastructure (SAP XI) was renamed to SAP Process Integration (SAP PI) beginning with version 7.0. Any references to the SAP XI product in this topic also apply to SAP PI.

The following table provides an overview of the SAP XI adapter:

Category Description
System Name SAP XI Adapter
Graphical Process Modeler (GPM) category All Services
Description The SAP XI adapter connects Sterling B2B Integrator to the SAP XI component of SAP NetWeaver. The SAP XI adapter communicates with SAP XI through the GIS RA (Resource Adapter) supplied with Sterling B2B Integrator and deployed in SAP XI.
Business usage The SAP XI and GIS RA adapters together are used to send and receive information in the form of messages with XML or binary content between Sterling B2B Integrator and SAP XI. This allows a tight integration between Sterling B2B Integrator and NetWeaver-based SAP solutions.
Usage example Sterling B2B Integrator translates an incoming EDI ORDER document into an XML-based ORDER message (as defined by SAP) and sends it to the SAP XI system using the SAP XI adapter.
Preconfigured? No. Both adapters must be installed separately in Sterling B2B Integrator and SAP XI. Both adapters require configuration steps to be performed after installation.
Requires third-party files? The SAP XI adapter requires three library files from your SAP XI installation:
  • sapj2eeclient.jar
  • exception.jar
  • logging.jar
See Installing the SAP XI Library Files for more information.
Note: The SAP XI adapter does not require the SAP JCo libraries.
Platform availability All supported Sterling B2B Integrator platforms and all supported SAP NetWeaver platforms.
Related services None
Application requirements An SAP XI account (User ID and password) is required for the SAP XI adapter to communicate with SAP XI. This account must have permissions for rebind/unbind operations in SAP JNDI registry. This can be accomplished by assigning the role SAP_J2EE_ADMIN to the SAP XI user account. Similarly, a Sterling B2B Integrator account (User ID and password) is required for the GIS RA to communicate with Sterling B2B Integrator. The SAP XI adapter must be registered in the Sterling B2B Integrator JNDI registry. The SAP XI adapter and GIS RA must be bound to the SAP XI JNDI Naming service using different JNDI addresses.
Initiates business processes? The SAP XI adapter initiates a business process in Sterling B2B Integrator when it receives a message from SAP XI. The message contents and any optional attachments are passed to the business process.
Invocation SAP XI to Sterling B2B Integrator

SAP XI triggers an outbound (out of SAP) message. The SAP RA adapter sends the message to Sterling B2B Integrator. The name of the business process to be started for an SAP outbound message is configured in the SAP XI adapter. The SAP XI adapter must be configured as an outbound adapter.

Sterling B2B Integrator to SAP XI

A Sterling B2B Integrator business process can invoke the SAP XI adapter to send a message to SAP XI. The SAP XI adapter must be configured as an inbound adapter. The message is passed to the SAP XI adapter as the primary document. Attachments may be passed in an XML structure of the process data. When the SAP RA adapter receives the message, it passes it to the SAP AF. Routing information may also be passed in the message.

Business process context considerations None
Returned status values
Returned status values:
  • Success – SAP XI ended successfully
  • Error – Various advanced status values plus process data content
Advanced Status: The SAP XI adapter returns one of the following messages if an error occurs during message processing:
  • GA_INITIALIZATION_FAILED – Error during SAP XI adapter, including communication failures such as “bind failed”.
  • GA_SYNC_SEND_FAILED – Error using the sendSync method, including communication failures.
  • GA_FAILURE – Unspecified error. Information is contained in the status report or the sapxi.log file.
Restrictions None
Persistence level The SAP XI adapter bootstraps a business process in inbound mode. The persistence level is determined by the persistence settings of the bootstrapped business process.
Testing considerations SAP XI Adapter

During testing, set the log level for the sapxi logger to ALL in the install_dir/properties/log.properties file.

GIS RA

During testing, turn on Debug mode, in SAP XI, for the GIS RA (called GIS adapter in SAP XI) to save all trace messages. The SAP XI trace files are saved in the /usr/sap/SysNum/DVEBMGS00/j2ee/cluster/servernum/log directory with the file name defaultTrace.num.trc.

How the SAP XI Adapter Works

The SAP XI adapter integrates Sterling B2B Integrator with SAP NetWeaver through the XI Adapter Framework (AF) of the SAP XI 3.0 component of SAP NetWeaver. SAP recommends SAP XI as the component for exchanging data with external applications on either SAP or non-SAP systems.

The XI AF, specifically designed for adapter development and support, runs on the SAP J2EE Application Server (SAP WebAS) and inherits many of the advantages of the SAP WebAS platform, including:
  • Scalability
  • Reliability
  • Persistence layer
  • Transport and security mechanisms
The integration between Sterling B2B Integrator and SAP NetWeaver is actually accomplished by two adapters:
  • SAP XI adapter – A stateful adapter which is deployed and runs in Sterling B2B Integrator.
  • GIS RA – A JCA-compliant resource adapter that is deployed and runs in the SAP XI Adapter Framework (AF) of SAP NetWeaver.
The SAP XI adapter allows you to:
  • Send messages from Sterling B2B Integrator to SAP XI and receive synchronous responses from SAP XI. (Configured as an inbound adapter.)
  • Receive messages from SAP XI, initiate business processes in Sterling B2B Integrator, and, optionally, send synchronous responses back to SAP XI. (Configured as an outbound adapter.)
The GIS RA allows you to:
  • Send messages from SAP XI to the Sterling B2B Integrator SAP XI adapter and receive synchronous responses.
  • Receive messages from the Sterling B2B Integrator SAP XI adapter, pass them to the SAP XI AF, and send back synchronous responses.
SAP XI adapter configurations create a 1:1 connectivity to related GIS RA channels. SAP channels are similar to adapter configurations in Sterling B2B Integrator. The connectivity depends on whether you are sending or receiving messages:
  1. An inbound SAP XI adapter configuration in Sterling B2B Integrator must be configured to connect to an outbound GIS RA Sender channel in SAP XI. A Sender channel sends messages into the SAP XI AF.
  2. An outbound SAP XI adapter configuration in Sterling B2B Integrator must be configured to connect to an inbound GIS RA Receiver channel in SAP XI. A Receiver channel receives messages from the SAP XI AF.

SAP XI Messages

Messages consist of a message payload and, optionally, one or more attachments. The content of the message may be XML or binary. If the content is binary, the message cannot be routed dynamically within SAP XI. The content of the attachments is arbitrary. Attachments are passed to the receiving partner in SAP XI without being opened or parsed. Messages can be sent in synchronous mode only.

Inbound Messages

Messages sent from Sterling B2B Integrator to SAP XI are called inbound messages. The message payload is passed as a primary document in the root of the process data. One or more attachments can also be sent with the message in an attachments structure.

Input Message

The BPML format for the message is:

<PrimaryDocument SCIObjectID=id/>

The optional attachments structure includes a list of attachment nodes:

<attachments>
  attachment_1
  ...
  attachment_n 
</attachments>

This allows for multiple attachments. The attachment numbers increment by one for each attachment and n is the number of the final attachment.

The structure for a single attachment is:

<attachments>
  attachment_1 
</attachments>

Each attachment consists of a document node and an optional body property part. The document node contains a primary document with the attachment contents. You can specify an optional index attribute to define the order of attachments in the message. If the index attribute is omitted, attachments are processed in the specified order.

The structure for a basic document node without optional index attributes or body properties is:

<attachment_n>
  <document>
    PrimaryDocument
  </document> 
</attachment_n>

The structure for a document node with optional index attributes is:

<attachment_n>
  <document index=n>
    PrimaryDocument
  </document>
  <properties index=n>
    BodyProperties
  </properties> 
</attachment_n>

Body properties describe details of a payload message or attachment message. The structure for body properties is:

<BodyName>name</BodyName> 
<BodyDescription>description</BodyDescription> 
<BodyVersion>version</BodyVersion> 
<BodySchema>schema</BodySchema> 
<BodyEncoding>encoding</BodyEncoding> 
<BodyContentType>type</BodyContentType> 
<IsXMLContent>true or false</IsXMLContent>

Response Message

The response message consists of the response payload in the primary document and the SAPXIResponse structure which contains header and body details of the payload and an optional attachments part.

PrimaryDocument 
<SAPXIResponse>
  HeaderDetails
  <properties>
    BodyProperties
  </properties>
  Attachments (optional) 
</SAPXIResponse>

Header Details

<Header>
  <ToService>detail</ToService>
  <FromService>detail</FromService>
  <ToParty>detail</ToParty>
  <FromParty>detail</FromParty>
  <MessageID>detail</MessageID>
  <Action>detail</Action>
  <ActionNS>detail</ActionNS> 
</Header>

Outbound Messages

Messages sent from SAP XI to Sterling B2B Integrator are called outbound messages. For outbound messages, a business process is specified in an SAP XI adapter configuration. This business process is bootstrapped when a message is received from SAP XI. The Output Message is returned in the process data of the business process.

Output Message

The output message consists of the contents of the primary document, an SAP XI outbound structure and an originator ID.

The BPML format for the message is:

PrimaryDocument 
SAP XI Outbound Structure 
<OriginatorID>id</OriginatorID>

The SAP XI Outbound structure is:

<SAPXIOutbound>
  Header
  <properties>
    BodyProperties
  </properties>
  Attachments (Optional) 
</SAPXIOutbound>

Response Message

The bootstrapped business process can return a synchronous response to the sender in the same call passing the Originator ID to the outbound adapter configuration.

To receive a synchronous response:
  1. Wait for synchronous response must be selected. See Creating or Setting Up an SAP XI Adapter Configuration in the Admin Console.
  2. XICallType must be set to SYNCHRONOUS_RESPONSE. See Setting Up the SAP XI Adapter in the GPM.

The Response message consists of the contents of the primary document, and optionally, attachments.

See Business Process Examples for more information.

Implementing the SAP XI Adapter

To implement the SAP XI adapter, complete the following tasks:
  1. Install the third-party files. See Installing the SAP XI Library Files.
  2. Create a configuration of the SAP XI adapter in Sterling B2B Integrator. See Managing Services and Adapters. For information about the fields specific to this adapter, see Configuring the SAP XI Adapter.
  3. Specify field settings for the adapter configuration in the Sterling B2B Integrator Admin Console and in the GPM as necessary.
  4. Implement the SAP RA adapter in SAP XI. See Installing and Configuring the GIS Resource Adapter within SAP XI.

Installing the SAP XI Library Files

The SAP XI adapter requires three third-party libraries. Obtain the necessary .jar files from your SAP XI installation and install them on your Sterling B2B Integrator system.

Perform the following steps:
  1. On your SAP XI system, change to one of the following directories:
    • /usr/sap/systemNumber/DVEBMGS00 /j2ee/j2eeclient/signed (recommended)
    • /usr/sap/systemNumber/DVEBMGS00/j2ee/j2eeclient
  2. Copy the following files to your Sterling B2B Integrator system:
    • sapj2eeclient.jar
    • exception.jar
    • logging.jar

      Note the location where you save the files.

  3. Stop Sterling B2B Integrator.
  4. Install the libraries by running commands similar to the following from the Sterling B2B Integrator installation directory:

    UNIX or Linux

    • cd install_dir/bin
    • ./install3rdParty.sh sapxi 30 -j path/sapj2eeclient.jar
    • ./install3rdParty.sh sapxi 30 -j path/exception.jar
    • ./install3rdParty.sh sapxi 30 -j path/logging.jar

    Windows

    • cd install_dir\bin
    • install3rdParty.cmd sapxi 30 -j path\sapj2eeclient.jar
    • install3rdParty.cmd sapxi 30 -j path\exception.jar
    • install3rdParty.cmd sapxi 30 -j path\logging.jar
  5. Start Sterling B2B Integrator.

Configuring the SAP XI Adapter

You must specify field settings in Sterling B2B Integrator, using the Admin Console, and in the GPM.

Creating or Setting Up an SAP XI Adapter Configuration in the Admin Console

Use the field definitions in the following table to create a new configuration of the SAP XI adapter, or to set up the configuration provided with Sterling B2B Integrator. Some fields are available in both the Admin Console and in the GPM. For the fields that are available in both, the GPM field name is shown in parentheses in the table below.

Field Description
Name Unique and meaningful name for the adapter configuration. Required.
Description Meaningful description for the adapter configuration, for reference purposes. Required.
Select a Group Select one of the following options:
  • None – Do not include the configuration in a service group at this time.
  • Create New Group – Enter a unique name for a new group, which will be created with this configuration. (You can then add other services to the group as well.)
  • Select Group – If service groups already exist for this service type, they are displayed in the list. Select a group from the list.
Note: See Managing Services and Adapters.
Service Type (ServiceType) Identifies the SAP XI adapter as an inbound (to SAP XI) or outbound (from SAP XI) adapter. Required. Valid values are:
  • SAP XI Inbound – (Default) Message flow from Sterling B2B Integrator to SAP XI.
  • SAP XI Outbound – Message flow from SAP XI to Sterling B2B Integrator.
Business Process Name (BootstrapBP) Select a business process to bootstrap when a message is received from SAP XI. Only displays if Service Type is set to SAP XI Outbound. Required. Valid values: List of business processes in Sterling B2B Integrator.
Wait for synchronous response (SyncWait) If checked, the incoming synchronous call is delayed until a response from the initiated business process is returned. Only displays if Service Type is set to SAP XI Outbound.
Synchronous response time out [s] (SyncWaitTimeout) Number of seconds to wait for a response from the initiated business process before issuing a Timeout Exception. Only displays if Service Type is set to SAP XI Outbound. Required. Valid value is any number. Default is 60.
SAP XI JNDI Host Name and Port (Host:Port) (JNDIRemoteAddress) Host and JNDI port of the remote SAP XI JNDI Server. Required. Syntax is Host:Port
SAP XI JNDI Key (JNDIRemoteKey) JNDI key used to look up the remote RMI server in SAP XI. Required. Use a unique ID for every adapter configuration. Default is com.sterlingcommerce.woodstock.services.sapxira.
SAP XI JNDI Context (RemoteJNDIContext) Initial JNDI context of the remote SAP XI JNDI server. Required. This is defined by the SAP JNDI implementation. Default is com.sap.engine.services.jndi.InitialContextFactoryImpl.
SAP XI JNDI User Name (RemoteUser) User of the remote SAP XI JNDI Server. The SAP XI user must have permissions for JNDI bind and unbind operations (for example, role SAP_J2EE_ADMIN). Required.
SAP XI JNDI Password (RemotePassword) Password of the remote SAP XI JNDI Server. Required.
Registry Type for Local Server (LocalRegistryType) The JNDI Registry to use for the SAP XI Adapter. Required. Select the following option:
  • Using External Registry – Use an external JNDI server. All JNDI connection parameters must be entered.
GIS JNDI Host Name and Port (Host:Port) (JNDILocalAddress) Host and JNDI port of the local JNDI Server. This is the external JNDI Server used by the SAP XI adapter. Required. Only displays if Registry Type for Local Server is set to Using External Registry. Syntax is Host:Port.
GIS JNDI Key (JNDILocalKey) JNDI key used to look up the local RMI Server used by the SAP XI adapter. Use a unique ID for every adapter configuration. Required. Default is com.sterlingcommerce.woodstock.services.sapxiga.
GIS JNDI Context (LocalJNDIContext) Initial JNDI Context of the local JNDI Server. This is the JNDI Server used by the SAP XI adapter. Required. Default is org.jnp.interface.NamingContextFactory. Change default to the following value: com.sap.engine.services.jndi.InitialContextFactoryImpl.
GIS JNDI User Name (LocalUser) User of the Local JNDI Server. Required. Only displays if Registry Type for Local Server is set to Using External Registry.
GIS JNDI Password (LocalPassword) Password of the Local JNDI Server. Required. Only displays if Registry Type for Local Server is set to Using External Registry.

Setting Up the SAP XI Adapter in the GPM

Use the field definitions in the following table to set up the adapter configuration in the GPM:

Field Description
XICallType Specifies the message handling mode. Required. Valid value:
  • SYNCHRONOUS – Use for an inbound adapter
  • SYNCHRONOUS_RESPONSE – Use to pass back a synchronous response with an outbound adapter
AttachmentRoot If set, the parameter refers to an XML structure in process data containing the attachment documents of the message. If omitted, the root "attachments" is used. Sending attachments in a message is optional. Optional. Valid value is a string that defines the Root Tag. Default is attachments.
ToParty ToParty field for the SAP XI Message envelope. May be required or optional depending on the SAP XI scenario.
FromParty FromParty field for the SAP XI Message Envelope. May be required or optional depending on the SAP XI scenario. String.
ToService ToService field for the SAP XI Message Envelope. Required. String.
FromService FromService field for the SAP XI Message Envelope. Required. String.
Action Action field for the SAP XI Message Envelope. Required. String.
ActionNS Action Name Space field for the XI Message Envelope. Required. String.
MessageID Unique Message ID on Sterling B2B Integrator side for the XI Message Envelope. Optional. If omitted, a GUID is generated automatically. Default is GUID.
MessageDescription Message Description field for the XI Message Envelope. Optional. String.
BodyName Body name of the SAP XI Message. Optional. String.
BodyDescription Body description of the SAP XI Message. Optional. String.
BodyVersion Body version of the SAP XI Message. Optional. String.
BodySchema XML only. Body name of the SAP XI message. String. Recommended.
BodyEncoding Character set used for the SAP XI message. String. Default is UTF-8. Recommended.
BodyContentType Body content type of the SAP XI message. String. Optional.
IsXMLContent Specifies whether the SAP XI message content is in XML format. Boolean string. Recommended.
OriginatorID Outbound only. Uniquely identifies the outbound session waiting for the synchronous response. The OriginatorID is generated automatically by the outbound adapter in the process data and must be passed back in the response call. Required.

Global Properties for the SAP XI Adapter

There are optional global properties that can be configured for the SAP XI adapter. For information, see sapxi.properties in the Sterling B2B Integrator online documentation.

Installing and Configuring the GIS Resource Adapter within SAP XI

The SAP XI Resource Adapter (GIS RA) is packaged in an SAP-specific installation called a Software Delivery Archive (SDA). This single SDA file (gis_xi_adapter_version.sda) contains all the files necessary to deploy the GIS RA in SAP NetWeaver.

Deploying the SDA in SAP NetWeaver

To deploy the SDA in SAP NetWeaver:
  1. Locate the following SDA file on the machine where Sterling B2B Integrator is installed:

    install_dir/packages/gis_xi_adapter_version.sda

  2. Copy the SDA file to the machine where the Adapter Framework (AF) of the SAP XI system is running.
  3. Deploy the SDA file in SAP NetWeaver using the appropriate tool.

Adding the RA to the System Landscape Directory

After the SDA is deployed, the GIS RA must be added to the System Landscape Directory (SLD). You must define the RA as a software unit in SAP NetWeaver.

To add the GIS RA to the SLD, perform the following steps:
  1. Open the SLD in SAP NetWeaver.
  2. Select Home > Products to display the Software Catalog.
  3. Select the Products tab.
  4. Under Software Type, select Products.
  5. Click New Product.
  6. On the Define Product screen, complete the following fields:
    • Vendor
    • Name
    • Version
  7. Click Create.
  8. Under Software Type, select Software Components.
  9. Click New Component.
  10. On the Define Software Component screen, complete the following fields:
    • Vendor
    • Name
    • Version
  11. Click Create.

Creating a Repository Namespace

After creating the product and software component, you must create a namespace in the integration repository using the SAP Integration Builder.

To create a repository namespace, perform the following steps:
  1. From the Design screen of the Integration Builder, select the Product Version that you created in the step above from the tree on the left side of the screen. If it does not appear, select Environment > Clear SLD Data Cache to refresh the SLD cache.
  2. Right-click the product version and click New Namespace to access the Namespace editor.
  3. In the Namespaces table, create a new namespace named http://stercomm.com/adapter/gis.

Creating an Adapter Object

After creating the repository namespace, you must create an adapter object that defines an adapter type for the GIS RA. An adapter object is comprised of adapter metadata that defines configuration data for the adapter type and one or more communication channels. The adapter metadata defines the portion of a communication channel that is unique to the adapter type. A communication channel defines the rules for handling messages during inbound or outbound processing.

Setting Up the Adapter Metadata

To set up the adapter metadata, perform the following steps:
  1. From the Objects tab in the Integration Builder, locate the namespace http://stercomm.com/adapter/gis inside your product version.
  2. Click the arrow adjacent to the namespace to display the subheadings.
  3. Click the arrow adjacent to Adapter Objects.
  4. Right-click Adapter Metadata and click New.
  5. In the Name box, type GIS.
  6. Click Create.
  7. From the Adapter Metadata editor, click Upload XML Description from File in the top speedbutton line.
  8. Provide the complete path to the GISAdapter.xml file provided with Sterling B2B Integrator.
  9. Select Adapter Metadata > Save to save and activate the adapter metadata.

Creating Communication Channel Templates

Communication channels define rules for handling messages during inbound or outbound processing. Depending on the direction of message processing, you require either a sender or a receiver channel. Therefore, you must create two communication channel templates, one for sending and one for receiving.

To create the templates, perform the following steps:
  1. From the Objects tab in the Integration Builder, locate the namespace http://stercomm.com/adapter/gis.
  2. Click the arrow adjacent to the namespace to display the subheadings.
  3. Click the arrow adjacent to Adapter Objects.
  4. Right-click Communication Channel Templates and click New.
  5. From the Parameters tab, specify the following settings:
    Field Description
    Name Specifies a name for the channel template.
    Note: The Namespace and Software Component Version fields will be pre-filled.
    Description Provides a brief description of the template.
    Adapter Type Specifies the adapter type. Select GIS.
    Sender/Receiver Defines the channel as either a sender or receiver channel. Select one of the following radio buttons:
    • Sender – Used for inbound (to SAP) message processing.
    • Receiver – Used for outbound (from SAP) message processing.
    Transport Protocol Specifies the transport protocol. Select JCA.
    Message Protocol Specifies the message protocol. Select JCA.
  6. Click the Select Attributes button.
  7. Add the following attributes by highlighting each field name in the Available Fields column and clicking Add to move it to the Show These fields in This Order column:
    • SAP XI JNDI Host Name and Port (Host:Port)
    • SAP XI JNDI Key
    • SAP XI JNDI Context
    • SAP XI JNDI User Name
    • SAP XI JNDI Password
    • GIS JNDI Host Name and Port (Host:Port)
    • GIS JNDI Key
    • GIS JNDI Context
    • GIS JNDI User Name
    • GIS JNDI Password
    • Quality of Service
    • Channel Address Mode
  8. After all fields have been moved to the Show These fields in This Order column, click Apply.
  9. Configure the channel attributes. Specify the following field settings:
    Field Description
    SAP XI JNDI Connection Parameters  
    SAP XI JNDI Host Name and Port (Host:Port) SAP XI JNDI Host Name and Port (Host:Port). Required. Valid values:
    • Host:Port
    • IP:Port
    SAP XI JNDI Key SAP XI JNDI Key. Required. Default is com.sterlingcommerce.woodstock.services.sapxira
    SAP XI JNDI Context SAP XI JNDI Context. Required. Default is com.sap.engine.services.jndi.InitialContextFactoryImpl
    SAP XI JNDI User Name SAP XI JNDI User Name. The SAP XI User must have permissions for JNDI bind and unbind operations (e.g. role SAP_J2EE_ADMIN). Required.
    SAP XI JNDI Password SAP XI JNDI Password. Required.
    GIS JNDI Connection Parameters  
    GIS JNDI Host Name and Port (Host:Port) Sterling B2B Integrator JNDI Host Name and Port (Host:Port). Required.
    GIS JNDI Key Sterling B2B Integrator JNDI Key. Required. Default is com.sterlingcommerce.woodstock.services.sapxiga
    GIS JNDI Context Sterling B2B Integrator JNDI Context. Required. Default is org.jnp.interfaces. NamingContextFactoryChange defaults to the following value: com.sap.engine.services.jndi.InitialContextFactoryImpl
    GIS JNDI User Name Sterling B2B Integrator JNDI User Name. Required.
    GIS JNDI Password Sterling B2B Integrator JNDI Password. Required.
    Message Parameters  
    Quality of Service Quality of Service. Required. Select Best Effort.
    Channel Address Mode Channel Address Mode. Required. Valid values:
    • CPA = Channel
    • MSG = Message
  10. Repeat the above steps to create the second communication channel. If you created a sender channel, create a receiver channel.

The GIS RA is now set up as a standard SAP XI resource adapter and can be used with the communication channel templates in SAP integration scenarios. See the SAP documentation for more information.

Business Process Examples

The following examples illustrate how the SAP XI adapter can be used in a business process for both inbound and outbound message processing:

Inbound Message Processing (Sterling B2B Integrator to SAP XI):

In this example, the input is the primary document containing the message. The sapxiinbound process sends a message to SAP XI. The message consists of the content from the primary document, the header from workflow parameters, and two attachments.

Process data contents before call

<ProcessData>
 <PrimaryDocument SCIObjectID="serverNode:169ca65:109f0bef19c:2f04"/>
 <att1>
    <message>This is my attachment 1 message</message>
  </att1>
 <doc1>
    <PrimaryDocument SCIObjectID="serverNode:169ca65:109f0bef19c:2f25"/>
 </doc1>
  <att2>
   <message>This is my attachment 2 message</message>
 </att2>
  <doc2>
   <PrimaryDocument SCIObjectID="serverNode:169ca65:109f0bef19c:2f47"/>
 </doc2>
  <attachments>
   <attachment_1>
      <document index="1">
       <PrimaryDocument SCIObjectID="serverNode:169ca65:109f0bef19c:2f25"/>
     </document>
      <properties>
       <BodyName>BodyName1</BodyName>
       <BodyDescription>BodyDescription1</BodyDescription>
       <BodyVersion>BodyVersion1</BodyVersion>
       <BodySchema>BodySchema1</BodySchema>
       <BodyEncoding>UTF-8</BodyEncoding>
       <BodyContentType>text/xml</BodyContentType>
       <IsXMLContent>true</IsXMLContent>
     </properties>
    </attachment_1>
   <attachment_2>
      <document index="2">
       <PrimaryDocument SCIObjectID="serverNode:169ca65:109f0bef19c:2f47"/>
     </document>
      <properties>
       <BodyName>BodyName2</BodyName>
       <BodyDescription>BodyDescription2</BodyDescription>
       <BodyVersion>BodyVersion2</BodyVersion>
       <BodySchema>BodySchema2</BodySchema>
       <BodyEncoding>UTF-8</BodyEncoding>
       <BodyContentType>text/xml</BodyContentType>
       <IsXMLContent>true</IsXMLContent>
     </properties>
    </attachment_2>
 </attachments> 
</ProcessData>

Message To Service

<SAPXIOut>
 <LocalPassword>********</LocalPassword>
 <RemotePassword>********</RemotePassword>
 
<JNDILocalAddress>serverNode:50004</JNDILocalAddress>
 <RemoteJNDIContext>com.sap.engine.services.jndi.InitialContextFactoryImpl
 </RemoteJNDIContext>
 <ServiceType>Inbound</ServiceType>
 <LocalJNDIContext>com.sap.engine.services.jndi.InitialContextFactoryImpl
 </LocalJNDIContext>
 <JNDIRemoteAddress>serverNode:50004</JNDIRemoteAddress>
 <LocalRegistryType>EXTERNAL_REG</LocalRegistryType>
 <RemoteUser>userName</RemoteUser>
 <LocalUser>userName</LocalUser>
 <JNDILocalKey>com.sterlingcommerce.woodstock.services.sapxiga</JNDILocalKey>
 <XMLVersion>1.0</XMLVersion>
  <JNDIRemoteKey>com.sterlingcommerce.woodstock.services.sapxira
  </JNDIRemoteKey>
 <XICallType>SYNCHRONOUS</XICallType>
 <AttachmentRoot>attachments</AttachmentRoot>
 <ToParty/>
  <FromParty/>
 <ToService>I03_OutboundToGIS</ToService>
 <FromService>I03_InboundFromGIS</FromService>
 <Action>CarstensMessageInterfaceSync</Action>
 <ActionNS>http://stercomm.com/adapter/gis</ActionNS>
 <MessageID>MSG_DV_001</MessageID>
 <MessageDescription>This is a test message description</MessageDescription>
 <BodyName>BodyName</BodyName>
  <BodyDescription>BodyDescription</BodyDescription>
 <BodyVersion>BodyVersion</BodyVersion>
 <BodySchema>BodySchema</BodySchema>
 <BodyEncoding>UTF-8</BodyEncoding>
 <BodyContentType>text/xml</BodyContentType>
 <IsXMLContent>true</IsXMLContent> 
</SAPXIOut>

BPML Business Process (Inbound)

<process name="callXI">
 <sequence name="sap">
    <!-- create two attachments -->
    <assign to="att1/message" from="'This is my attachment 1 message'">
    </assign>
   <operation name="XML Encoder">
     <participant name="XMLEncoder"/>
     <output message="XMLEncoderTypeInputMessage">
       <assign to="mode">process_data_to_document</assign>
       <assign to="root_element">att1</assign>
       <assign to="xPath" from="'att1/node()'"></assign>
       <assign to="att1" from="att1/node()"></assign>
     </output>
      <input message="inmsg">
       <assign to="doc1" from="*"></assign>
     </input>
    </operation>
   <assign to="att2/message" from="'This is my attachment 2 message'"></assign>
   <operation name="XML Encoder">
     <participant name="XMLEncoder"/>
     <output message="XMLEncoderTypeInputMessage">
       <assign to="mode">process_data_to_document</assign>
       <assign to="root_element">att2</assign>
       <assign to="xPath" from="'att2/node()'"></assign>
       <assign to="att2" from="att2/node()"></assign>
     </output>
      <input message="inmsg">
       <assign to="doc2" from="*"></assign>
     </input>
    </operation>
    <!-Create attachment structure with two attachments -->
    <assign to="attachments/attachment_1/document" from="doc1/node()"></assign>
   <assign to="attachments/attachment_1/document/@index" from="'1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyName"
         from="'BodyName1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyDescription" 
         from="'BodyDescription1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyVersion" 
         from="'BodyVersion1'"></assign>
    <assign to="attachments/attachment_1/properties/BodySchema" 
          from="'BodySchema1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyEncoding" 
         from="'UTF-8'"></assign>
    <assign to="attachments/attachment_1/properties/BodyContentType" 
          from="'text/xml'"></assign>
   <assign to="attachments/attachment_1/properties/IsXMLContent" 
         from="'true'"></assign>
    <assign to="attachments/attachment_2/document" from="doc2/node()"></assign>
   <assign to="attachments/attachment_2/document/@index" from="'2'"></assign>
   <assign to="attachments/attachment_2/properties/BodyName" from="'BodyName2'">
   </assign>
   <assign to="attachments/attachment_2/properties/BodyDescription" 
         from="'BodyDescription2'"></assign>
   <assign to="attachments/attachment_2/properties/BodyVersion" 
         from="'BodyVersion2'"></assign>
    <assign to="attachments/attachment_2/properties/BodySchema" 
          from="'BodySchema2'"></assign>
   <assign to="attachments/attachment_2/properties/BodyEncoding" 
         from="'UTF-8'"></assign>
    <assign to="attachments/attachment_2/properties/BodyContentType" 
          from="'text/xml'"></assign>
   <assign to="attachments/attachment_2/properties/IsXMLContent" 
         from="'true'"></assign>
   <!-- Now send message to SAP XI system -->
   <operation name="callsapxi">
      <participant name="SendToXI"/>
      <output message="SAPXIOut">
       <assign to="XICallType" from="'SYNCHRONOUS'"></assign>
       <assign to="AttachmentRoot" from="'attachments'"></assign>
       <assign to="ToParty" from="''"></assign>
       <assign to="FromParty" from="''"></assign>
       <assign to="ToService" from="'I03_OutboundToGIS'"></assign>
       <assign to="FromService" from="'I03_InboundFromGIS'"></assign>
       <assign to="Action" from="'CarstensMessageInterfaceSync'"></assign>
       <assign to="ActionNS" from="'http://stercomm.com/adapter/gis'"></assign>
       <assign to="MessageID" from="'MSG_DV_001'"></assign>
       <assign to="MessageDescription" 
             from="'This is a test message description'"></assign>
        <assign to="BodyName" from="'BodyName'"></assign>
       <assign to="BodyDescription" from="'BodyDescription'"></assign>
       <assign to="BodyVersion" from="'BodyVersion'"></assign>
       <assign to="BodySchema" from="'BodySchema'"></assign>
       <assign to="BodyEncoding" from="'UTF-8'"></assign>
       <assign to="BodyContentType" from="'text/xml'"></assign>
       <assign to="IsXMLContent" from="'true'"></assign>
       <assign to="." from="*"></assign>
     </output>
      <input message="SAPXIIn">
       <assign to="." from="*"></assign>
     </input>
    </operation>
 </sequence> 
</process>

Outbound Message Processing (SAP XI to Sterling B2B Integrator):

In this example, the input is an SAP XI message with two attachments and the output is a response message with one attachment. The sapxiout_response process receives a message from SAP XI. The message consists of the message content and two attachments. Within the business process, a response message is created and passed back synchronously to the SAP XI system in the same call.

Process data directly after the business process is bootstrapped:

<?xml version="1.0" encoding="UTF-8"?> 
<ProcessData>
 <PrimaryDocument SCIObjectID="serverNode:169ca65:109de7de0fd:-5612"/>
 <SAPXIOutbound>
    <Header>
     <ToService>I03_OutboundToGIS</ToService>
     <FromService>I03_InboundFromGIS</FromService>
     <FromParty/>
      <MessageID>c41268c0-af56-11da-b4bc-0003ba783746</MessageID>
     <ToParty/>
    </Header>
   <attachments>
      <attachment_1>
       <document index="1">
          <PrimaryDocument SCIObjectID=
           "serverNode:169ca65:109de7de0fd:-560c"/>
       </document>
        <properties index="1">
          <BodyVersion>undef</BodyVersion>
         <BodyEncoding>UTF-8</BodyEncoding>
         <BodyName>BodyName1</BodyName>
         <IsXMLContent>false</IsXMLContent>
         <BodyDescription>BodyDescription1</BodyDescription>
         <BodyContentType>text/xml</BodyContentType>
       </properties>
      </attachment_1>
     <attachment_2>
        <properties index="2">
          <BodyDescription>BodyDescription2</BodyDescription>
          <BodyContentType>text/xml</BodyContentType>
          <BodyEncoding>UTF-8</BodyEncoding>
          <BodyName>BodyName2</BodyName>
          <IsXMLContent>false</IsXMLContent>
          <BodyVersion>undef</BodyVersion>
        </properties>
        <document index="2">
          <PrimaryDocument SCIObjectID=
           "serverNode:169ca65:109de7de0fd:-560a"/>
       </document>
      </attachment_2>
   </attachments>
    <properties>
     <BodyVersion/>
      <BodyName>BodyName</BodyName>
     <BodyDescription>BodyDescription</BodyDescription>
     <IsXMLContent>true</IsXMLContent>
     <BodyContentType>text/xml</BodyContentType>
     <BodyEncoding>utf-8</BodyEncoding>
     <BodySchema/>
    </properties>
 </SAPXIOutbound>
  <OriginatorID>serverNode.169ca65.109de7de0fd.F5647</OriginatorID> 
</ProcessData>

Additional Process data before response call:

... following process data is added by the business process to prepare the 
    response… 
<ResponseAttach>
   <Result>This is my response attachment message</Result>
 </ResponseAttach>
  <doc1>
   <PrimaryDocument SCIObjectID="serverNode:169ca65:109de7de0fd:-26e9"/>
 </doc1>
  <attachments>
   <attachment_1>
      <document index="1">
       <PrimaryDocument SCIObjectID="serverNode:169ca65:109de7de0fd:-26e9"/>
     </document>
      <properties>
       <BodyName>BodyName1</BodyName>
       <BodyDescription>BodyDescription1</BodyDescription>
       <BodyVersion>BodyVersion1</BodyVersion>
       <BodySchema>BodySchema1</BodySchema>
       <BodyEncoding>UTF-8</BodyEncoding>
       <BodyContentType>text/xml</BodyContentType>
       <IsXMLContent>true</IsXMLContent>
     </properties>
    </attachment_1>
 </attachments>

Message To Service:

<SAPXIOut>
 <SyncWaitTimeout>60</SyncWaitTimeout>
 <BootstrapBP>sapxiout_response</BootstrapBP>
 <LocalPassword>********</LocalPassword>
 <RemotePassword>********</RemotePassword>
 <JNDILocalAddress>serverNode:50004</JNDILocalAddress>
 <RemoteJNDIContext>com.sap.engine.services.jndi.InitialContextFactoryImpl
 </RemoteJNDIContext>
 <ServiceType>Outbound</ServiceType>
 <LocalJNDIContext>com.sap.engine.services.jndi.InitialContextFactoryImpl
 </LocalJNDIContext>
 <JNDIRemoteAddress>serverNode:50004</JNDIRemoteAddress>
 <LocalRegistryType>EXTERNAL_REG</LocalRegistryType>
 <RemoteUser>userName</RemoteUser>
 <SyncWait>Yes</SyncWait>
  <LocalUser>userName</LocalUser>
 <JNDILocalKey>com.sterlingcommerce.woodstock.services.sapxigareturn
 </JNDILocalKey>
 <XMLVersion>1.0</XMLVersion>
  <JNDIRemoteKey>com.sterlingcommerce.woodstock.services.sapxirareturn
  </JNDIRemoteKey>
 <XICallType>SYNCHRONOUS_RESPONSE</XICallType>
 <OriginatorID>serverNode.169ca65.109de7de0fd.F5647</OriginatorID>
 <AttachmentRoot>attachments</AttachmentRoot>
 <FromParty/>
  <FromService>I03_OutboundToGIS</FromService>
 <ToParty/>
  <ToService>I03_InboundFromGIS</ToService>
 <Action>CarstensMessageInterfaceSync</Action>
 <ActionNS>http://stercomm.com/adapter/gis</ActionNS>
 <BodyName>BodyName</BodyName>
  <BodyDescription>BodyDescription</BodyDescription>
 <BodyVersion/>
  <BodySchema/>
 <BodyEncoding>utf-8</BodyEncoding>
 <BodyContentType>text/xml</BodyContentType>
 <IsXMLContent>true</IsXMLContent> 
</SAPXIOut>

BPML Business Process (Outbound):

<process name="sapxiout_response">
 <sequence name="sap">
    <assign to="ResponseAttach/Result" 
          from="'This is my response attachment message'" />
   <operation name="XML Encoder">
      <participant name="XMLEncoder" />
      <output message="XMLEncoderTypeInputMessage">
         <assign to="mode">process_data_to_document</assign>
         <assign to="root_element">ResponseAttach</assign>
         <assign to="xPath" from="'ResponseAttach/node()'"/>
         <assign to="ResponseAttach" from="ResponseAttach/node()"/>
      </output>
       <input message="inmsg">
         <assign to="doc1" from="*" />
      </input>
    </operation>
   <!-- Create Response Payload (overwrite Prim. Doc.) -->
   <assign to="ResponsePay/Result" from="'This is my response payload 
                                          message'" />
   <operation name="XML Encoder">
      <participant name="XMLEncoder" />
      <output message="XMLEncoderTypeInputMessage">
         <assign to="mode">process_data_to_document</assign>
         <assign to="root_element">ResponsePay</assign>
         <assign to="xPath" from="'ResponsePay/node()'"/>
         <assign to="ResponsePay" from="ResponsePay/node()"/>
      </output>
       <input message="inmsg">
         <assign to="." from="*" />
      </input>
    </operation>
   <!-- Create Response Attachment structure -->
   <assign to="attachments/attachment_1/document" from="doc1/node()">
   </assign>
   <assign to="attachments/attachment_1/document/@index" from="'1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyName"
         from="'BodyName1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyDescription" 
         from="'BodyDescription1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyVersion" 
         from="'BodyVersion1'"></assign>
    <assign to="attachments/attachment_1/properties/BodySchema" 
          from="'BodySchema1'"></assign>
   <assign to="attachments/attachment_1/properties/BodyEncoding" 
         from="'UTF-8'"></assign>
    <assign to="attachments/attachment_1/properties/BodyContentType" 
          from="'text/xml'"></assign>
   <assign to="attachments/attachment_1/properties/IsXMLContent"
           from="'true'">
   </assign>
    <!-Now send back response with outbound adapter -->
   <operation name="SAPXI_DeliveryResponse">
     <participant name="GetFromXI"/>
     <output message="SAPXIOut">
      	<assign to="XICallType" from="'SYNCHRONOUS_RESPONSE'"></assign>
     	<assign to="OriginatorID" from="OriginatorID/text()"></assign>
     	<assign to="AttachmentRoot" from="'attachments'"></assign>
     	<assign to="FromParty" from="SAPXIOutbound/Header/ToParty/text()"/>    
      	<assign to="FromService" from="SAPXIOutbound/Header/ToService/text()"/>
      	<assign to="ToParty" from="SAPXIOutbound/Header/FromParty/text()"/>
      	<assign to="ToService" from="SAPXIOutbound/Header/FromService/text()"/>
        <assign to="Action" from="'CarstensMessageInterfaceSync'"></assign>
       <assign to="ActionNS" from="'http://stercomm.com/adapter/gis'"></assign>
      	<assign to="BodyName" from="SAPXIOutbound/properties/BodyName/text()">
       </assign>
       <assign to="BodyDescription" 
             from="SAPXIOutbound/properties/BodyDescription/text()"></assign>
       <assign to="BodyVersion" 
             from="SAPXIOutbound/properties/BodyVersion/text()"></assign>
       <assign to="BodySchema" 
             from="SAPXIOutbound/properties/BodySchema/text()"></assign>
       <assign to="BodyEncoding" 
             from="SAPXIOutbound/properties/BodyEncoding/text()"></assign>
       <assign to="BodyContentType" 
             from="SAPXIOutbound/properties/BodyContentType/text()"></assign>
       <assign to="IsXMLContent" 
             from="SAPXIOutbound/properties/IsXMLContent/text()"></assign>
       <assign to="IsXMLContent" from="'true'"></assign>
       <assign to="AttachmentRoot" from="'attachments'"></assign>
     	<assign to="." from="*"></assign>
	 </output>
      <input message="SAPXIResponse">
       <assign to="." from="*"></assign>
     </input>
    </operation>
 </sequence> 
</process>

Parameters Passed From Business Process to Adapter

The following table contains the parameters passed from the business process to the SAP XI adapter:

Parameter Description
XICallType Specifies the message handling mode. Required. Valid values:
  • SYNCHRONOUS – Use for an inbound adapter
  • SYNCHRONOUS_RESPONSE – Use to pass back a synchronous response with an outbound adapter
AttachmentRoot If set, the parameter refers to an XML structure in the process data containing the attachment documents of the message. If omitted, the root "attachments" is used. Sending attachments in a message is optional. Optional. Valid value is a string that defines the Root Tag. Default is attachments.
ToParty ToParty field for the SAP XI Message envelope. May be required or optional depending on the SAP XI scenario.
FromParty FromParty field for SAP XI Message Envelope. May be required or optional depending on the SAP XI scenario. String.
ToService ToService field for SAP XI Message Envelope. Required. String.
FromService FromService field for SAP XI Message Envelope. Required. String.
Action Action field for SAP XI Message Envelope. Required. String.
ActionNS Action Name Space field for XI Message Envelope. Required. String.
MessageID Unique Message ID on Sterling B2B Integrator side for XI Message Envelope. Optional. If omitted, a GUID is generated automatically. Default is GUID.
MessageDescription Message Description field for XI Message Envelope. Optional. String.
BodyName Body name of the SAP XI Message. Optional. String.
BodyDescription Body description of the SAP XI Message. Optional. String.
BodyVersion Body version of the SAP XI Message. Optional. String.
BodySchema XML only. Body name of the SAP XI message. String. Recommended.
BodyEncoding Character set used for the SAP XI message. String. Default is UTF-8. Recommended.
BodyContentType Body content type of the SAP XI message. String. Optional.
IsXMLContent Specifies whether the SAP XI message content is in XML format. Boolean string. Recommended.
OriginatorID Outbound message processing only. Uniquely identifies the outbound session waiting for the synchronous response. OriginatorID is generated automatically by the outbound adapter in process data and must be passed back in the response call. Required.