You are on page 1of 12

How to Wrap any ABAP-RFC-Call

into a Web Service Using PI 7.x

Applies to:
SAP PI 7.x and SAP XI 3.0

Summary
This HOWTO shows how to wrap any ABAP RFC-Call into a Web Service that can even be used on a JavaMobile-Phone.
Author:

Rene Pilz

Company: SFS Services AG, Heerbrugg, Switzerland


Created on: 25. February 2010

Author Bio
SAP PI Specialist at SFS Services AG, Heerbrugg, Switzerland. We wad the first productive
SAP XI Installation within Switzerland. Currently we have up to 400 Partner-Connections with
any possible format (EDIFACT, ANSI, XML, CSV, FIXED-Length,). Also responsible for Mobile
Development Team just started.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


1

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Table of Contents
Overview ............................................................................................................................................................. 3
Download RFC-Information from R/3 System .................................................................................................... 4
Create Web Service Request and Response Structure ..................................................................................... 6
Create Web Service Interface............................................................................................................................. 6
The Message Mappings (request and response) ............................................................................................... 7
The Operation Mapping ...................................................................................................................................... 7
Configurations within Integration Directory (integration builder)......................................................................... 8
WSDL? ............................................................................................................................................................. 10
Tests, Troubleshooting ..................................................................................................................................... 10
Related Content ................................................................................................................................................ 11
Disclaimer and Liability Notice .......................................................................................................................... 12

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


2

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Overview
We create a Web Service with PI 7.x. This Web Service is wrapped around a RFC-Call to the ABAP-Stack.
So you can wrap any RFC-Call into a Web Service and use this for example on a mobile phone.
See also the Source-Forge Project xmlnodeparser which provides a lightweight SOAP-Client that can run on
any Java-Capable Mobile Phone (even those without JSR 172 - Web Services).

Our scenario is as following:


1. Web Service Client (i.e. Java Mobile Phone) sends a request to SAP PI
2. SAP PI takes out the XML Payload and calls a RFC Function for example on a SAP R/3 System
3. The response of this function call is taken back from the PI
4. The response is wrapped into the Web Service Response and sent back to the Web Service Client
Note: On the PI System this is realized as a synchronous interface, meaning the Web Service Client immediately gets its
answer.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


3

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Download RFC-Information from R/3 System


Before you can use a RFC from an R/3 (or lets say: ABAP) System you have to download its configuration:
Just go into the Enterprise Services Builder and choose the Software-Component you wish (we always
create one Software-Component for the R/3-Systems) and set up the connection to your ABAP-System:

Now you can right-click on "Imported Objects" and choose "Import SAP Objects":

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


4

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

There you can choose the RFC-Call you wish to import:

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


5

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Create Web Service Request and Response Structure


Just create the Datatype of the request and the response structure as usual:

Using the PI-functionality (Hint: Datatype, Messagetype)

Import an external XSD

[]

Create Web Service Interface


Because we create a synchronous interface, create the service-interface as following:

Mode: Syncron

Category: Outbound

Add the Request and Response-Structures which you created in the step before.
You should get something like that:

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


6

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

The Message Mappings (request and response)


Now create the message mappings as usual.

Within the Mapping for the request you should use the imported RFC-Message as target.

When importing a RFC-Structure you should also get an <>.Response Message. This is the
source of you response Mapping

The <>.Exception Message could use for error handling. This is not always a must, it depends if
you RFC-Call can rise an excepton.

The Operation Mapping


Create the operations mapping as usual, but

choose your synchronous interface as source-interface

choose the imported rfc-structure as destination-interface

As soon as you save your operations mapping you'll get two tabs: Request and Response. Choose the right
one of your message mappings there:

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


7

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Configurations within Integration Directory (integration builder)


Create a sender channel for the web-service:

Type: SOAP

Quality of Service: Best Effort

Create a sender agreement for this sender-channel.


Create a receiver determination as usual.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


8

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Create a receiver communications channel for executing the RFC-Call in the ABAP stack:

Type: RFC

enter all ABAP-Parameters as necessary

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


9

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

WSDL?
Within the sender agreement you can choose in the menu:
Sender agreement show WSDL
Please use only this WSDL because all others (there are many places within the PI where you can create
one!!) are not complete.

Tests, Troubleshooting
Now you can use the WSDL with any usable Webservice Client (i.E. Netweaver Developer Studio).
Alternative you can also go to
http://<host>:<port>/wsnavigator
where host is your PI hostname and port your Java-WAS port
Here you can enter the WSDL-URL as shown within the Sender Agreement and test the WSDL.
Normally synchronous calls which are successfully are not shown with PI Transaction SXMB_MONI, but you
can set the following parameters within Integration Engine - Administration (TA SXMB_ADM):

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


10

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Related Content
Reference 1: How to publish PI webservice for wsdl
Reference 2: XI Adapter Notes Have a look at SOAP-Adapter
Reference 3: Example WSDL File
Reference 4: xmlnodeparser (Sourceforge) Lightweight Java SOAP-Client, even for Java-Mobile

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


11

How to Wrap any ABAP-RFC-Call into a Web Service Using PI 7.x

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


12

You might also like