You are on page 1of 14

Publishing Interface as Web Service (Web Service to RFC)

By Neeraja Surapaneni, YASH Technologies


This step-by-step document describes how to publish the Interface as web service from XI.
Business process:
In this example we are publishing outbound interface as web service. When the interface is defined as web
service in the Integration directory, it will generate a WSDL document. Using this WSDL we can create
SOAP request with the help of third party tools like XML SPY or Microsoft InfoPath. When this SOAP request
is send to the XI system it will invokes the RFC ZSYNCGETSFLIGHTDET_E6S_800 in SAP R/3 system
and this RFC returns the response back to the SAP XI. The SAP XI collects the response and maps to the
WSDL response, which in turn is sent back to third party system XML SPY or Microsoft InfoPath.
About RFC
The RFC ZSYNCGETSFLIGHTDET_E6S_800 when executed on E6S system client 800 with import
parameters CONNID and CARRID checks whether the combination exist in SAP database table SFLIGHT or
not? If the combination exists then it will return FLAG as 0 otherwise returns FLAG as 4.
1.

Create RFC in the R/3 system

First we need to create the RFC ZSYNCGETSFLIGHTDET_E6S_800 in R/3 system with import parameters
as CONNID, CARRID and export parameters as CONNID, CORRID and FLAG.
Go to Transaction SE37 to create RFC.

2.

Design the interfaces in Integration Repository

Start up the home page of the Exchange Infrastructure Tools using transaction SXMB_IFR. Click on the
Integration Repository under Integration builder.
2.1 Import RFC:- Import the RFC that we have created in the above step from the corresponding R/3
system. To import RFC right click on RFCs which is under the Imported Objects under the Software
component version.

When we import RFCs we will get both Request messages and Response messages. This imported
RFC can be used as Message Interface.

2.2 Define Request and Response Data Types:- Define a new data types for each Request and
Response messages of imported RFC.
The structure of Request data type should resemble Import parameters of RFC

The structure of Response data type should resemble Export parameters of RFC.

2.3 Define Request and Response Message Types:Create Request Message Type by encapsulating Request data type.

Now
type.

create

Response

Message

Type

by

encapsulating

Response

data

2.4 Create outbound synchronous Message Interface


We are going to publish this Outbound Message Interface as Web service in Integration Directory. Once
we define this interface as web service it will generate WSDL file. Using this file we can create a SOAP
request using third party tools like XML SPY or Microsoft Info path.

2.5 Create Message mappings


Here we need to create two message mappings, the first mapping is between Request message
type and RFC Request message and the second mapping is between RFC Response message and
Response message type.

Request message mapping

Response message mapping

2.6 Create Interface mapping


As the Interface is Synchronous it will ask for the Request and Response

Activate all the changes by clicking on Change lists tab.

Click here to continue...

Publishing Interface as Web Service (Web Service to RFC)


...Previous
3.

Configurations in the Integration Directory

In the Integration Repository first we need to create one Business service, as the sender is SOAP and import
the Business system from the SLD as the receiver is RFC.
3.1 Create Business service and communication channel
Right click on the Business service to create a new Business service

Right click on the communication channel to crate communication channel for SOAP sender

3.2 Import Business system and create receiver RFC communication channel

3.3 Create Sender agreement, Receiver determination, Interface determination and Receiver
agreement
Sender agreement

Receiver agreement

Interface determination

Receiver determination

3.4 Define web service


To define the web service, select define web service from the tools menu

It will take you to the wizard, which enables you to create web service documents in WSDL.

Click on continue button


It will ask you to specify Integration Server SOAP inbound channel URL The syntax of the URL is
specified below
The inbound address for SOAP message is:
http://host:port/XISOAPAdapter/MessageServlet?channel=party:service:channel
Under party:service:channel enter the party name, the service name, and the name of the communication
channel. If no party has been created, enter the following: channel=:service:channel

Click on continue button. Here we need to specify the Name, Name space and Software component version
of the Message interface from the Integration Repository that we want to publish.

Click on continue button. Here we need to specify the sender of the message. You then use these details to
define receiver determinations and interface determinations, for example

Now click on continue then Finish button. It will generate the WSDL document. Save the document for
further processing.
3.

Test the Scenario


In order to test this scenario we need third party tools like XML Spy or Microsoft InfoPath.
In this example we are using XML SPY to create and send SOAP request from the generated WSDL.
Open XML spy editor to create a SOAP request from the WSDL generated above.

Input Xml File


SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAPENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:MT_flight_req_ob xmlns:m="http://yash.com/xi/poc/WS_2_RFC">
<Flight>
<CARRID>AH</CARRID>
<CONNID>AA</CONNID>
</Flight>
</m:MT_flight_req_ob>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Send the SOAP Request to Server
Tools->SOAP->Send Request To Server
Output XMl File(response)
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header/>
<SOAP:Body>
<ns1:MT_flight_res_ob mlns:ns1="http://yash.com/xi/poc/WS_2_RFC">
<flight>
<CARRID/>0000</CARRID>
<CONNID>0000</CONNID>
<FLAG>4</FLAG>
</flight>
</ns1:MT_flight_res_ob>
</SOAP:Body>
</SOAP:Envelope>

You might also like