Skip to Content

RFC -> XI -> WebService – A Complete Walkthrough (Part 1)

“Nothing is impossible”

is what came to my mind when i finally found success with this scenario running into a “Chequered Flag”.

After some Testing webservices in the XI forum and help from my fellow SDNers I accomplised what was ‘my’ first successful communication of the XI server to a free WebService hosted over the internet.

Link to the WebService : Click Here

You can download the WSDL of the Webservice Here

About the WebService :

The WebService has different operations as following;

1. getState
2. getlocation
3. getCity


5. getLatitude

6. getLongitude

We will be using the operation getDistance in our scenario.

A screenshot of the WSDL in XML Spy is shown below:


The operation getDistance has an input that takes in two parameters fromZip and toZip and returns getDistanceReturn ie  it finds out the distance between two given ZipCodes.

The RFC :

A RFC is created at the R/3 side with the following parameters:

Import :




Integration Builder – Design :

We need to know the structure of the message that needs to go as a request to the Webservice and also how the Webservice responds back. This is relevent as we need to accomplish the mapping between the RFC.Request to SOAP.Request and SOAP.Response to RFC.Response.

+Note : Usually when we import the WSDL as an External Definition, we get the relevant messages for the request and response structures along with it. See screenshot below.


At my first try i used the messages getDistanceRequest and getDistanceResponse in my mapping but later found out that it wasnt the message structure that the webservice expected.+

To get the structure of the relevant request and response messages you can test the webservice with an editor like XML Spy. Refer this Invoke Webservices using SAPXI for a better understanding of how to accomplish the same.

In our case you can download and open the WSDL file in XML Spy.

Once we create a new SOAP request (XML Spy -> SOAP menu -> Create New Request) and then select the operation name (getDistance in our case) we get the request SOAP structure and once the request is sent the resulting is the response structure.

Now that we have an idea of the request and response structures for the SOAP we can proceed to build the design.

1. Import the RFC from R/3 into the relevant software component version.

2. Create a Data type DT_getDistance as follows,


3. Create a Message type getDistance as follows replacing the namespace to


4. For the response structure of the SOAP i created a XSD and imported it as a external definition.

5. A message interface (inbound synchronous) is then created.


6. Mapping are done, the first being the RFC request to the SOAP request (getDistance) and the second the SOAP response (getDistanceResponse the message in the ED) to the RFC response.

Mapping 1 :


Mapping 2 :


7. Interface mapping – Specify the source interface as the RFC and the target as the inbound synchronous interface created.


Save and Activate all the objects created.

This brings us to the end of the Design.

In the RFC -> XI -> WebService – A Complete Walkthrough (Part 2) we look at the configuration and testing of the scenario.

You must be Logged on to comment or reply to a post.
    • Hi Shabrish,
      That was a very informative blog.
      I have tried replicating the same scenario and am getting an error as "ADAPTER.SOAP_EXCEPTION".
      I have directly executed the function module in the sender SAP system by giving XI as RFC destination.
      Thus when the RFC is trigered from the sender SAP system the function module goes for a dump saying
      "call to messaging system failed:".

      Waiting for your help in this.

      Thanks & Regards,

    • Hi Pritish,

      The RFC developed for this scenario does not have any code since we are not manupulating the data sent or received by the RFC.

      Source Code section:

      *"*"Local interface:
      *"  IMPORTING
      *"     VALUE(FROMZIP) TYPE  CHAR10
      *"     VALUE(TOZIP) TYPE  CHAR10
      *"  EXPORTING



  • Hi Shabz,

    Its gr8 initiative to write a blog on this topic. It will be helpful, for creation of 1st scenario with webservice.

    Keep exploring new areas.


  • Thanx shabz your scenario is really helpfull for me,In your scenario you have created xsd for the soap response,can you please tell me how to do that & why it is required,bcoz from the webservice message we can the take the response.
  • Hi Shabarish,
    Please help me understand where ZWEBSERVICE rfc destination pointing to since function module resides in R3 and whats the necessity of giving call function function module destination.
    Appreciate any help provided.


  • Hi Shabrish,
    Just read your blog, i didn't got anything. I am novice to SAP, but has known to Webservices 2-3 from now.

    Can u please elaborate the concept little more.


  • Hi,

    This Blog is very good but It's necessary to inform the audince about key aspects.
    For example sriram ask about xsd generation. Sometimes it's necessary to generate the input and the response xsd files because a web service expects to receive the information in the correct format.

    I complete this scenario successfully after several tries using a Web Service created with .NET. If anyone's interested in how to this you can e-mail me.


  • Hi Shabs,

    You are using XML Spy to know the request SOAP structure and the response SOAP structure.

    I am using Oxygen XML Editor 8.2.  In that case how will I be able to get the exact SOAP structure.  Is there any options within the Menu or tool bar.  Any idea!

    Thanks. Bala

  • HI Shabhrish,

    I have gone through all your RFC <-> WS scenarios.They are really helpfull to understand the process of SOAP and RFCs.
    I tried out all different methods mentioned by you.At first when I tried to with the actual web address of I am facing error message as UnknownHostException.
    Later going through your other thread of help on this I did the same by replacing the url with where is obtained after pinging How ever with this I am facing the error message as invalid content type for SOAP: TEXT/PLAIN. This is happening because when I even tried to access the web page with the url(using ip address) it was not returning the value of distance but staying at the same page.
    Can you let me know how you could over come these issues by using ip address itself. Is it that I have misunderstood your UnknownHostException thread.
    Please help me out by explaining what you did by replacing the proxy address.

  • Hi Shabarish,
        Ur web blog really gives the confidence to study the technology. I need to know where we internally use the imported external defintion.
    i am the starter i could get the clear picture, if u could spend the time plz tell me.]
    Thanks and regards