Skip to Content
Author's profile photo Former Member

Socket Integration with XI

It has been a while since i wrote a blog, had a feeling that i have learnt nothing new to share :), but then, i remember developing an integration
scenario some time back, i believe, is worth sharing.

The UseCase was to validate data entered in a transaction(a Ztransaction) in SAP by interfacing with a third party tool.Sounds like a standard
usecase for XI!!, you may ask, but the interesting part here was that this third party tool had a TCP/IP Socket interface.This third party tool was
a Bank SortCode/AccountNo verification tool, which accepted the BankSortCode/AccountNo details as string input,written to a specific port
on which the Socket Server is listening to.

The Solution: I implemented this interfacing putting to use the S/A bridge mechanism of ccBPM and Java Mapping as the means to connect
to the Socket Server.I had decided to send the details entered in the SAP screen to XI by means of a synchronous RFC call, parse the RFC
request parameters in XI to create the TCP/IP request string, open a socket connection to the third party verification tool, write the request
string to the socket, parse the response from the socket server and send the result of validation back to SAP via the RFC response.The
response time, though not excellent, is acceptable. I used Java Mapping as the means to open the socket connection and talk to the Socket
server.The Java Code goes something like given below(rather something of a pseudocode i would say).

The socket server was capable of giving me an xml response.If that is not your case, then you have to build the xml response using XML
APIs and fit the data returned by the third party tool in it.

An overview of Integration Repository Objects I had Used

  1. Two Data & Message Types, one for the tcp/ip socket request structure & the other for the xml response returned by the third party tool.
    If the third party tool provides the XSD for the xml response returned by the socket server, then you can import it.
  2. Two abstract asynchronous message interfaces, one for the request & other for the response MTs created in the above step. And then an
    abstract syncronous interface with the ouput & input message referring to the request & response message types created in the above step.
  3. Two message mappings, one message mapping will transform the RFC Request XML to the request structure of socket server and the second
    message mapping will transform the socket server response to the RFC response structure to be sent back to SAP.
    • RFC Request Structure -> Socket Request Structure(created in Step 1 above)
    • Socket Response Structure(Created in Step 1 above) -> RFC Response Structure
  4. A Java Mapping that will parse the tcp/ip socket request string from the incoming xml message, send a request to server socket, get the xml
    response and flush the response out as the output of Java Mapping. This is done in the execute method of the Java Mapping where in i had
    access to both the request & response xmls and also by way of package APIs could make a TCP/IP request.
  5. Two interface mappings.
    • Source interface is the RFC & target interface is the abstract synchronous interface created in step 2 above).Both message mappings
      created in step 3 above will be referred in the request/response tabs
    • Source interface & Target interfaces refer to the request and response abstract asynchronous message interfaces created in step 2
      above. The Java mapping created in step 4 above is used here.
  6. A ccBPM with 3 steps like below,
    • a recieve step(Mode – opens s/a bridge & synchronous interface referred is the one created in step 2 above)
    • a transformation step, the interface mapping specified here will call the Java Mapping program used to send the request to
      socket server and get the xml response.
    • a send step(Mode – closes S/A bridge , the Message reference in this step will refer the output structure of the Java Mapping)

An overview of Integration Directory Objects I had Used

  1. I created a Sender RFC Communication channel under the Business System imported from SLD(the Source SAP system from
    where the request originates).
  2. A quick checklist of what configuration is required in the source SAP system to send the RFC request
    is below.
    • Create an RFC destination(type T) in the SAP system from where you will initiate the RFC request to XI, specify the programid,
      gateway host(your SAP system host name) & gateway service parameters.
    • Create an RFC sender communication channel in your XI integration directory and specify the RFC Server parameters, make sure
      these parameters match what you have mentioned in the above step and activate the communication channel.
    • Try a test connection of the RFC destination created in your SAP system and make sure it is working fine.
  3. The remaining configuration steps are based on what is depicted below in a pictorial form.
  4. image

  5. Now, if you had noticed, there is no Business System that needs to be registered in SLD for the third party tool. The request originates from
    Source SAP system , the receiver system is your integration process(The transformation step takes care of connecting to the target third party

    Now, i think it makes sense of me to mention the names of one or two tools, if you happen to wonder whether there is ever a need for this interfacing
    mechanism. I happen to know atleast two vendors, One is Albany Verify and then there is BankWizard and there could be others.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Saravana,

      Good blog. Very few people get a chance to intergate with a system through sockets.


      Author's profile photo Former Member
      Former Member
      Hi Saravana,
      First of all i like to thankyou for sharing this information. In healthcare industry this is very essential since we have so many sub systems like LAB, EKG, etc, for which we supply data. I need some more help on how to write custom adapters which can communicate with other systems using TCP/IP protocol. Also in the example provided by you, where do we fit in the JAVA code. Please provide more information.

      Note: We have the Java code written in webMethods and have developed our custom adapter. We want the same thing to be developed for XI.


      Hoping to hear from you soon,


      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Hi Dinesh,

      In my case, interfacing to a TCP/IP socket server was a new requirement that just came out of the blue and it was just one interface, so we decided to go with using Java Mapping program as an option to communicate with the socket server. Also one more reason was that the socket server, in our case, gave an xml response, so it was easy to tweak it a bit and flush it as XML output of the Java mapping program. Error handling we managed with writing the socket exception message in one of the response fields of the RFC message(In our case it was RFC -> XI -> TCP/IP). More over, it was a "synchronous interfacing". so we did not have to worry about "persisting" the message.
      One more way to do this is the Java Proxy way. this link below has a demo, may be useful to you

      But, if you are looking at writing an adapter for interfacing with TCP/IP sockets, then it is different from what i have done here.I beleive it is a bit time consuming & resource intensive process of writing a custom adapter for your integration requirements in an "implementation project" that involves diverse interfaces. To start with , you can refer this help link taht gives an idea how to write an adapter and get it certified from SAP

      Hope it helps. Good Luck.


      Author's profile photo Former Member
      Former Member
      Hi Saravana,
      Thanks for your inputs and the useful link. I'm going through it and if i succeed i will share with you and the blog members. I hope you don't mind me bothering for some more information later.

      Thanks and Best Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dinesh,

      I have been reviewing this interesting post and today I have a requirement to integrate SAP IS-H medical equipment (vital sign) with PI and a socket connection, so really a have no idea how to do it. I am trying understand this method explain above but I would like to know if you have done any kind of this integration to show o guide me to understand more.

      Thanks in advance for any information can help me to achieve this challenge.

      Regards, LAFA°

      Author's profile photo Anupam Ghosh
      Anupam Ghosh

      Hi Saravana,

                           This is one of the best blogs I have ever seen in forum.

      Please keep writing more.