AdapterDevGuide External
AdapterDevGuide External
AdapterDevGuide External
Developing Adapters
Content
Developing Adapters
2 PUBLIC Content
1 Adapter Development Prerequisites
You have read SAP Cloud Platform Integration Developers' guide and Operations guide so that you have a
better understanding of integration flows and connectivity options of SAP Cloud Platform Integration. To
extend the connectivity options of SAP Cloud Platform Integration, you can develop new adapter tailored along
specific requirements.
You can contribute an Apache Camel component as SAP Cloud Platform Integration adapter. To integrate
camel component into SAP Cloud Platform Integration framework, you should specify the detailed set of
adapter attributes as component metadata. Component metadata defines the adapter attributes,
dependencies between them and the structure of configuration interface for a specific adapter, which is used
for user interface generation.
Following are the guidelines that you need to understand and follow while developing camel component:
Camel Component Scheme - Make sure that you use a unique camel component scheme to avoid
runtime collisions with other registered schemes.For example, the camel component scheme can be sap-
dropbox.
Secure Programming - Secure parameters must be stored in runtime secure store and accessed through
alias configured in adapter.
Security Aspects -
Always scan for virus in the Adapter workspace / project before deployment.
The Adapter design time content bundle should not contain any confidential information (For
example: hard-coded secrets, passwords, users or documents).
Perform fortify and java static code checks.
Logging - Use Slf4j logging
API Consumption
To access platform specific features, you can use public APIs which are available with the Adapter
Development Kit (ADK). Public APIs for the ADK are available in SAP Cloud Platform Integration tools
page.
JavaDoc containing public API can be found at: https://uacp.hana.ondemand.com/http.svc/rc/
PRODUCTION/saphci_javadoc_adk/1/en-EN/index.html.
To consume the APIs you need to use the code snippet ITAiFactory.getApi(apiType,
context); wherein, apiType is the class of the requested API interface. The camel context can be null
if it is not required for a particular API. For Example: For accessing KeystoreService, use
ITApiFactory.getApi(KeystoreService.class, context)
Note
The Java standard libraries of Java 7 can be used.
Cloud Integration supports the XML Document Object Model (DOM) to process XML documents.
Manifest.MF + Whitelisting - Only ADK APIs, Camel core and Logging are accesible at runtime. However,
if required you can import packages for dependent libraries bundled alongwith project.
You can use the following code snippet, if you want to read a resource in integration flow project at
runtime.
Developing Adapters
Adapter Development Prerequisites PUBLIC 3
Sample Code
InputStream is =
ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getCl
assResolver(), "//resources/parameters.propdef");
Developing Adapters
4 PUBLIC Adapter Development Prerequisites
2 Adapter Development Process
You develop new SAP Cloud Platform Integration adapters to extend the connectivity of SAP Cloud Platform
Integration with remote systems.
SAP Cloud Platform Integration provides a set of adapters to meet standard connectivity needs. For example,
the SOAP adapter allows you to exchange SOAP messages through SAP Cloud Platform Integration, or the
SFTP adapter supports the exchange of files with SFTP servers. These adapters can be configured in
integration flow to enable connectivity between sender and reciever systems.
OSGi bundles are normal jar components with extra manifest headers, which you use to develop adapters.
Prerequisites
Context
To integrate camel component into SAP Cloud Platform Integration framework, camel component and its
dependencies should be OSGi bundle. To convert the jar file to OSGi bundle execute the following steps:
Procedure
Developing Adapters
Adapter Development Process PUBLIC 5
7. In the Plug-in Project Propertiesdialog, specify a name in the Project name field.
8. In the Execution Environment drop down list box, select any java version that is less than or equal to
JavaSE-1.7.
9. In the Target Platform, select an OSGi framework option.
10. Choose Finish.
11. Select the MANIFEST.MF file of your project, and go to Runtime tab.
12. Choose Add.
13. Select the required export packages.
14. Choose OK and save the MANIFEST.MF file.
15. Right Click on the project and choose Export.
16. In the Export wizard search for plug-in Development and choose Deployable plug-ins and fragments.
17. Choose Next.
18. Choose Browse and select the directory where you want the plug-in to be generated.
19. Choose Finish.
Results
In the directory, you can see the plug-ins folder with the OSGi bundle of jar file.
Component metadata defines the attributes of the sender and receiver adapters that contain multiple tabs.
Each tab can contain multiple attributes. You can group the attributes into multiple attribute groups within the
tabs. You can use the same attribute across the sender and receiver adapters by using attribute reference.
Component Metadata
Developing Adapters
6 PUBLIC Adapter Development Process
Table 1: Component Metadata
Property Datatype Cardinality Description
ComponentId xsd:string Attribute Specifies a unique Id for the component. The following are technical iden
tifiers and should not contain any space or special character.
Example: ctype::Adapter/cname::sap:dropbox/
version::1.0.0
Variant Child Ele Different variants for a specific component type - for example: Sender
ment and Receiver variants of an adapter
hci:RuntimeCom xsd:string Attribute This attribute specifies the name with which the component is identified.
ponentBaseUri If not added, then the baseUri value is taken from TP (Transport Proto
col).
Sample Code
<ComponentMetadata
ComponentId="ctype::Adapter/
cname::sap:sampleadapter/version::1.0.0"
ComponentName="sap:sampleadapter"
UIElementType="Adapter"
IsDefaultGenerator="true"
hci:RuntimeComponentBaseUri="dropbox">
Sample Code
<camel:from
id="MessageFlow_1_1435812482630"
uri="dropbox:foo?path=/input/test.txt&
method=get&sendEmptyMessageWhenIdle=fal
se&
initialDelay=1000&greedy=false&star
tScheduler=false&timeUnit=MILLISECONDS&
amp;
useFixedDelay=false&delay=500&runLo
ggingLevel=TRACE"/>
IsRequestRes xsd:string Attribute This attribute is used for enabling the component to allow the service call
ponse for Request Reply. Default value is false.
Developing Adapters
Adapter Development Process PUBLIC 7
Property Datatype Cardinality Description
hci:FirstUriPart xsd:string Attribute Specifies the initial part of the URI. Customer can provide custom values
for the first part of the URI string. Default value is 'foo'.
Note
IsDefaultGenerator and Metadata Version must always be true and should never be set to false. Metadata
Version attribute is generated with default value as 2.0.
Variants
Table 2: Variants
Property Data Cardinal Description
type ity
Input Content Child Ele Input content specifies the type of data the adapter processes.
ment
Tag used <Input Table 3:
Content>
Properties Attributes/Child Ele Description
ments
Supported content
types: Xml, String, Boo
lean, Base64Encoded,
Any, Json, Binary, Zip,
GZip, Integer, NonXml,
None and Text.
Developing Adapters
8 PUBLIC Adapter Development Process
Property Data Cardinal Description
type ity
Output Content Child Ele Output content specifies the type of data the adapter produces. Example: XML.
ment
Table 4:
Supported content
types: Xml, String, Boo
lean, Base64Encoded,
Any, Json, Binary, Zip,
GZip, Integer, NonXml,
None and Text.
Metadata Child Ele Helps to add additonal metadata in the component. Specifies the display name
ment of transport protocol and message protocol.
Sample Code
<Metadata>
<AdditionalMetadata>
<Name>mp</Name>
<GuiLabels guid="e7fa4f1d-
ec6a-4248-9752-920ea9616bc9" >
<Label language="EN" >AS2</Label>
<Label language="DE" >AS2</Label>
</GuiLabels>
</AdditionalMetadata>
<AdditionalMetadata>
<Name>tp</Name>
<GuiLabels guid="e7fa4f1d-
ec6a-4248-9752-920ea9616bc9" >
<Label language="EN" >HTTPS</Label>
<Label language="DE" >HTTPS</
Label>
</GuiLabels>
</AdditionalMetadata>
</Metadata>
Note
You should refer message protocol as mp and transport protocol as tp.
Developing Adapters
Adapter Development Process PUBLIC 9
Property Data Cardinal Description
type ity
ManifestEntries Child Ele Specifies which manifest entries you can add in manifest file. You can add or
ment update Import-Package entries in manifest files.
Sample Code
<ManifestEntries>
<ManifestEntry>
<Name>Import-Package</Name>
<Value>com.sap.gateway.core.service.ljs.registry;
resolution:=optional,com.sap.gateway.core.ljs;res
olution:=optional</Value>
</ManifestEntry>
</ManifestEntries>
Allowed Headers Child Ele Specifies which headers can be passed in the integration flow pipeline from
ment sender component.
Sample Code
<AllowedHeaders>
Header1,Header2
</AllowedHeaders>
hci:FirstUriPart xsd:strin Attribute Specifies the initial part of the URI. Customer can provide custom values for
the first part of the URI string.
g
IsRequestRes xsd:strin Attribute This attribute is used for enabling the variant to allow the service call for Re
quest Reply
ponse g
supportsPolling xsd:boo Attribute This attribute depicts if the component has the polling behavior. (supportsPol
lean ling). It also helps in populating the timer icon at design time when IFlow is dec
orated. Default value is false. It is applicable for sender channel only.
AttachmentBe xsd:strin Attribute This attribute helps to identify the component behavior towards attachment.
havior g
Modify - Create or update an attachment
Preserve - Pass through for the attachments
Drop - Attachment will be lost
Note
If you want to rename a variant id or delete a variant from adapter, first undeploy the adapter with old
variants and then deploy updated adapter.
Developing Adapters
10 PUBLIC Adapter Development Process
You can still view the older variants if you do not undeploy the adapter with old variants.
Tabs
This set of metadata allows you to specify tab pages for the adapter configuration user interface.
Table 5: Tabs
Property Datatype Cardinality Description
<GuiLabels>
<Label language="EN">Address</Label>
</GuiLabels>
Here, Label language = "EN" represents that the text of guilabel is in english.
Address is the text for the attribute name.
Attribute Group
Name xsd:string
Examples:
Dropbox Endpoint
Developing Adapters
Adapter Development Process PUBLIC 11
Property Datatype Cardinal Description
ity
xsd:integer
xsd:boolean
xsd:long
xsd:password
xsd:id
xsd:idref
Note
If an attribute is marked with xsd:id in metadata, then its value should be unique
across elements of integration flow, during design time.
<AttributeReference>
<ReferenceName>address</ReferenceName>
<!-- Restriction tag defines java regular expression for field
value -->
<Restriction>Constraint.isValidRegex([A-Za-z]+[0-9_~\\-\\.]*)</
Restriction>
<!-- This tag defines message to be displayed if field value is
invalid -->
<ErrorMessage>Enter a valid address. E.g. /file</ErrorMessage>
<!-- Description tag defines tool tip for field value -->
<description>Relative endpoint address on which..</description>
</AttributeReference>
<AttributeReference>
<ReferenceName>wsdlURL</ReferenceName>
<Restriction>Constraint.isValidRegex(^(https://){1}(.)+)</
Restriction>
<ErrorMessage>Enter a valid URL. E.g. /wsdl/abc.wsdl;</ErrorMessage>
<description>URL to the WSDL.</description>
</AttributeReference>
<AttributeReference>
<ReferenceName>cxfOnewayRobust</ReferenceName>
<description>Used for reliable one-way message exchanges.</
description>
</AttributeReference>
</AttributeGroup>
Developing Adapters
12 PUBLIC Adapter Development Process
Attribute Reference
Constraint Description
Sample Code
<AttributeReference>
<ReferenceName>stepid</
ReferenceName>
<Restriction>Constraint.isValidRege
x([a-zA-Z0-9]+)</Restriction>
<ErrorMessage>StepID not
defined for Persist Message step</
ErrorMessage>
</AttributeReference>
isValidURIString Returns true if it is valid URI String. It can start with http(s),
ftp, file or ldap
Developing Adapters
Adapter Development Process PUBLIC 13
Constraint Description
Attribute Metadata
This set of metadata allows you to define the details of all adapter attributes. This includes the definition of
fixed values for input help, and the kind of user interface element used for an adapter attribute (for example if
it is a checkbox or a dropdown list).
<AttributeMetadata>
<Name>address</Name>
<Usage>true</Usage>
<Default>/BSN/paymentOrder</Default>
<DataType>xsd:string</DataType>
<isparameterized>true</isparameterized>
<Length>200</Length>
<FixedValues>
<FixedValue>
<Value>Atleast Once</Value>
<GuiLabels>
<Label language="EN">Atleast Once</Label>
</GuiLabels>
</FixedValue>
</FixedValues>
<GuiLabels>
<Label language="EN">Address</Label>
</GuiLabels>
</AttributeMetadata>
Example: address
Usage xsd:boo Specifies if the field is mandatory or not. If the value is true then usage of field is
lean mandatory. If the value is false then usage of field is not mandatory.
Example: /BSN/paymentOrder
Developing Adapters
14 PUBLIC Adapter Development Process
Property Datatype Cardinality Description
Examples:
xsd:string
xsd:integer
xsd:choice
If the value has data type <xsd:choice> then it is treated as Radio Button.
Length xsd:inte Specifies the maximum character length for field values.
ger
Minlength xsd:inte Child Ele Specifies the minimum character length for field values.
ger
ment
Sample Code
<HelpService>
<HelpServiceName>
ResourceLookupService
</HelpServiceName>
<HelpServiceQueryAttributes>
<HelpServiceQueryAttribute>
<Name>
ResourceType
</Name>
<Value>
xml
</Value>
</HelpServiceQueryAttribute>
<HelpServiceQueryAttribute>
<Name>
ResourceLocation
</Name>
<Value>
edmx
</Value>
</HelpServiceQueryAttribute>
</HelpServiceQueryAttributes>
</HelpService>
Once you add the above code, then a Browse button gets enabled. You can click
on the button and select resource file from the project of file system.
ResourceLocation specifies relative path to project from where files are read or
written.
Developing Adapters
Adapter Development Process PUBLIC 15
Property Datatype Cardinality Description
Note
If the element is set to
'false', then the values
are arranged as per
the order defined in
the cmd.
Developing Adapters
16 PUBLIC Adapter Development Process
Table 11: Attribute Reference Table
Developing Adapters
Adapter Development Process PUBLIC 17
Property Data Type Cardinality Description
Sample Code
<AndCondition>
<EditCondition>
<AttributeName>
reference1</
AttributeName>
<AttributeValue
>reference1valu
e</
AttributeValue>
</
EditCondition>
<EditCondition>
<AttributeName>
reference2</
AttributeName>
<AttributeValue
>reference2valu
e</
AttributeValue>
</
EditCondition>
</AndCOndition>
Developing Adapters
18 PUBLIC Adapter Development Process
Property Data Type Cardinality Description
Developing Adapters
Adapter Development Process PUBLIC 19
Property Data Type Cardinality Description
Sample Code
<AndCondition>
<OrCondition>
<EditCondition>
</
EditCondition>
<EditCondition>
</
EditCondition>
</
OrCondition>
<NotCondition>
<EditCondition>
</
EditCondition>
</
NotCondition>
</
AndCondition>
Developing Adapters
20 PUBLIC Adapter Development Process
Property Data Type Cardinality Description
Constraint to be executed,
this is on top of base con
straint defined at Attribute
Level Environment Variables:
If the Attribute Name starts
with $ then next part is con
sidered as an Environment
variable. There can be two
types of variables:
a) $PROFILE.NAME - envi
ronment variables starting
with profile are properties
fetched on profile configured
for project
b) $ENV.VARIABLE - envi
ronment variables starting
with env are system proper
ties for vm
Name xsd:string
Usage xsd:boolean
Developing Adapters
Adapter Development Process PUBLIC 21
Property Data Type Cardinality Description
Sample Code
<HelpService>
<HelpServiceNam
e>
CertificateLook
upService
</
HelpServiceName
>
</HelpService>
Note
Each reference name
constitutes to one column
in the table.
Sample Code
<AttributeTableMetadata>
<Name>clientCertificates</Name>
<Usage>true</Usage>
<GuiLabels guid="01c2bd59-8dd1-4efb-b795-869851eb979b">
<Label language="EN">Client Certificate Authorization</Label>
<Label language="DE">Client Certificate Authorization</Label>
Developing Adapters
22 PUBLIC Adapter Development Process
</GuiLabels>
<AttributeReference>
<ReferenceName>clientCertificate.subjectDN</ReferenceName>
</AttributeReference>
<AttributeReference>
<ReferenceName>clientCertificate.issuerDN</ReferenceName>
</AttributeReference>
</AttributeTableMetadata>
Note
You must not use any special character in the table fields.
Blueprint metadata defines the attributes of the sender and receiver adapters that contain multiple tags.This
document mainly describes all the tags and attributes apart from CMD and camel blueprint tags for providing
additional generation injection for ADK development.
Blueprint Metadata
This set of tags and attributes allows you to define the metadata.
Table 13:
Developing Adapters
Adapter Development Process PUBLIC 23
Attributes Datatype Cardinality Description
For example:
Sample Code
<bean id=123
class=com.exam
ple.Someclass.j
ava
createCondition
="$.cmd.attribu
te(proxyType)='
onPremise'"/>
Here Someclass.java is
generated in the blueprint
only if the UI variable
proxyType contains the
value onPremise.
Table 14:
Tag Description
<TransformationTags xmlns:bp=http:// This is the parent tag for the <blueprint> tag. This tag
www.adk.gen/xmlns/blueprint/> does not contain any generation specific information as part
of attribute. The <blueprint> tag must be included
within this tag.
<bp:reference> To generate References this tag can be used. This tag does
not contain any new attributes. It is similar to the camel
blueprint's reference tag. Refer the XSD above for all sup
ported attributes.
Developing Adapters
24 PUBLIC Adapter Development Process
Tag Description
<camel:camelContext xmlns:camel=http:// This is the root camel context tag just for the reference. This
camel.apache.org/schema/blueprint> contains all the properties a final blueprints camelContext
contains as part of g&b generation. The user is not allowed
to make any change to this tag. Any changes/additions will
simply be ignored.
<properties> Can be contained in the DSL just for reference. This tag
must be same as g&b's generated tag. It has no significance.
i.e. any modification to this tag can simply be ignored by the
DSL processor.
Prerequisites
You are aware of the technical details of component/domain that you have to connect with SAP Cloud
Platform Integration through the newly developed adapter type.
You have Java 7 version.
You are familiar with using Apache Camel and Java.
You have the Camel component and its dependencies as OSGi bundles.
You have the camel core run time version 2.17.4.
You have the simple logging facade for java (SLF4J).
Procedure
1. Install the Adapter SDK for SAP SAP Cloud Platform Integration. For more information, see Installation
Instructions
Developing Adapters
Adapter Development Process PUBLIC 25
2. Open Eclipse and choose the Integration Designer perspective.
3. Create a new adapter project using the following sub-steps:
Note
If you are entering value in Version field, then you must enter the major, minor and macro versions.
Currently, the tool supports only 1.0.0 version, which is also the default value.
e. Choose Finish .
4. Develop camel component.
Note
createProducer() or createConsumer() method, will throw UnsupportedOperationException,
RuntimeCamelException, OperationNotSupportedException exceptions. You can prevent the generation
of producer or consumer components by throwing UnsupportedOperationException exception.
5. Add one (mandatory) camel component .jar file in component folder and other additional (optional)
dependent .jar files in libs folder.
Note
You must add only those jar files that are valid OSGi bundles. Component jar is a camel based
component bundle. Dependent jars are the osgi bundles that are required by camel component.
6. Right click on the new adapter project or the component folder and select Generate Metadata
Component Metadata to generate a sample component metadata.
Note
Generate component metadata works only if annotations are marked in the camel bundle on endpoint
class variables.
Annotations:
@Required : used to make the field mandatory and belongs to the package
org.apache.camel.spi.Required
Example: @UriParam
@Required
Attribute behavior is set as SecureAlias if the variable name has password, key, secret or token
keywords.
Follow the substeps to introduce custom classes using blueprint metadata that allows you to extend the
runtime capabilities of the component.
Developing Adapters
26 PUBLIC Adapter Development Process
1. Right click on the new adapter project or the component folder and select Generate Metadata
Blueprint Metadata to generate a sample blueprint metadata.
2. Update the <ReferencedComponents> tag in metadata.xml to provide a reference to
bpMetadata.xml.
Note
The value provided here is variant specific, for multiple variants fetch appropriate URL and update the
metadata.xml in the matching variant. For example, a variant can be either Receiver or Sender.
7. Adapt the component metadata file according to the requirements of the new adapter type.
8. If you want to verify if the adapter project has valid contents such as component metadata in metadata
folder and jar files in the libs and component folder, right click on the project and choose Execute Checks.
9. If you want to build your project locally, right click on the project and choose Build Adapter Project.
Note
Once you build locally, the system creates target.build directory, where you can find a new adapter
runtime archive.
10. To configure the Operations Server to connect your local Eclipse tooling to the tenant, execute the
following sub-steps:
Note
IFL worker node does not support ADK.
12. Check the status of your deployed project by executing the following sub-steps:
a. In Node Explorer, choose worker node.
Note
You can construct an application URL in the following format https://<IFLMAP URL>/<web
context path>/ to call the servlet.
b. Select the Component Status View tab and check the status of the adapter project.
Note
If you do not delete an adapter but some other user deletes the adapter and still the metadata
is available in integration flow, then you must restart the system.
You must undeploy the integration flows using the relevant adapter before undeploying
adapter.
Developing Adapters
Adapter Development Process PUBLIC 27
3 Deploying a Secure Parameter Artifact
Use the secure parameter artifact to deploy confidential data for custom adapters.
Prerequisites
In the Node Explorer you have selected a tenant, in the context menu you have selected Deploy Artifacts, and
you have specified Secure Parameter as the artifact type.
Context
You can store secure data like passwords in a secure store and use an alias name to access this data in an
integration flow. The secure parameter artifact contains this alias name and confidential data.
You can deploy the artifact on the tenant by following the procedure below.
Procedure
Option Description
The artifact name is used as an alias for the confidential data assigned by this parameter.
2. Choose Finish.
Note
If correct alias is configured in the integration flow, then the runtime framework passes the secured
artifact value to the component at runtime from the secure store.
Developing Adapters
28 PUBLIC Deploying a Secure Parameter Artifact
Important Disclaimers and Legal Information
Coding Samples
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system
environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and
completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP
intentionally or by SAP's gross negligence.
Accessibility
The information contained in the SAP documentation represents SAP's current view of accessibility criteria as of the date of publication; it is in no way intended to be
a binding guideline on how to ensure accessibility of software products. SAP in particular disclaims any liability in relation to this document. This disclaimer, however,
does not apply in cases of willful misconduct or gross negligence of SAP. Furthermore, this document does not result in any direct or indirect contractual obligations
of SAP.
Gender-Neutral Language
As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as
"sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun
does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible.
Internet Hyperlinks
The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does
not warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any
damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. All links are categorized for
transparency (see: http://help.sap.com/disclaimer).
Developing Adapters
Important Disclaimers and Legal Information PUBLIC 29
go.sap.com/registration/
contact.html