Table of Contents
The SAP component is a package consisting of a suite of ten different SAP components. There are remote function call (RFC) components that support the sRFC, tRFC, and qRFC protocols; and there are IDoc components that facilitate communication using messages in IDoc format. The component uses the SAP Java Connector (SAP JCo) library to facilitate bidirectional communication with SAP and the SAP IDoc library to facilitate the transmission of documents in the Intermediate Document (IDoc) format.
Maven users need to add the following dependency to their pom.xml
file to use this component:
<dependency>
<groupId>org.fusesource</groupId>
<artifactId>camel-sap</artifactId>
<version>x.x.x</version>
<dependency>Because the SAP component depends on the third-party JCo 3.0 and IDoc 3.0 libraries, it can only be installed on the platforms that these libraries support. For more details about the platform restrictions, see Red Hat JBoss Fuse Supported Configurations.
A prerequisite for using the SAP component is that the SAP Java Connector (SAP
JCo) libraries and the SAP IDoc library are installed into the lib/
directory of the Java runtime. You must make sure that you download the appropriate
set of SAP libraries for your target operating system from the SAP Service
Marketplace.
The names of the library files vary depending on the target operating system, as shown in Table 149, “Required SAP Libraries”.
Table 149. Required SAP Libraries
| SAP Component | Linux and UNIX | Windows |
|---|---|---|
SAP JCo 3 |
|
|
SAP IDoc |
|
|
You can install the SAP JCo libraries and the SAP IDoc library into the JBoss Fuse OSGi container (non-Fabric) as follows:
Download the SAP JCo libraries and the SAP IDoc library from the SAP Service Marketplace (http://service.sap.com/public/connectors), making sure to choose the appropriate version of the libraries for your operating system.
![]() | Note |
|---|---|
You require version 3.0.11 or greater of the JCo library and version 3.0.10 or greater of the IDoc library. You must have an SAP Service Marketplace Account in order to download and use these libraries. |
sapjco3.jar, libsapjco3.so (or
sapjco3.dll on Windows), and sapidoc3.jar
library files into the lib/ directory of your JBoss Fuse
installation.Open both the configuration properties file,
etc/config.properties, and the custom properties file,
etc/custom.properties, in a text editor. In the
etc/config.properties file, look for the
org.osgi.framework.system.packages.extra property and copy
the complete property setting (this setting extends over multiple lines,
with a backslash character, \, used to indicate line
continuation). Now paste this setting into the
etc/custom.properties file.
You can now add the extra packages required to support the SAP libraries.
In the etc/custom.properties file, add the required packages to
the org.osgi.framework.system.packages.extra setting as
shown:
org.osgi.framework.system.packages.extra = \ ... , \ com.sap.conn.idoc, \ com.sap.conn.idoc.jco, \ com.sap.conn.jco, \ com.sap.conn.jco.ext, \ com.sap.conn.jco.monitor, \ com.sap.conn.jco.rt, \ com.sap.conn.jco.server
Don’t forget to include a comma and a backslash, , \, at
the end of each line preceding the new entries, so that the list is
properly continued.
You need to install the camel-sap feature in the container.
In the Karaf console, enter the following command:
JBossFuse:karaf@root> features:install camel-sap
A prerequisite for using the SAP component is that the SAP Java Connector (SAP
JCo) libraries and the SAP IDoc library must be installed into the lib/
directory of the Java runtime: that is, sapjco3.jar,
libsapjco3.so (or sapjco3.dll on Windows), and
sapidoc3.jar.
In the case of a Fuse Fabric deployment, this requires some special configuration.
There is no point in simply installing the SAP libraries in the Java
lib directory on a single machine, because Fabric containers need
to be deployable anywhere in the network. The correct approach is to define a
special profile that is capable of downloading and installing the SAP JCo libraries
and the SAP IDoc library on whichever host it is running on.
You can define a profile for the SAP JCo libraries and the SAP IDoc library as follows:
sapjco3.jar, libsapjco3.so (or
sapjco3.dll on Windows), and
sapidoc3.jar — to a network accessible location. For
example, you could install the libraries in a Web server, so that the JCo
libraries and the IDoc library can be downloaded through HTTP URLs,
http://mywebserver/sapjco3.jar,
http://mywebserver/libsapjco3.so, and
http://mywebserver/sapidoc3.jar.Create a new profile, camel-sap-profile, by entering the
following console command:
JBossFuse:karaf@root> profile-create camel-sap-profile
Edit the agent properties of the camel-sap-profile profile,
by entering the following console command:
JBossFuse:karaf@root> profile-edit camel-sap-profile
The built-in profile editor starts up. Use this built-in text editor to add the following contents to the agent properties:
# Profile:my-camel-sap-profile
attribute.parents = feature-camel
# Deploy JCo3 Libs to Container
lib.sapjco3.jar = http://mywebserver/sapjco3.jar
lib.sapjco3.so = http://mywebserver/libsapjco3.so
lib.sapidoc3.jar = http://mywebserver/sapidoc3.jar
# Append JCo3 Packages and IDoc packages to OSGi system property
# in order to expose JCo3 and IDoc classes to OSGi environment
config.org.osgi.framework.system.packages.extra= \
... pass:quotes[_Packages from etc/config.properties file_] ...\
com.sap.conn.jco, \
com.sap.conn.jco.ext, \
com.sap.conn.jco.monitor, \
com.sap.conn.jco.rt, \
com.sap.conn.jco.server, \
com.sap.conn.idoc, \
com.sap.conn.idoc.jcoCustomize the property settings as follows:
lib.sapjco3.jarsapjco3.jar file on your Web server.lib.sapjco3.solibsapjco3.so file (or
sapjco3.dll) on your Web server.lib.sapidoc3.jarsapidoc3.jar file on your Web server.config.org.osgi.framework.system.packages.extraOpen the container configuration properties file,
etc/config.properties, of your JBoss Fuse
installation and look for the
org.osgi.framework.system.packages.extra
property setting. Copy the list of packages from that setting
and paste them into the profile’s agent properties, replacing
the line:
... Packages from etc/config.properties file ...\![]() | Note |
|---|---|
The |
![]() | Note |
|---|---|
The backslash, |
Type Ctrl-S to save the properties when you are finished.
You can now deploy the camel-sap-profile profile to any
Fabric container where you want to run the SAP component. For example, to
deploy the camel-sap-profileprofile to the
sap-instance container:
JBossFuse:karaf@root> container-add-profile sap-instance came-sap-profile
To deploy the SAP component in a JBoss EAP container, perform the following steps:
Download the SAP JCo libraries and the SAP IDoc library from the SAP Service Marketplace (http://service.sap.com/public/connectors), making sure to choose the appropriate version of the libraries for your operating system.
![]() | Note |
|---|---|
You require version 3.0.11 or greater of the JCo library and version 3.0.10 or greater of the IDoc library. You must have an SAP Service Marketplace Account in order to download and use these libraries. |
Copy the JCo library files and the IDoc library file into the appropriate
subdirectory of your JBoss EAP installation. For example, if your host
platform is 64-bit Linux (linux-x86_64), install the library
files as follows:
cp sapjco3.jar sapidoc3.jar $JBOSS_HOME/modules/system/layers/fuse/com/sap/conn/jco/main/ mkdir -p $JBOSS_HOME/modules/system/layers/fuse/com/sap/conn/jco/main/lib/linux-x86_64 cp libsapjco3.so $JBOSS_HOME/modules/system/layers/fuse/com/sap/conn/jco/main/lib/linux-x86_64/
![]() | Important |
|---|---|
For installing native libraries (such as |
Uncomment the org.switchyard.component.camel.sap module in
the SwitchYard subsystem configuration. For example, to enable the SAP
component in JBoss EAP standalone mode, edit the
$JBOSS_HOME/standalone/configuration/standalone.xml file
and look for the following line to uncomment:
<!-- Uncomment this module to enable camel-sap binding <module identifier="org.switchyard.component.camel.sap" implClass="org.switchyard.component.camel.sap.deploy.CamelSapComponent"/> -->
There are two different kinds of endpoint provided by the SAP component: the Remote Function Call (RFC) endpoints, and the Intermediate Document (IDoc) endpoints.
The URI formats for the RFC endpoints are as follows:
sap-srfc-destination:destinationName:rfcName sap-trfc-destination:destinationName:rfcName sap-qrfc-destination:destinationName:queueName:rfcName sap-srfc-server:serverName:rfcName[?options] sap-trfc-server:serverName:rfcName[?options]
The URI formats for the IDoc endpoints are as follows:
sap-idoc-destination:destinationName:idocType[:idocTypeExtension[:systemRelease[:applicationRelease]]] sap-idoclist-destination:destinationName:idocType[:idocTypeExtension[:systemRelease[:applicationRelease]]] sap-qidoc-destination:destinationName:queueName:idocType[:idocTypeExtension[:systemRelease[:applicationRelease]]] sap-qidoclist-destination:destinationName:queueName:idocType[:idocTypeExtension[:systemRelease[:applicationRelease]]] sap-idoclist-server:serverName:idocType[:idocTypeExtension[:systemRelease[:applicationRelease]]][?options]
The URI formats prefixed by sap-endpointKind-destination are used to define destination endpoints (in other words, Camel producer endpoints) and destinationName is the name of a specific outbound connection to an SAP instance. Outbound connections are named and configured at the component level, as described in Destination Configuration.
The URI formats prefixed by sap-endpointKind-server are used to define server endpoints (in other words, Camel consumer endpoints) and serverName is the name of a specific inbound connection from an SAP instance. Inbound connections are named and configured at the component level, as described in the Server Configuration.
The other components of an RFC endpoint URI are as follows:
The other components of an IDoc endpoint URI are as follows:
The RFC destination endpoints (sap-srfc-destination,
sap-trfc-destination, and sap-qrfc-destination)
support the following URI options:
| Name | Default | Description |
|---|---|---|
|
| If |
|
| If |
The SAP RFC server endpoints (sap-srfc-server and
sap-trfc-server) support the following URI options:
| Name | Default | Description |
|---|---|---|
|
| If |
|
| (sap-trfc-server endpoint only) If
|
The SAP IDoc List Server endpoint (sap-idoclist-server) supports the
following URI options:
| Name | Default | Description |
|---|---|---|
|
| If |
|
| If |
The SAP component package provides the following RFC and IDoc endpoints:
sap-srfc-destinationJBoss Fuse SAP Synchronous Remote Function Call Destination Camel component. This endpoint should be used in cases where Camel routes require synchronous delivery of requests to and responses from an SAP system.
![]() | Note |
|---|---|
The sRFC protocol used by this component delivers requests and responses to and from an SAP system with best effort. In case of a communication error while sending a request, the completion status of a remote function call in the receiving SAP system remains in doubt. |
sap-trfc-destinationJBoss Fuse SAP Transactional Remote Function Call Destination Camel
component. This endpoint should be used in cases where requests must be
delivered to the receiving SAP system at most once.
To accomplish this, the component generates a transaction ID,
tid, which accompanies every request sent through the
component in a route’s exchange. The receiving SAP system records the
tid accompanying a request before delivering the
request; if the SAP system receives the request again with the same
tid it will not deliver the request. Thus if a route
encounters a communication error when sending a request through an
endpoint of this component, it can retry sending the request within the
same exchange knowing it will be delivered and executed only
once.
![]() | Note |
|---|---|
The tRFC protocol used by this component is asynchronous and does not return a response. Thus the endpoints of this component do not return a response message. |
![]() | Note |
|---|---|
This component does not guarantee the order of a series of requests through its endpoints, and the delivery and execution order of these requests may differ on the receiving SAP system due to communication errors and resends of a request. For guaranteed delivery order, please see the JBoss Fuse SAP Queued Remote Function Call Destination Camel component. |
sap-qrfc-destinationJBoss Fuse SAP Queued Remote Function Call Destination Camel component. This component extends the capabilities of the JBoss Fuse Transactional Remote Function Call Destination camel component by adding in order delivery guarantees to the delivery of requests through its endpoints. This endpoint should be used in cases where a series of requests depend on each other and must be delivered to the receiving SAP system at most once and in order. The component accomplishes the at most once delivery guarantees using the same mechanisms as the JBoss Fuse SAP Transactional Remote Function Call Destination Camel component. The ordering guarantee is accomplished by serializing the requests in the order they are received by the SAP system to an inbound queue. Inbound queues are processed by the QIN scheduler within SAP. When the inbound queue is activated, the QIN Scheduler will execute the queue requests in order.
![]() | Note |
|---|---|
The qRFC protocol used by this component is asynchronous and does not return a response. Thus the endpoints of this component do not return a response message. |
sap-srfc-serversap-trfc-servertid, which accompanies every
request it sends to the component’s endpoints. The sending SAP system
will first check with the component whether a given tid has
been received by it before sending a series of requests associated with
the tid. The component will check the list of received
tids it maintains, record the sent tid if
it is not in that list, and then respond to the sending SAP system,
indicating whether or not the tid had already been
recorded. The sending SAP system will only then send the series of
requests, if the tid has not been previously recorded. This
enables a sending SAP system to reliably send a series of requests once
to a camel route.sap-idoc-destinationsap-idoclist-destinationsap-qidoc-destinationsap-qidoclist-destinationsap-idoclist-serversap-trfc-server-standalone quick start.An RFC destination endpoint supports outbound communication to SAP, which enable these endpoints to make RFC calls out to ABAP function modules in SAP. An RFC destination endpoint is configured to make an RFC call to a specific ABAP function over a specific connection to an SAP instance. An RFC destination is a logical designation for an outbound connection and has a unique name. An RFC destination is specified by a set of connection parameters called destination data.
An RFC destination endpoint will extract an RFC request from the input message of the IN-OUT exchanges it receives and dispatch that request in a function call to SAP. The response from the function call will be returned in the output message of the exchange. Since SAP RFC destination endpoints only support outbound communication, an RFC destination endpoint only supports the creation of producers.
An RFC server endpoint supports inbound communication from SAP, which enables ABAP applications in SAP to make RFC calls into server endpoints. An ABAP application interacts with an RFC server endpoint as if it were a remote function module. An RFC server endpoint is configured to receive an RFC call to a specific RFC function over a specific connection from an SAP instance. An RFC server is a logical designation for an inbound connection and has a unique name. An RFC server is specified by a set of connection parameters called server data.
An RFC server endpoint will handle an incoming RFC request and dispatch it as the input message of an IN-OUT exchange. The output message of the exchange will be returned as the response of the RFC call. Since SAP RFC server endpoints only support inbound communication, an RFC server endpoint only supports the creation of consumers.
An IDoc destination endpoint supports outbound communication to SAP, which can then perform further processing on the IDoc message. An IDoc document represents a business transaction, which can easily be exchanged with non-SAP systems. An IDoc destination is specified by a set of connection parameters called destination data.
An IDoc list destination endpoint is similar to an IDoc destination endpoint, except that the messages it handles consist of a list of IDoc documents.
An IDoc list server endpoint supports inbound communication from SAP, enabling a Camel route to receive a list of IDoc documents from an SAP system. An IDoc list server is specified by a set of connection parameters called server data.
A meta-data repository is used to store the following kinds of meta-data:
SAP destination and server endpoints thus require access to a repository, in order to send and receive RFC calls and in order to send and receive IDoc documents. For RFC calls, the meta-data for all function modules invoked and handled by the endpoints must reside within the repository; and for IDoc endpoints, the meta-data for all IDoc types and IDoc type extensions handled by the endpoints must reside within the repository. The location of the repository used by a destination and server endpoint is specified in the destination data and the server data of their respective connections.
In the case of an SAP destination endpoint, the repository it uses typically resides in an SAP system and it defaults to the SAP system it is connected to. This default requires no explicit configuration in the destination data. Furthermore, the meta-data for the remote function call that a destination endpoint makes will already exist in a repository for any existing function module that it calls. The meta-data for calls made by destination endpoints thus require no configuration in the SAP component.
On the other hand, the meta-data for function calls handled by server endpoints do not typically reside in the repository of an SAP system and must instead be provided by a repository residing in the SAP component. The SAP component maintains a map of named meta-data repositories. The name of a repository corresponds to the name of the server to which it provides meta-data.
Table of Contents
The SAP component maintains three maps to store destination data, server data
and repository data. The destination data store and the
server data store are configured on a special
configuration object, SapConnectionConfiguration, which
automatically gets injected into the SAP component (in the context of Blueprint
XML configuration or Spring XML configuration files). The repository
data store must be configured directly on the relevant SAP
component.
The SAP component maintains three maps to store destination data, server data
and repository data. The component’s property,
destinationDataStore, stores destination data keyed by
destination name, the property, serverDataStore, stores server data
keyed by server name and the property, repositoryDataStore, stores
repository data keyed by repository name. These configurations must be passed to
the component during its initialization.
The following example shows how to configure a sample destination data store
and a sample server data store in a Blueprint XML file. The
sap-configuration bean (of type
SapConnectionConfiguration) will automatically be injected into
any SAP component that is used in this XML file.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint ... >
...
<!-- Configures the Inbound and Outbound SAP Connections -->
<bean id="sap-configuration"
class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
<property name="destinationDataStore">
<map>
<entry key="quickstartDest" value-ref="quickstartDestinationData" />
</map>
</property>
<property name="serverDataStore">
<map>
<entry key="quickstartServer" value-ref="quickstartServerData" />
</map>
</property>
</bean>
<!-- Configures an Outbound SAP Connection -->
<!-- *** Please enter the connection property values for your environment *** -->
<bean id="quickstartDestinationData"
class="org.fusesource.camel.component.sap.model.rfc.impl.DestinationDataImpl">
<property name="ashost" value="example.com" />
<property name="sysnr" value="00" />
<property name="client" value="000" />
<property name="user" value="username" />
<property name="passwd" value="passowrd" />
<property name="lang" value="en" />
</bean>
<!-- Configures an Inbound SAP Connection -->
<!-- *** Please enter the connection property values for your environment ** -->
<bean id="quickstartServerData"
class="org.fusesource.camel.component.sap.model.rfc.impl.ServerDataImpl">
<property name="gwhost" value="example.com" />
<property name="gwserv" value="3300" />
<!-- The following property values should not be changed -->
<property name="progid" value="QUICKSTART" />
<property name="repositoryDestination" value="quickstartDest" />
<property name="connectionCount" value="2" />
</bean>
</blueprint>The configurations for destinations are maintained in the
destinationDataStore property of the SAP component. Each entry
in this map configures a distinct outbound connection to an SAP instance. The
key for each entry is the name of the outbound connection and is used in the
destinationName component of a
destination endpoint URI as described in the URI format section.
The value for each entry is a destination data configuration object -
org.fusesource.camel.component.sap.model.rfc.impl.DestinationDataImpl
- that specifies the configuration of an outbound SAP connection.
The following Blueprint XML code shows how to configure a sample destination
with the name, quickstartDest.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint ... >
...
<!-- Create interceptor to support tRFC processing -->
<bean id="currentProcessorDefinitionInterceptor"
class="org.fusesource.camel.component.sap.CurrentProcessorDefinitionInterceptStrategy" />
<!-- Configures the Inbound and Outbound SAP Connections -->
<bean id="sap-configuration"
class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
<property name="destinationDataStore">
<map>
<entry key="quickstartDest" value-ref="quickstartDestinationData" />
</map>
</property>
</bean>
<!-- Configures an Outbound SAP Connection -->
<!-- *** Please enter the connection property values for your environment *** -->
<bean id="quickstartDestinationData"
class="org.fusesource.camel.component.sap.model.rfc.impl.DestinationDataImpl">
<property name="ashost" value="example.com" />
<property name="sysnr" value="00" />
<property name="client" value="000" />
<property name="user" value="username" />
<property name="passwd" value="password" />
<property name="lang" value="en" />
</bean>
</blueprint>For example, after configuring the destination as shown in the preceding
Blueprint XML file, you could invoke the BAPI_FLCUST_GETLIST remote
function call on the quickstartDest destination using the following
URI:
sap-srfc-destination:quickstartDest:BAPI_FLCUST_GETLIST
The preceding sample destination configuration shows the instantiation of a
CurrentProcessorDefinitionInterceptStrategy object. This object
installs an interceptor in the Camel runtime, which enables the Camel SAP
component to keep track of its position within a Camel route while it is
handling RFC transactions. For more details, see Transactional RFC destination endpoints.
![]() | Important |
|---|---|
This interceptor is critically important for transactional RFC destination
endpoints (such as |
The following table lists the logon and authentication options for configuring a destination in the SAP destination data store:
Name | Default Value | Description |
| SAP client, mandatory logon parameter | |
| Logon user, logon parameter for password based authentication | |
| Logon user alias, can be used instead of logon user | |
| User identity which is used for logon to the ABAP AS. Used by the JCo runtime, if the destination configuration uses SSO/assertion ticket, certificate, current user ,or SNC environment for authentication. The user ID is mandatory, if neither user nor user alias is set. This ID will never be sent to the SAP backend, it will be used by the JCo runtime locally. | |
| Logon password, logon parameter for password-based authentication | |
| Logon language, if not defined, the default user language is used | |
| Use the specified SAP Cookie Version 2 as logon ticket for SSO based authentication | |
| Use the specified X509 certificate for certificate based authentication | |
| Postpone the authentication until the first call - 1 (enable). Used in special cases only . | |
| Use a visible, hidden, or do not use SAP GUI | |
| Additional logon parameter to define the codepage that will used to convert the logon parameters. Used in special cases only | |
| Order a SSO ticket after logon, the obtained ticket is available in the destination attributes | |
| If set to |
The following table lists the connection options for configuring a destination in the SAP destination data store:
Name | Default Value | Description |
| SAP Router string for connection to systems
behind a SAP Router. SAP Router string contains the chain of SAP Routers
and its port numbers and has the form:
| |
| System number of the SAP ABAP application server, mandatory for a direct connection | |
| SAP ABAP application server, mandatory for a direct connection | |
| SAP message server, mandatory property for a load balancing connection | |
| SAP message server port, optional property for
a load balancing connection. In order to resolve the service names
sapmsXXX a lookup in | |
| Allows specifying a concrete gateway, which should be used for establishing the connection to an application server. If not specified the gateway on the application server is used | |
| Should be set, when using gwhost. Allows specifying the port used on that gateway. If not specified the port of the gateway on the application server is used. In order to resolve the service names sapgwXXX a lookup in etc/services is performed by the network layer of the operating system. If using port numbers instead of symbolic service names, no lookups are performed and no additional entries are needed. | |
| System ID of the SAP system, mandatory property for a load balancing connection. | |
| Group of SAP application servers, mandatory property for a load balancing connection |
The following table lists the connection pool options for configuring a destination in the SAP destination data store:
Name | Default Value | Description |
|
| Maximum number of active outbound connections
that can be created for a destination simultaneously. A value of
|
|
| Maximum number of idle outbound connections
kept open by the destination. A value of |
| Time in milliseconds after which a free connection held internally by the destination can be closed | |
| Period in milliseconds after which the destination checks the released connections for expiration. | |
| Maximum time in milliseconds to wait for a connection, if the maximum allowed number of connections has already been allocated by the application. |
The following table lists the secure network options for configuring a destination in the SAP destination data store:
Name | Default Value | Description |
| Secure network connection (SNC) mode,
| |
| SNC partner, for example: | |
| SNC level of security: | |
| Own SNC name. Overrides environment settings | |
| Path to library that provides SNC service |
The following table lists the repository options for configuring a destination in the SAP destination data store:
Name | Default Value | Description |
| Specifies which destination should be used as repository. | |
| If a repository destination is not set, and this property is set, it will be used as user for repository calls. This enables you to use a different user for repository look-ups. | |
| The password for a repository user. Mandatory, if a repository user should be used. | |
| (Optional) If SNC is used for this destination, it
is possible to turn it off for repository connections, if this property
is set to | |
| Enable the
If the property is not set, the destination initially does a
remote call to check whether Note: If the repository is already initialized (for example because it is used by some other destination) this property does not have any effect. Generally, this property is related to the ABAP System, and should have the same value on all destinations pointing to the same ABAP System. See note 1456826 for backend prerequisites. |
The configurations for servers are maintained in the
serverDataStore property of the SAP component. Each entry in
this map configures a distinct inbound connection from an SAP instance. The key
for each entry is the name of the outbound connection and is used in the
serverName component of a server endpoint URI as described in
the URI format section.
The value for each entry is a server data configuration object,
org.fusesource.camel.component.sap.model.rfc.impl.ServerDataImpl,
that defines the configuration of an inbound SAP connection.
The following Blueprint XML code shows how to create a sample server
configuration with the name, quickstartServer.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint ... >
...
<!-- Configures the Inbound and Outbound SAP Connections -->
<bean id="sap-configuration"
class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
<property name="destinationDataStore">
<map>
<entry key="quickstartDest" value-ref="quickstartDestinationData" />
</map>
</property>
<property name="serverDataStore">
<map>
<entry key="quickstartServer" value-ref="quickstartServerData" />
</map>
</property>
</bean>
<!-- Configures an Outbound SAP Connection -->
<!-- *** Please enter the connection property values for your environment *** -->
<bean id="quickstartDestinationData"
class="org.fusesource.camel.component.sap.model.rfc.impl.DestinationDataImpl">
<property name="ashost" value="example.com" />
<property name="sysnr" value="00" />
<property name="client" value="000" />
<property name="user" value="username" />
<property name="passwd" value="passowrd" />
<property name="lang" value="en" />
</bean>
<!-- Configures an Inbound SAP Connection -->
<!-- *** Please enter the connection property values for your environment ** -->
<bean id="quickstartServerData"
class="org.fusesource.camel.component.sap.model.rfc.impl.ServerDataImpl">
<property name="gwhost" value="example.com" />
<property name="gwserv" value="3300" />
<!-- The following property values should not be changed -->
<property name="progid" value="QUICKSTART" />
<property name="repositoryDestination" value="quickstartDest" />
<property name="connectionCount" value="2" />
</bean>
</blueprint>Notice how this example also configures a destination connection,
quickstartDest, which the server uses to retrieve meta-data
from a remote SAP instance. This destination is configured in the server data
through the repositoryDestination option. If you do not configure
this option, you would need to create a local meta-data repository instead (see
Repository Configuration).
For example, after configuring the destination as shown in the preceding
Blueprint XML file, you could handle the BAPI_FLCUST_GETLIST remote
function call from an invoking client, using the following URI:
sap-srfc-server:quickstartServer:BAPI_FLCUST_GETLIST
The required options for the server data configuration object are, as follows:
Name | Default Value | Description |
| Gateway host on which the server connection should be registered. | |
| Gateway service, which is the port on which a
registration can be done. In order to resolve the service names
| |
| The program ID with which the registration is done. Serves as identifier on the gateway and in the destination in the ABAP system. | |
| Specifies a destination name that the server can use in order to retrieve meta-data from a meta-data repository hosted in a remote SAP server. | |
| The number of connections that should be registered at the gateway. |
The secure network connection options for the server data configuration object are, as follows:
Name | Default Value | Description |
| Secure network connection (SNC) mode,
| |
| SNC level of security, | |
| SNC name of your server. Overrides the default
SNC name. Typically something like | |
| Path to library which provides SNC service. If
this property is not provided, the value of the
|
The other options for the server data configuration object are, as follows:
Name | Default Value | Description |
| SAP router string to use for a system protected
by a firewall, which can therefore only be reached through a SAProuter,
when registering the server at the gateway of that ABAP System. A
typical router string is | |
| The maximum time (in seconds) between two start-up attempts in case of failures. The waiting time is doubled from initially 1 second after each start-up failure until either the maximum value is reached or the server could be started successfully. | |
| Enable/disable RFC trace ( | |
| The maximum number of threads used by the
server connection. If not set, the value for the
| |
| The minimum number of threads used by server
connection. If not set, the value for |
The configurations for repositories are maintained in the
repositoryDataStore property of the SAP Component. Each entry
in this map configures a distinct repository. The key for each entry is the name
of the repository and this key also corresponds to the name of server to which
this repository is attached.
The value of each entry is a repository data configuration object,
org.fusesource.camel.component.sap.model.rfc.impl.RepositoryDataImpl,
that defines the contents of a meta-data repository. A repository data object is
a map of function template configuration objects,
org.fuesource.camel.component.sap.model.rfc.impl.FunctionTemplateImpl.
Each entry in this map specifies the interface of a function module and the key
for each entry is the name of the function module specified.
The following code shows a simple example of configuring a meta-data repository:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint ... >
...
<!-- Configures the sap-srfc-server component -->
<bean id="sap-configuration"
class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
<property name="repositoryDataStore">
<map>
<entry key="nplServer" value-ref="nplRepositoryData" />
</map>
</property>
</bean>
<!-- Configures a Meta-Data Repository -->
<bean id="nplRepositoryData"
class="org.fusesource.camel.component.sap.model.rfc.impl.RepositoryDataImpl">
<property name="functionTemplates">
<map>
<entry key="BOOK_FLIGHT" value-ref="bookFlightFunctionTemplate" />
</map>
</property>
</bean>
...
</blueprint>The interface of a function module consists of four parameter lists by which data is transferred back and forth to the function module in an RFC call. Each parameter list consists of one or more fields, each of which is a named parameter transferred in an RFC call. The following parameter lists and exception list are supported:
A function template describes the name and type of parameters in each parameter list of a function interface and the ABAP exceptions thrown by the function. A function template object maintains five property lists of meta-data objects, as described in the following table.
Property | Description |
| A list of list field meta-data objects,
|
| A list of list field meta-data objects,
|
| A list of list field meta-data objects,
|
| A list of list field meta-data objects,
|
| A list of ABAP exception meta-data objects,
|
The following example shows an outline of how to configure a function template:
<bean id="bookFlightFunctionTemplate"
class="org.fusesource.camel.component.sap.model.rfc.impl.FunctionTemplateImpl">
<property name="importParameterList">
<list>
...
</list>
</property>
<property name="changingParameterList">
<list>
...
</list>
</property>
<property name="exportParameterList">
<list>
...
</list>
</property>
<property name="tableParameterList">
<list>
...
</list>
</property>
<property name="exceptionList">
<list>
...
</list>
</property>
</bean>A list field meta-data object,
org.fusesource.camel.component.sap.model.rfc.impl.ListFieldMeataDataImpl,
specifies the name and type of a field in a parameter list. For an elementary
parameter field (CHAR, DATE, BCD,
TIME, BYTE, NUM, FLOAT,
INT, INT1, INT2, DECF16,
DECF34, STRING, XSTRING), the
following table lists the configuration properties that may be set on a list
field meta-data object:
Name | Default Value | Description |
| - | The name of the parameter field. |
| - | The parameter type of the field. |
| - | The field length in bytes for a non-Unicode layout. This value depends on the parameter type. See Message Body for RFC. |
| - | The field length in bytes for a Unicode layout. This value depends on the parameter type. See Message Body for RFC. |
|
| The number of decimals in field value; only required for parameter types BCD and FLOAT. See Message Body for RFC. |
|
| If |
Note that all elementary parameter fields require that the name,
type, byteLength and
unicodeByteLength properties be specified in the field
meta-data object. In addition, the BCD, FLOAT,
DECF16 and DECF34 fields require the decimal
property to be specified in the field meta-data object.
For a complex parameter field of type TABLE or
STRUCTURE, the following table lists the configuration
properties that may be set on a list field meta-data object:
Name | Default Value | Description |
| - | The name of the parameter field |
| - | The parameter type of the field |
| - | The meta-data for the structure or table. A
record meta-data object,
|
|
| If |
Note that all complex parameter fields require that the name,
type and recordMetaData properties be specified in
the field meta-data object. The value of the recordMetaData
property is a record field meta-data object,
org.fusesource.camel.component.sap.model.rfc.impl.RecordMetaDataImpl,
which specifies the structure of a nested structure or the structure of a table
row.
The following meta-data configuration specifies an optional, 24-digit packed
BCD number parameter with two decimal places named
TICKET_PRICE:
<bean class="org.fusesource.camel.component.sap.model.rfc.impl.ListFieldMetaDataImpl">
<property name="name" value="TICKET_PRICE" />
<property name="type" value="BCD" />
<property name="byteLength" value="12" />
<property name="unicodeByteLength" value="24" />
<property name="decimals" value="2" />
<property name="optional" value="true" />
</bean>The following meta-data configuration specifies a required TABLE
parameter named CONNINFO with a row structure specified by the
connectionInfo record meta-data object:
<bean class="org.fusesource.camel.component.sap.model.rfc.impl.ListFieldMetaDataImpl">
<property name="name" value="CONNINFO" />
<property name="type" value="TABLE" />
<property name="recordMetaData" ref="connectionInfo" />
</bean>A record meta-data object,
org.fusesource.camel.component.sap.model.rfc.impl.RecordMetaDataImpl,
specifies the name and contents of a nested STRUCTURE or the row of
a TABLE parameter. A record meta-data object maintains a list of
record field meta data objects,
org.fusesource.camel.component.sap.model.rfc.impl.FieldMetaDataImpl,
which specify the parameters that reside in the nested structure or table
row.
The following table lists configuration properties that may be set on a record meta-data object:
Name | Default Value | Description |
| - | The name of the record. |
| - | The list of record field meta-data objects,
|
![]() | Note |
|---|---|
All properties of the record meta-data object are required. |
The following example shows how to configure a record meta-data object:
<bean id="connectionInfo"
class="org.fusesource.camel.component.sap.model.rfc.impl.RecordMetaDataImpl">
<property name="name" value="CONNECTION_INFO" />
<property name="recordFieldMetaData">
<list>
...
</list>
</property>
</bean>A record field meta-data object,
org.fusesource.camel.component.sap.model.rfc.impl.FieldMetaDataImpl,
specifies the name and type of a parameter field withing a structure.
A record field meta-data object is similar to a parameter field meta-data object, except that the offsets of the individual field locations within the nested structure or table row must be additionally specified. The non-Unicode and Unicode offsets of an individual field must be calculated and specified from the sum of non-Unicode and Unicode byte lengths of the preceding fields in the structure or row. Note that failure to properly specify the offsets of fields in nested structures and table rows will cause the field storage of parameters in the underlying JCo and ABAP runtimes to overlap and prevent the proper transfer of values in RFC calls.
For an elementary parameter field (CHAR, DATE,
BCD, TIME, BYTE, NUM,
FLOAT, INT, INT1, INT2,
DECF16, DECF34, STRING,
XSTRING), the following table lists the configuration
properties that may be set on a record field meta-data object:
Name | Default Value | Description |
| - | The name of the parameter field |
| - | The parameter type of the field |
| - | The field length in bytes for a non-Unicode layout. This value depends on the parameter type. See Message Body for RFC. |
| - | The field length in bytes for a Unicode layout. This value depends on the parameter type. See Message Body for RFC. |
| - | The field offset in bytes for non-Unicode layout. This offset is the byte location of the field within the enclosing structure. |
| - | The field offset in bytes for Unicode layout. This offset is the byte location of the field within the enclosing structure. |
|
| The number of decimals in field value; only
required for parameter types |
For a complex parameter field of type TABLE or
STRUCTURE, the following table lists the configuration
properties that may be set on a record field meta-data object:
Name | Default Value | Description |
| - | The name of the parameter field |
| - | The parameter type of the field |
| - | The field offset in bytes for non-Unicode layout. This offset is the byte location of the field within the enclosing structure. |
| - | The field offset in bytes for Unicode layout. This offset is the byte location of the field within the enclosing structure. |
| - | The meta-data for the structure or table. A
record meta-data object,
|
The following meta-data configuration specifies a DATE field
parameter named ARRDATE located 85 bytes into the enclosing
structure in the case of a non-Unicode layout and located 170 bytes into the
enclosing structure in the case of a Unicode layout:
<bean class="org.fusesource.camel.component.sap.model.rfc.impl.FieldMetaDataImpl">
<property name="name" value="ARRDATE" />
<property name="type" value="DATE" />
<property name="byteLength" value="8" />
<property name="unicodeByteLength" value="16" />
<property name="byteOffset" value="85" />
<property name="unicodeByteOffset" value="170" />
</bean>The following meta-data configuration specifies a STRUCTURE field
parameter named FLTINFO with a structure specified by the
flightInfo record meta-data object. The parameter is located at
the beginning of the enclosing structure in both the case of a non-Unicode and
Unicode layout.
<bean class="org.fusesource.camel.component.sap.model.rfc.impl.FieldMetaDataImpl">
<property name="name" value="FLTINFO" />
<property name="type" value="STRUCTURE" />
<property name="byteOffset" value="0" />
<property name="unicodeByteOffset" value="0" />
<property name="recordMetaData" ref="flightInfo" />
</bean>The SAP component supports the following message headers:
Header | Description |
| The URI scheme of the last endpoint to process the message. Use one of the following values:
|
| The destination name of the last destination endpoint to process the message. |
| The server name of the last server endpoint to process the message. |
| The queue name of the last queuing endpoint to process the message. |
| The RFC name of the last RFC endpoint to process the message. |
| The IDoc type of the last IDoc endpoint to process the message. |
| The IDoc type extension, if any, of the last IDoc endpoint to process the message. |
| The system release, if any, of the last IDoc endpoint to process the message. |
| The application release, if any, of the last IDoc endpoint to process the message. |
An SAP endpoint expects to receive a message with a message body containing an SAP request object and will return a message with a message body containing an SAP response object. SAP requests and responses are fixed map data structures containing named fields with each field having a predefined data type.
Note that the named fields in an SAP request and response are specific to an SAP endpoint, with each endpoint defining the parameters in the SAP request and response it will accept. An SAP endpoint provides factory methods to create the request and response objects that are specific to it.
public class SAPEndpoint ... {
...
public Structure getRequest() throws Exception;
public Structure getResponse() throws Exception;
...
}Both SAP request and response objects are represented in Java as a structure
object which supports the
org.fusesource.camel.component.sap.model.rfc.Structure interface.
This interface extends both the java.util.Map and
org.eclipse.emf.ecore.EObject interfaces.
public interface Structure extends org.eclipse.emf.ecore.EObject,
java.util.Map<String, Object> {
<T> T get(Object key, Class<T> type);
}The field values in a structure object are accessed through the field’s getter methods in the map interface. In addition, the structure interface provides a type-restricted method to retrieve field values.
Structure objects are implemented in the component runtime using the Eclipse
Modeling Framework (EMF) and support that framework’s EObject
interface. Instances of a structure object have attached meta-data which define and
restrict the structure and contents of the map of fields it provides. This meta-data
can be accessed and introspected using the standard methods provided by EMF. Please
refer to the EMF documentation for further details.
![]() | Note |
|---|---|
Attempts to get a parameter not defined on a structure object will return null. Attempts to set a parameter not defined on a structure will throw an exception as well as attempts to set the value of a parameter with an incorrect type. |
As discussed in the following sections, structure objects can contain fields that
contain values of the complex field types, STRUCTURE and
TABLE. Note that it is unnecessary to create instances of these
types and add them to the structure. Instances of these field values are created on
demand if necessary when accessed in the enclosing structure.
The fields that reside within the structure object of an SAP request or response may be either elementary or complex. An elementary field contains a single scalar value, whereas a complex field will contain one or more fields of either a elementary or complex type.
An elementary field may be either a character, numeric, hexadecimal or string field type. The following table summarizes the types of elementary fields that may reside in a structure object:
Field Type | Corresponding Java Type | Byte Length | Unicode Byte Length | Number Decimals Digits | Description |
|
| 1 to 65535 | 1 to 65535 | - | ABAP Type ‘C’: Fixed sized character string |
|
| 8 | 16 | - | ABAP Type ‘D’: Date (format: YYYYMMDD) |
|
| 1 to 16 | 1 to 16 | 0 to 14 | ABAP Type ‘P’: Packed BCD number. A BCD number contains two digits per byte. |
|
| 6 | 12 | - | ABAP Type ‘T’: Time (format: HHMMSS) |
|
| 1 to 65535 | 1 to 65535 | - | ABAP Type ‘X’:Fixed sized byte array |
|
| 1 to 65535 | 1 to 65535 | - | ABAP Type ‘N’: Fixed sized numeric character string |
|
| 8 | 8 | 0 to 15 | ABAP Type ‘F’: Floating point number |
|
| 4 | 4 | - | ABAP Type ‘I’: 4-byte Integer |
|
| 2 | 2 | - | ABAP Type ‘S’: 2-byte Integer |
|
| 1 | 1 | - | ABAP Type ‘B’: 1-byte Integer |
|
| 8 | 8 | 16 | ABAP Type ‘decfloat16’: 8 -byte Decimal Floating Point Number |
|
| 16 | 16 | 34 | ABAP Type ‘decfloat34’: 16-byte Decimal Floating Point Number |
|
| 8 | 8 | - | ABAP Type ‘G’: Variable length character string |
|
| 8 | 8 | - | ABAP Type ‘Y’: Variable length byte array |
A character field contains a fixed sized character string that may use either a
non-Unicode or Unicode character encoding in the underlying JCo and ABAP runtimes.
Non-Unicode character strings encode one character per byte. Unicode characters
strings are encoded in two bytes using UTF-16 encoding. Character field values are
represented in Java as java.lang.String objects and the underlying JCo
runtime is responsible for the conversion to their ABAP representation.
A character field declares its field length in its associated
byteLength and unicodeByteLength properties, which
determine the length of the field’s character string in each encoding system.
CHARCHAR character field is a text field containing
alphanumeric characters and corresponds to the ABAP type C.NUMNUM character field is a numeric text field containing
numeric characters only and corresponds to the ABAP type N.DATEDATE character field is an 8 character date field with
the year, month and day formatted as YYYYMMDD and
corresponds to the ABAP type D.TIMETIME character field is a 6 character time field with
the hours, minutes and seconds formatted as HHMMSS and
corresponds to the ABAP type T.A numeric field contains a number. The following numeric field types are supported:
INTINT numeric field is an integer field stored as a
4-byte integer value in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type I. An INT field value is
represented in Java as a java.lang.Integer object.INT2INT2 numeric field is an integer field stored as a
2-byte integer value in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type S. An INT2 field value is
represented in Java as a java.lang.Integer object.INT1INT1 field is an integer field stored as a 1-byte
integer value in the underlying JCo and ABAP runtimes value and
corresponds to the ABAP type B. An INT1 field value is
represented in Java as a java.lang.Integer object.FLOATFLOAT field is a binary floating point number field
stored as an 8-byte double value in the underlying JCo and ABAP runtimes
and corresponds to the ABAP type F. A FLOAT field declares
the number of decimal digits that the field’s value contains in its
associated decimal property. In the case of a FLOAT field,
this decimal property can have a value between 1 and 15 digits. A
FLOAT field value is represented in Java as a
java.lang.Double object.BCDBCD field is a binary coded decimal field stored as a 1
to 16 byte packed number in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type P. A packed number stores two decimal
digits per byte. A BCD field declares its field length in
its associated byteLength and
unicodeByteLength properties. In the case of a
BCD field, these properties can have a value between 1
and 16 bytes and both properties will have the same value. A
BCD field declares the number of decimal digits that
the field’s value contains in its associated decimal property. In the
case of a BCD field, this decimal property can have a value
between 1 and 14 digits. A BCD field value is represented
in Java as a java.math.BigDecimal.DECF16DECF16 field is a decimal floating point stored as an
8-byte IEEE 754 decimal64 floating point value in the underlying JCo and
ABAP runtimes and corresponds to the ABAP type decfloat16.
The value of a DECF16 field has 16 decimal digits. The
value of a DECF16 field is represented in Java as
java.math.BigDecimal.DECF34DECF34 field is a decimal floating point stored as a
16-byte IEEE 754 decimal128 floating point value in the underlying JCo
and ABAP runtimes and corresponds to the ABAP type
decfloat34. The value of a DECF34 field
has 34 decimal digits. The value of a DECF34 field is
represented in Java as java.math.BigDecimal.A hexadecimal field contains raw binary data. The following hexadecimal field types are supported:
BYTEBYTE field is a fixed sized byte string stored as a
byte array in the underlying JCo and ABAP runtimes and corresponds to
the ABAP type X. A BYTE field declares its field length in
its associated byteLength and
unicodeByteLength properties. In the case of a
BYTE field, these properties can have a value between 1
and 65535 bytes and both properties will have the same value. The value
of a BYTE field is represented in Java as a
byte[] object.A string field references a variable length string value. The length of that string value is not fixed until runtime. The storage for the string value is dynamically created in the underlying JCo and ABAP runtimes. The storage for the string field itself is fixed and contains only a string header.
STRINGSTRING field refers to a character string and is stored
in the underlying JCo and ABAP runtimes as an 8-byte value. It
corresponds to the ABAP type G. The value of the STRING
field is represented in Java as a java.lang.String
object.XSTRINGXSTRING field refers to a byte string and is stored in
the underlying JCo and ABAP runtimes as an 8-byte value. It corresponds
to the ABAP type Y. The value of the STRING field is
represented in Java as a byte[] object.A complex field may be either a structure or table field type. The following table summarizes these complex field types.
Field Type | Corresponding Java Type | Byte Length | Unicode Byte Length | Number Decimals Digits | Description |
|
| Total of individual field byte lengths | Total of individual field Unicode byte lengths | - | ABAP Type ‘u’ & ‘v’: Heterogeneous Structure |
|
| Byte length of row structure | Unicode byte length of row structure | - | ABAP Type ‘h’: Table |
A STRUCTURE field contains a structure object and is stored in the
underlying JCo and ABAP runtimes as an ABAP structure record. It corresponds to
either an ABAP type u or v. The value of a
STRUCTURE field is represented in Java as a structure object with
the interface
org.fusesource.camel.component.sap.model.rfc.Structure.
A TABLE field contains a table object and is stored in the underlying
JCo and ABAP runtimes as an ABAP internal table. It corresponds to the ABAP type
h. The value of the field is represented in Java by a table object
with the interface
org.fusesource.camel.component.sap.model.rfc.Table.
A table object is a homogeneous list data structure containing rows of structure
objects with the same structure. This interface extends both the
java.util.List and org.eclipse.emf.ecore.EObject
interfaces.
public interface Table<S extends Structure>
extends org.eclipse.emf.ecore.EObject,
java.util.List<S> {
/**
* Creates and adds table row at end of row list
*/
S add();
/**
* Creates and adds table row at index in row list
*/
S add(int index);
}The list of rows in a table object are accessed and managed using the standard methods defined in the list interface. In addition the table interface provides two factory methods for creating and adding structure objects to the row list.
Table objects are implemented in the component runtime using the Eclipse Modeling Framework (EMF) and support that framework’s EObject interface. Instances of a table object have attached meta-data which define and restrict the structure and contents of the rows it provides. This meta-data can be accessed and introspected using the standard methods provided by EMF. Please refer to the EMF documentation for further details.
![]() | Note |
|---|---|
Attempts to add or set a row structure value of the wrong type will throw an exception. |
When using one of the IDoc Camel SAP endpoints, the type of the message body depends on which particular endpoint you are using.
For a sap-idoc-destination endpoint or a
sap-qidoc-destination endpoint, the message body is of
Document type:
org.fusesource.camel.component.sap.model.idoc.Document
For a sap-idoclist-destination endpoint, a
sap-qidoclist-destination endpoint, or a
sap-idoclist-server endpoint, the message body is of
DocumentList type:
org.fusesource.camel.component.sap.model.idoc.DocumentList
For the Camel SAP component, an IDoc document is modelled using the Eclipse Modelling Framework (EMF), which provides a wrapper API around the underlying SAP IDoc API. The most important types in this model are:
org.fusesource.camel.component.sap.model.idoc.Document org.fusesource.camel.component.sap.model.idoc.Segment
The Document type represents an IDoc document instance. In outline,
the Document interface exposes the following methods:
// Java
package org.fusesource.camel.component.sap.model.idoc;
...
public interface Document extends EObject {
// Access the field values from the IDoc control record
String getArchiveKey();
void setArchiveKey(String value);
String getClient();
void setClient(String value);
...
// Access the IDoc document contents
Segment getRootSegment();
}The following kinds of method are exposed by the Document
interface:
The getRootSegment method provides access to the document
contents (IDoc data records), returning the contents as a
Segment object. Each Segment object can
contain an arbitrary number of child segments, and the segments can be
nested to an arbitrary degree.
Note, however, that the precise layout of the segment hierarchy is defined by the particular IDoc type of the document. When creating (or reading) a segment hierarchy, therefore, you must be sure to follow the exact structure as defined by the IDoc type.
The Segment type is used to access the data records of the IDoc
document, where the segments are laid out in accordance with the structure defined
by the document’s IDoc type. In outline, the Segment interface exposes
the following methods:
// Java
package org.fusesource.camel.component.sap.model.idoc;
...
public interface Segment extends EObject, java.util.Map<String, Object> {
// Returns the value of the '<em><b>Parent</b></em>' reference.
Segment getParent();
// Return a immutable list of all child segments
<S extends Segment> EList<S> getChildren();
// Returns a list of child segments of the specified segment type.
<S extends Segment> SegmentList<S> getChildren(String segmentType);
EList<String> getTypes();
Document getDocument();
String getDescription();
String getType();
String getDefinition();
int getHierarchyLevel();
String getIdocType();
String getIdocTypeExtension();
String getSystemRelease();
String getApplicationRelease();
int getNumFields();
long getMaxOccurrence();
long getMinOccurrence();
boolean isMandatory();
boolean isQualified();
int getRecordLength();
<T> T get(Object key, Class<T> type);
}The getChildren(String segmentType) method is particularly useful for
adding new (nested) children to a segment. It returns an object of type,
SegmentList, which is defined as follows:
// Java
package org.fusesource.camel.component.sap.model.idoc;
...
public interface SegmentList<S extends Segment> extends EObject, EList<S> {
S add();
S add(int index);
}Hence, to create a data record of E1SCU_CRE type, you could use Java
code like the following:
Segment rootSegment = document.getRootSegment();
Segment E1SCU_CRE_Segment = rootSegment.getChildren("E1SCU_CRE").add();According to the SAP documentation, an IDoc document consists of the following main parts:
Document
object — see Table 150, “IDoc Document Attributes” for
details.Segment objects,
which are constructed as a nested hierarchy of segments. You can access
the root segment through the Document.getRootSegment
method.status attribute on the control record.For example, Example 27, “Creating an IDoc Document in Java” shows how to create an
IDoc document with the IDoc type, FLCUSTOMER_CREATEFROMDATA01, using
the IDoc model API in Java.
Example 27. Creating an IDoc Document in Java
// Java
import org.fusesource.camel.component.sap.model.idoc.Document;
import org.fusesource.camel.component.sap.model.idoc.Segment;
import org.fusesource.camel.component.sap.util.IDocUtil;
import org.fusesource.camel.component.sap.model.idoc.Document;
import org.fusesource.camel.component.sap.model.idoc.DocumentList;
import org.fusesource.camel.component.sap.model.idoc.IdocFactory;
import org.fusesource.camel.component.sap.model.idoc.IdocPackage;
import org.fusesource.camel.component.sap.model.idoc.Segment;
import org.fusesource.camel.component.sap.model.idoc.SegmentChildren;
...
//
// Create a new IDoc instance using the modelling classes
//
// Get the SAP Endpoint bean from the Camel context.
// In this example, it's a 'sap-idoc-destination' endpoint.
SapTransactionalIDocDestinationEndpoint endpoint =
exchange.getContext().getEndpoint(
"bean:SapEndpointBeanID",
SapTransactionalIDocDestinationEndpoint.class
);
// The endpoint automatically populates some required control record attributes
Document document = endpoint.createDocument()
// Initialize additional control record attributes
document.setMessageType("FLCUSTOMER_CREATEFROMDATA");
document.setRecipientPartnerNumber("QUICKCLNT");
document.setRecipientPartnerType("LS");
document.setSenderPartnerNumber("QUICKSTART");
document.setSenderPartnerType("LS");
Segment rootSegment = document.getRootSegment();
Segment E1SCU_CRE_Segment = rootSegment.getChildren("E1SCU_CRE").add();
Segment E1BPSCUNEW_Segment = E1SCU_CRE_Segment.getChildren("E1BPSCUNEW").add();
E1BPSCUNEW_Segment.put("CUSTNAME", "Fred Flintstone");
E1BPSCUNEW_Segment.put("FORM", "Mr.");
E1BPSCUNEW_Segment.put("STREET", "123 Rubble Lane");
E1BPSCUNEW_Segment.put("POSTCODE", "01234");
E1BPSCUNEW_Segment.put("CITY", "Bedrock");
E1BPSCUNEW_Segment.put("COUNTR", "US");
E1BPSCUNEW_Segment.put("PHONE", "800-555-1212");
E1BPSCUNEW_Segment.put("EMAIL", "fred@bedrock.com");
E1BPSCUNEW_Segment.put("CUSTTYPE", "P");
E1BPSCUNEW_Segment.put("DISCOUNT", "005");
E1BPSCUNEW_Segment.put("LANGU", "E");Table 150, “IDoc Document Attributes” shows the control record attributes
that you can set on the Document object.
Table 150. IDoc Document Attributes
| Attribute | Length | SAP Field | Description |
|---|---|---|---|
| 70 |
| EDI archive key |
| 3 |
| Client |
| 8 |
| Date IDoc was created |
| 6 |
| Time IDoc was created |
| 1 |
| Direction |
| 14 |
| Reference to message |
| 14 |
| Reference to message group |
| 6 |
| EDI message type |
| 1 |
| EDI standard |
| 6 |
| Version of EDI standard |
| 14 |
| Reference to interchange file |
| 8 |
| IDoc type |
| 16 |
| IDoc number |
| 4 |
| SAP Release of IDoc |
| 30 |
| Name of basic IDoc type |
| 30 |
| Name of extension type |
| 3 |
| Logical message code |
| 3 |
| Logical message function |
| 30 |
| Logical message type |
| 1 |
| Output mode |
| 10 |
| Receiver address (SADR) |
| 70 |
| Logical address of receiver |
| 2 |
| Partner function of receiver |
| 10 |
| Partner number of receiver |
| 2 |
| Partner type of receiver |
| 10 |
| Receiver port (SAP System, EDI subsystem) |
|
| Sender address (SADR) | |
| 70 |
| Logical address of sender |
| 2 |
| Partner function of sender |
| 10 |
| Partner number of sender |
| 2 |
| Partner type of sender |
| 10 |
| Sender port (SAP System, EDI subsystem) |
| 20 |
| EDI/ALE: Serialization field |
| 2 |
| Status of IDoc |
| 1 |
| Test flag |
When setting the control record attributes in Java (from Table 150, “IDoc Document Attributes”), the usual convention for Java bean
properties is followed. That is, a name attribute can be accessed
through the getName and setName methods, for getting and
setting the attribute value. For example, the iDocType,
iDocTypeExtension, and messageType attributes can be
set as follows on a Document object:
// Java
document.setIDocType("FLCUSTOMER_CREATEFROMDATA01");
document.setIDocTypeExtension("");
document.setMessageType("FLCUSTOMER_CREATEFROMDATA");When setting the control record attributes in XML, the attributes must be set on
the idoc:Document element. For example, the iDocType,
iDocTypeExtension, and messageType attributes can be
set as follows:
<?xml version="1.0" encoding="ASCII"?>
<idoc:Document ...
iDocType="FLCUSTOMER_CREATEFROMDATA01"
iDocTypeExtension=""
messageType="FLCUSTOMER_CREATEFROMDATA" ... >
...
</idoc:Document>The SAP component adds the following exchange properties:
Property | Description |
| A map containing the properties of each SAP destination encountered by the exchange.
The map is keyed by destination name and each entry is a |
| A map containing the properties of each SAP server encountered by the exchange.
The map is keyed by server name and each entry is a |
The SAP Component supports the BAPI transaction model for outbound communication
with SAP. A destination endpoint with a URL containing the transacted option set to
true will, if necessary, initiate a stateful session on the
outbound connection of the endpoint and register a Camel Synchronization object with
the exchange. This synchronization object will call the BAPI service method
BAPI_TRANSACTION_COMMIT and end the stateful session when the
processing of the message exchange is complete. If the processing of the message
exchange fails, the synchronization object will call the BAPI server method
BAPI_TRANSACTION_ROLLBACK and end the stateful session.
The tRFC protocol accomplishes an AT-MOST-ONCE delivery and processing guarantee by identifying each transactional request with a unique transaction identifier (TID). A TID accompanies each request sent in the protocol. A sending application using the tRFC protocol must identify each instance of a request with a unique TID when sending the request. An application may send a request with a given TID multiple times, but the protocol ensures that the request is delivered and processed in the receiving system at most once. An application may choose to resend a request with a given TID when encountering a communication or system error when sending the request, and is thus in doubt as to whether that request was delivered and processed in the receiving system. By resending a request when encountering an communication error, a client application using the tRFC protocol can thus ensure EXACTLY-ONCE delivery and processing guarantees for its request.
A BAPI transaction is an application level transaction, in the sense that it imposes ACID guarantees on the persistent data changes performed by a BAPI method or RFC function in the SAP database. An RFC transaction is a communication transaction, in the sense that it imposes delivery guarantees (AT-MOST-ONCE, EXACTLY-ONCE, EXACTLY-ONCE-IN-ORDER) on requests to a BAPI method and/or RFC function.
The following destination endpoints support RFC transactions:
sap-trfc-destinationsap-qrfc-destinationA single Camel route can include multiple transactional RFC destination endpoints,
sending messages to multiple RFC destinations and even sending messages to the same
RFC destination multiple times. This implies that the Camel SAP component
potentially needs to keep track of many transaction IDs (TIDs)
for each Exchange object passing along a route. Now if the route
processing fails and must be retried, the situation gets quite complicated. The RFC
transaction semantics demand that each RFC destination along the route must be
invoked using the same TID that was used the first time around
(and where the TIDs for each of the destinations are distinct from each other). In
other words, the Camel SAP component must keep track of which TID was used at which
point along the route, and remember this information, so that the TIDs can be
replayed in the correct order.
By default, Camel does not provide a mechanism that enables an
Exchange to know where it is in a route. To provide such a
mechanism, it is necessary to install the
CurrentProcessorDefinitionInterceptStrategy interceptor into the
Camel runtime. This interceptor must be installed into the Camel runtime, in order
for the Camel SAP component to keep track of the TIDs in a route. For details of how
to configure the interceptor, see Interceptor for tRFC and qRFC destinations.
The following server endpoints support RFC transactions:
sap-trfc-serverWhen a Camel exchange processing a transactional request encounters a processing error, Camel handles the processing error through its standard error handling mechanisms. If the Camel route processing the exchange is configured to propagate the error back to the caller, the SAP server endpoint that initiated the exchange takes note of the failure and the sending SAP system is notified of the error. The sending SAP system can then respond by sending another transaction request with the same TID to process the request again.
SAP request and response objects support an XML serialization format which enable these objects to be serialized to and from an XML document.
Each RFC in a repository defines a specific XML name space for the elements which compose the serialized forms of its Request and Response objects. The form of this namespace URL is as follows:
http://sap.fusesource.org/rfc/<Repository Name>/<RFC Name>
RFC namespace URLs have a common http://sap.fusesource.org/rfc prefix
followed by the name of the repository in which the RFC’s metadata is defined. The
final component in the URL is the name of the RFC itself.
An SAP request object will be serialized into an XML document with the root element of that document named Request and scoped by the namespace of the request’s RFC.
<?xml version="1.0" encoding="ASCII"?>
<BOOK_FLIGHT:Request
xmlns:BOOK_FLIGHT="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT">
...
</BOOK_FLIGHT:Request>An SAP response object will be serialized into an XML document with the root element of that document named Response and scoped by the namespace of the response’s RFC.
<?xml version="1.0" encoding="ASCII"?>
<BOOK_FLIGHT:Response
xmlns:BOOK_FLIGHT="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT">
...
</BOOK_FLIGHT:Response>Structure fields in parameter lists or nested structures are serialized as elements. The element name of the serialized structure corresponds to the field name of the structure within the enclosing parameter list, structure or table row entry it resides.
<BOOK_FLIGHT:FLTINFO
xmlns:BOOK_FLIGHT="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT">
...
</BOOK_FLIGHT:FLTINFO>Note that the type name of the structure element in the RFC namespace will correspond to the name of the record meta data object which defines the structure, as in the following example:
<xs:schema
targetNamespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT">
xmlns:xs="http://www.w3.org/2001/XMLSchema">
...
<xs:complexType name="FLTINFO_STRUCTURE”>
...
</xs:complexType>
...
</xs:schema>This distinction will be important when specifying a JAXB bean to marshal and unmarshal the structure as will be seen in Example 3: Handling Requests from SAP.
Table fields in parameter lists or nested structures are serialized as elements. The element name of the serialized structure will correspond to the field name of the table within the enclosing parameter list, structure, or table row entry it resides. The table element will contain a series of row elements to hold the serialized values of the table’s row entries.
<BOOK_FLIGHT:CONNINFO
xmlns:BOOK_FLIGHT="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT">
<row ... > ... </row>
...
<row ... > ... </row>
</BOOK_FLIGHT:CONNINFO>Note that the type name of the table element in the RFC namespace will correspond
to the name of the record meta data object which defines the row structure of the
table suffixed by _TABLE. The type name of the table row element in the
RFC name corresponds to the name of the record meta data object which defines the
row structure of the table, as in the following example:
<xs:schema
targetNamespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
...
<xs:complextType name="CONNECTION_INFO_STRUCTURE_TABLE”>
<xs:sequence>
<xs:element
name="row”
minOccures="0”
maxOccurs="unbounded”
type="CONNECTION_INFO_STRUCTURE”/>
...
<xs:sequence>
</xs:sequence>
</xs:complexType>
<xs:complextType name="CONNECTION_INFO_STRUCTURE”>
...
</xs:complexType>
...
</xs:schema>This distinction will be important when specifying a JAXB bean to marshal and unmarshal the structure as will be seen in Example 3: Handling Requests from SAP.
Elementary fields in parameter lists or nested structures are serialized as attributes on the element of the enclosing parameter list or structure. The attribute name of the serialized field corresponds to the field name of the field within the enclosing parameter list, structure, or table row entry it resides, as in the following example:
<?xml version="1.0" encoding="ASCII"?>
<BOOK_FLIGHT:Request
xmlns:BOOK_FLIGHT="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT"
CUSTNAME="James Legrand"
PASSFORM="Mr"
PASSNAME="Travelin Joe"
PASSBIRTH="1990-03-17T00:00:00.000-0500"
FLIGHTDATE="2014-03-19T00:00:00.000-0400"
TRAVELAGENCYNUMBER="00000110"
DESTINATION_FROM="SFO"
DESTINATION_TO="FRA"/>Date and Time fields are serialized into attribute values using the following format:
yyyy-MM-dd'T'HH:mm:ss.SSSZ
Date fields will be serialized with only the year, month, day and timezone components set:
DEPDATE="2014-03-19T00:00:00.000-0400"
Time fields will be serialized with only the hour, minute, second, millisecond and timezone components set:
DEPTIME="1970-01-01T16:00:00.000-0500"
An IDoc message body can be serialized into an XML string format, with the help of a built-in type converter.
Each serialized IDoc is associated with an XML namespace, which has the following general format:
http://sap.fusesource.org/idoc/repositoryName/idocType/idocTypeExtension/systemRelease/applicationRelease
Both the repositoryName (name of the remote SAP meta-data repository) and the idocType (IDoc document type) are mandatory, but the other components of the namespace can be left blank. For example, you could have an XML namespace like the following:
http://sap.fusesource.org/idoc/MY_REPO/FLCUSTOMER_CREATEFROMDATA01///
The Camel SAP component has a built-in type converter, which is capable of
converting a Document object or a DocumentList object to
and from a String type.
For example, to serialize a Document object to an XML string, you can
simply add the following line to a route in XML DSL:
<convertBodyTo type="java.lang.String"/>
You can also use this approach to a serialized XML message into a
Document object. For example, given that the current message body
is a serialized XML string, you can convert it back into a Document
object by adding the following line to a route in XML DSL:
<convertBodyTo type="org.fusesource.camel.component.sap.model.idoc.Document"/>
When you convert an IDoc message to a String, it is serialized into
an XML document, where the root element is either idoc:Document (for a
single document) or idoc:DocumentList (for a list of documents). Example 28, “IDoc Message Body in XML” shows a single IDoc document that has
been serialized to an idoc:Document element.
Example 28. IDoc Message Body in XML
<?xml version="1.0" encoding="ASCII"?>
<idoc:Document
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:FLCUSTOMER_CREATEFROMDATA01---="http://sap.fusesource.org/idoc/XXX/FLCUSTOMER_CREATEFROMDATA01///"
xmlns:idoc="http://sap.fusesource.org/idoc"
creationDate="2015-01-28T12:39:13.980-0500"
creationTime="2015-01-28T12:39:13.980-0500"
iDocType="FLCUSTOMER_CREATEFROMDATA01"
iDocTypeExtension=""
messageType="FLCUSTOMER_CREATEFROMDATA"
recipientPartnerNumber="QUICKCLNT"
recipientPartnerType="LS"
senderPartnerNumber="QUICKSTART"
senderPartnerType="LS">
<rootSegment xsi:type="FLCUSTOMER_CREATEFROMDATA01---:ROOT" document="/">
<segmentChildren parent="//@rootSegment">
<E1SCU_CRE parent="//@rootSegment" document="/">
<segmentChildren parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0">
<E1BPSCUNEW parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0"
document="/"
CUSTNAME="Fred Flintstone" FORM="Mr."
STREET="123 Rubble Lane"
POSTCODE="01234"
CITY="Bedrock"
COUNTR="US"
PHONE="800-555-1212"
EMAIL="fred@bedrock.com"
CUSTTYPE="P"
DISCOUNT="005"
LANGU="E"/>
</segmentChildren>
</E1SCU_CRE>
</segmentChildren>
</rootSegment>
</idoc:Document>This example demonstrates a route which reads FlightCustomer business
object data from SAP. The route invokes the FlightCustomer BAPI method,
BAPI_FLCUST_GETLIST, using an SAP synchronous RFC destination
endpoint to retrieve the data.
The Java DSL for the example route is as follows:
from("direct:getFlightCustomerInfo")
.to("bean:createFlightCustomerGetListRequest")
.to("sap-srfc-destination:nplDest:BAPI_FLCUST_GETLIST")
.to("bean:returnFlightCustomerInfo");And the Spring DSL for the same route is as follows:
<route>
<from uri="direct:getFlightCustomerInfo"/>
<to uri="bean:createFlightCustomerGetListRequest"/>
<to uri="sap-srfc-destination:nplDest:BAPI_FLCUST_GETLIST"/>
<to uri="bean:returnFlightCustomerInfo"/>
</route>The createFlightCustomerGetListRequest bean is responsible for
building an SAP request object in its exchange method that is used in the RFC call
of the subsequent SAP endpoint . The following code snippet demonstrates the
sequence of operations to build the request object:
public void create(Exchange exchange) throws Exception {
// Get SAP Endpoint to be called from context.
SapSynchronousRfcDestinationEndpoint endpoint =
exchange.getContext().getEndpoint("sap-srfc-destination:nplDest:BAPI_FLCUST_GETLIST",
SapSynchronousRfcDestinationEndpoint.class);
// Retrieve bean from message containing Flight Customer name to
// look up.
BookFlightRequest bookFlightRequest =
exchange.getIn().getBody(BookFlightRequest.class);
// Create SAP Request object from target endpoint.
Structure request = endpoint.getRequest();
// Add Customer Name to request if set
if (bookFlightRequest.getCustomerName() != null &&
bookFlightRequest.getCustomerName().length() > 0) {
request.put("CUSTOMER_NAME",
bookFlightRequest.getCustomerName());
}
} else {
throw new Exception("No Customer Name");
}
// Put request object into body of exchange message.
exchange.getIn().setBody(request);
}The returnFlightCustomerInfo bean is responsible for extracting data
from the SAP response object in its exchange method that it receives from the
previous SAP endpoint . The following code snippet demonstrates the sequence of
operations to extract the data from the response object:
public void createFlightCustomerInfo(Exchange exchange) throws Exception {
// Retrieve SAP response object from body of exchange message.
Structure flightCustomerGetListResponse =
exchange.getIn().getBody(Structure.class);
if (flightCustomerGetListResponse == null) {
throw new Exception("No Flight Customer Get List Response");
}
// Check BAPI return parameter for errors
@SuppressWarnings("unchecked")
Table<Structure> bapiReturn =
flightCustomerGetListResponse.get("RETURN", Table.class);
Structure bapiReturnEntry = bapiReturn.get(0);
if (bapiReturnEntry.get("TYPE", String.class) != "S") {
String message = bapiReturnEntry.get("MESSAGE", String.class);
throw new Exception("BAPI call failed: " + message);
}
// Get customer list table from response object.
@SuppressWarnings("unchecked")
Table<? extends Structure> customerList =
flightCustomerGetListResponse.get("CUSTOMER_LIST", Table.class);
if (customerList == null || customerList.size() == 0) {
throw new Exception("No Customer Info.");
}
// Get Flight Customer data from first row of table.
Structure customer = customerList.get(0);
// Create bean to hold Flight Customer data.
FlightCustomerInfo flightCustomerInfo = new FlightCustomerInfo();
// Get customer id from Flight Customer data and add to bean.
String customerId = customer.get("CUSTOMERID", String.class);
if (customerId != null) {
flightCustomerInfo.setCustomerNumber(customerId);
}
...
// Put bean into body of exchange message.
exchange.getIn().setHeader("flightCustomerInfo", flightCustomerInfo);
}This example demonstrates a route which creates a FlightTrip business
object instance in SAP. The route invokes the FlightTrip BAPI method,
BAPI_FLTRIP_CREATE, using a destination endpoint to create the
object.
The Java DSL for the example route is as follows:
from("direct:createFlightTrip")
.to("bean:createFlightTripRequest")
.to("sap-srfc-destination:nplDest:BAPI_FLTRIP_CREATE?transacted=true")
.to("bean:returnFlightTripResponse");And the Spring DSL for the same route is as follows:
<route>
<from uri="direct:createFlightTrip"/>
<to uri="bean:createFlightTripRequest"/>
<to uri="sap-srfc-destination:nplDest:BAPI_FLTRIP_CREATE?transacted=true"/>
<to uri="bean:returnFlightTripResponse"/>
</route>Note that the URL for the SAP endpoint has the transacted option set
to true. As discussed in Transaction Support, when this option is
enabled the endpoint ensures that an SAP transaction session has been initiated
before invoking the RFC call. Because this endpoint’s RFC creates new data in SAP,
this options is necessary to make the route’s changes permanent in SAP.
The createFlightTripRequest and returnFlightTripResponse
beans are responsible for populating request parameters into the SAP request and
extracting response parameters from the SAP response respectively following the same
sequence of operations as demonstrated in the previous example.
This example demonstrates a route which handles a request from SAP to the
BOOK_FLIGHT RFC, which is implemented by the route. In addition, it
demonstrates the component’s XML serialization support, using JAXB to unmarshal and
marshal SAP request objects and response objects to custom beans.
This route creates a FlightTrip business object on behalf of a travel
agent, FlightCustomer. The route first unmarshals the SAP request
object received by the SAP server endpoint into a custom JAXB bean. This custom bean
is then multicasted in the exchange to three sub-routes, which gather the travel
agent, flight connection and passenger information required to create the flight
trip. The final sub-route creates the flight trip object in SAP as demonstrated in
the previous example. The final sub-route also creates and returns a custom JAXB
bean which is marshaled into an SAP response object and returned by the server
endpoint.
The Java DSL for the example route is as follows:
DataFormat jaxb = new JaxbDataFormat("org.fusesource.sap.example.jaxb");
from("sap-srfc-server:nplserver:BOOK_FLIGHT")
.unmarshal(jaxb)
.multicast()
.to("direct:getFlightConnectionInfo",
"direct:getFlightCustomerInfo",
"direct:getPassengerInfo")
.end()
.to("direct:createFlightTrip")
.marshal(jaxb);And the XML DSL for the same route is as follows:
<route>
<from uri="sap-srfc-server:nplserver:BOOK_FLIGHT"/>
<unmarshal>
<jaxb contextPath="org.fusesource.sap.example.jaxb"/>
</unmarshal>
<multicast>
<to uri="direct:getFlightConnectionInfo"/>
<to uri="direct:getFlightCustomerInfo"/>
<to uri="direct:getPassengerInfo"/>
</multicast>
<to uri="direct:createFlightTrip"/>
<marshal>
<jaxb contextPath="org.fusesource.sap.example.jaxb"/>
</marshal>
</route>The following listing illustrates a JAXB bean which unmarshals from the serialized
form of an SAP BOOK_FLIGHT request object:
@XmlRootElement(name="Request", namespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT")
@XmlAccessorType(XmlAccessType.FIELD)
public class BookFlightRequest {
@XmlAttribute(name="CUSTNAME")
private String customerName;
@XmlAttribute(name="FLIGHTDATE")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date flightDate;
@XmlAttribute(name="TRAVELAGENCYNUMBER")
private String travelAgencyNumber;
@XmlAttribute(name="DESTINATION_FROM")
private String startAirportCode;
@XmlAttribute(name="DESTINATION_TO")
private String endAirportCode;
@XmlAttribute(name="PASSFORM")
private String passengerFormOfAddress;
@XmlAttribute(name="PASSNAME")
private String passengerName;
@XmlAttribute(name="PASSBIRTH")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date passengerDateOfBirth;
@XmlAttribute(name="CLASS")
private String flightClass;
...
}The following listing illustrates a JAXB bean which marshals to the serialized
form of an SAP BOOK_FLIGHT response object:
@XmlRootElement(name="Response", namespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT")
@XmlAccessorType(XmlAccessType.FIELD)
public class BookFlightResponse {
@XmlAttribute(name="TRIPNUMBER")
private String tripNumber;
@XmlAttribute(name="TICKET_PRICE")
private BigDecimal ticketPrice;
@XmlAttribute(name="TICKET_TAX")
private BigDecimal ticketTax;
@XmlAttribute(name="CURRENCY")
private String currency;
@XmlAttribute(name="PASSFORM")
private String passengerFormOfAddress;
@XmlAttribute(name="PASSNAME")
private String passengerName;
@XmlAttribute(name="PASSBIRTH")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date passengerDateOfBirth;
@XmlElement(name="FLTINFO")
private FlightInfo flightInfo;
@XmlElement(name="CONNINFO")
private ConnectionInfoTable connectionInfo;
...
}![]() | Note |
|---|---|
The complex parameter fields of the response object are serialized as child elements of the response. |
The following listing illustrates a JAXB bean which marshals to the serialized
form of the complex structure parameter FLTINFO:
@XmlRootElement(name="FLTINFO", namespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT")
@XmlAccessorType(XmlAccessType.FIELD)
public class FlightInfo {
@XmlAttribute(name="FLIGHTTIME")
private String flightTime;
@XmlAttribute(name="CITYFROM")
private String cityFrom;
@XmlAttribute(name="DEPDATE")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date departureDate;
@XmlAttribute(name="DEPTIME")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date departureTime;
@XmlAttribute(name="CITYTO")
private String cityTo;
@XmlAttribute(name="ARRDATE")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date arrivalDate;
@XmlAttribute(name="ARRTIME")
@XmlJavaTypeAdapter(DateAdapter.class)
private Date arrivalTime;
...
}The following listing illustrates a JAXB bean which marshals to the serialized
form of the complex table parameter, CONNINFO. Note that the name of
the root element type of the JAXB bean corresponds to the name of the row structure
type suffixed with _TABLE and the bean contains a list of row
elements.
@XmlRootElement(name="CONNINFO_TABLE", namespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT")
@XmlAccessorType(XmlAccessType.FIELD)
public class ConnectionInfoTable {
@XmlElement(name="row")
List<ConnectionInfo> rows;
...
}The following listing illustrates a JAXB bean, which marshals to the serialized form of the above tables row elements:
@XmlRootElement(name="CONNINFO", namespace="http://sap.fusesource.org/rfc/nplServer/BOOK_FLIGHT")
@XmlAccessorType(XmlAccessType.FIELD)
public class ConnectionInfo {
@XmlAttribute(name="CONNID")
String connectionId;
@XmlAttribute(name="AIRLINE")
String airline;
@XmlAttribute(name="PLANETYPE")
String planeType;
@XmlAttribute(name="CITYFROM")
String cityFrom;
@XmlAttribute(name="DEPDATE")
@XmlJavaTypeAdapter(DateAdapter.class)
Date departureDate;
@XmlAttribute(name="DEPTIME")
@XmlJavaTypeAdapter(DateAdapter.class)
Date departureTime;
@XmlAttribute(name="CITYTO")
String cityTo;
@XmlAttribute(name="ARRDATE")
@XmlJavaTypeAdapter(DateAdapter.class)
Date arrivalDate;
@XmlAttribute(name="ARRTIME")
@XmlJavaTypeAdapter(DateAdapter.class)
Date arrivalTime;
...
}