WSDL file in SAP – Part I

Normally when a third party calls SAP, it does an RFC function module or BAPI call through Middleware. They can also do direct web service calls thus by-passing Middleware. In such web service calls, WSDL files come into picture. WSDL is a file which is recognized by the third party as well as SAP.

Technically speaking this means there must be a SAP Web Service and then the third party has to communicate with this Web Service in some language (say .NET).

WSDL – What is it?

Definition : WSDL is the abbreviation of Web Service Definition Language. WSDL is a document written in XML. The document describes a Web service. It specifies the operations (or methods) the service exposes.

Some Scenario:

Every time anyone from the third party (say Online Shopping) does some expenditure or purchase, they need to call SAP for validation of some fields like, company code, cost center, G/L account etc and also to check for budget availability. Traditionally, that third party(Online Shopping) communicates with Middleware and Middleware in turn calls the RFC function module to do the validations in SAP. RFC function module in SAP returns relevant message to Middleware and Middleware communicates the same to the party (Online Shopping).

The above scenario works well and good. Suppose, in future, Middleware was to shut down and that party (Online Shopping) would interact directly with SAP. In such case, that party (Online Shopping) would not be able to call the RFC function module directly, thus, concept of WSDL file come into picture.

Solution:

Convert RFC / BAPI to WSDL and use it instead of RFC.

To create a Web Service in SAP we do not need to write any ABAP or Java code. We do not even need to have any prior knowledge of any other programming language.

For this we just need to run the Web Service Creation Wizard. We can select a BAPI or a Remote Function module in transaction SE37 or SE80 and start the Web Service Creation Wizard for it. The wizard directs step by step and creates a WSDL file for the RFC or the BAPI.

Please note: in order to create WSDL file, the function module must be an RFC function module. We cannot create WSDL for normal function modules.

Updated WSDL Creation Steps in SAP :

Go to transaction SE80. Open the function group and the RFC Function module for which you want to create the WSDL. For demo ZTESTWSDL RFC FM is considered.

Right click on the FM->Create->Web Service.

I have selected the No Authentication required Profile. You can choose any other as per your requirement from the drop down list.

Give the package, transport number and complete the wizard.

Once the wizard is complete, activate the service definition.

WSDL Configuration in SAP (Updated steps) :

Execute transaction SOAMANAGER and log into the SAP NetWeaver with your SAP userid and password.

Application and Scenario Communication Tab->Single Service Administration

Search for your Service. Select the row and hit Apply Selection button.

Go to Configuration->Create Service

Give the Service Name and the Binding Name and hit Apply Settings.

Select the suitable authentication and security option and Save it.

Check the service created should be in Active Status.

Now the WSDL configuration is complete and it should be ready to be exposed to the external system.

Go to Overview Tab and click on the link ’Open WSDL document for selected binding’. This will show the WSDL file.

Click the link ‘Display selected Binding’s WSDL URL’. Share this link to the external system for them to call.

ECC Role needed to access Web Service:

When the third party tries to call the URL (SAP WSDL), we might need to provide them a user id and password. The user for which the Web Service call is to be enabled should have the role ‘SAP_BC_WEBSERVICE_SERVICE_USER’. Check your role in t-code SU01.

Testing the WSDL:

In order to simulate whether the WSDL is working correctly or not, we can use some free/trial version of some software available in web. I have used soapUI demo version. Download the free trial version and install it.

Prerequisite: Save the WSDL(XML) file from SOAMANAGER at your desktop as .wsdl extension.

Execute the soapUI application which you have downloaded and installed.
Give a Project name and browse the wsdl file which you have saved at your desktop.

Click the Request 1 on the left hand side. Enter the SAP user id and password in the Request 1 middle sub-window area in Tab ‘Aut’ below. Then execute the ‘Submit request to specified endpoint URL’ button.

Enter the input parameter for the FM. The Output message ‘Response successful from SAP’ is the expected export parameter value from SAP FM. This shows the configuration is all correct and you have all authorization in place.

The below steps to generate WSDL and configuration steps are only for those users who are in ECC 5 version.

WSDL Creation Steps in SAP :

Go to transaction SE37. Open one RFC Function module. Go to Utilities —> More Utilities –> Create Web Service –> From the Function Module.

Here one RFC Function module ZFIFM_INT_BUDGET_AVAILABILITY is taken for demonstration.

A wizard opens. Press Continue.

Enter Service definition name (begin with Z) and short text and click Continue.

Check the Check Box and click Continue.

Select Profile: Basic Authorization: SOAP Profile and Check the check box and Click Continue.

WSDL is created. Press Complete.

Save in the desired package and CTS. Here it is saved as local object.

Web Service is created. Go to Transaction Code WSADMIN
Check for SOAP Application for RFC-Compliant FMs. Check the WSDL, Z_DEMO_WSDL we just created.

In order to display the WSDL file which is created, select the Z_DEMO_WSDL and press Ctrl+F1.

Pop up comes. Select Document Style.

Brower opens. Enter your SAP Log on USER ID and Password (same SAP user ID and password used for creation of the WSDL).

You will see the WSDL File. Copy the URL from the address bar or save the WSDL as file and the third party can use this WSDL.

Benefits of WSDL:

1) For Projects where any third party which normally cannot call RFCs or BAPIs but which can call Web Services can call the WSDL of these RFCs or BAPIs and meet the same functionality which the RFC or BAPI would have met.
2) Middleware can be by-passed.