1 Purpose
A Web service is a modularized, executable unit. It can be called in heterogeneous system landscapes and is not restricted to a single host system. Each output is determined based on the given input parameters. This output is then passed back to the caller. Web service is a software system designed to support interoperablemachine-to-machine interaction over a network.
For example, Web services can serve to perform a credit card check, convert a currency amount, send a price query to a provider, or simply to place an order. Also, industrial manufacturers can provide their customers, partners, and suppliers with Web services for implementation in their own programs in order to set up cross-system supply chain solutions.
This document will discuss two parts of a Web Service –
1. Consuming a web service
2. Creating a Web Service in SAP
2 Consuming a Web Service
To consume a Web service, we need to create the following:
a. Create proxy for the Web service in the ABAP Workbench using a WSDL document as a basis.
b. Then create a logical port to define the runtime features of the Web service client proxy. (This will be created by BASIS hence we will not be discussing it in this document)
c. Then to call the web service, create an ABAP program to provide input and get output.
2.1 To Create a Proxy
1. Go to Transaction SE80 -> Edit Object -> Enterprise services -> Create
2. Select External WSDL -> Continue
3. Select Local File -> Continue.
4. Input a location -> Continue -> ZES_ (Prefix) -> Continue
5. The creation of Proxy is Completed and Save and Activate, and Proxy is created.
2.2 Create a Logical Port
NA for SAP ABAP Development.
2.3 Program to call the Web Service
1. The structure of the proxy is :
2. Only Constructor and Retrieve methods can be called in the program to use the Web service.
3. Create References to Proxy class of ZES_XXXXXX
- Data – LO_TIME TYPE REF TO ZES_XXXXXX
4. Create References to Input structure of Retrieve class
5. Create References to Output structure of Retrieve Class
6. Create object for proxy class reference created in step 3
7. Assign values to the input structure created to be used in the Retrieve class
8. Call RETRIEVE method of proxy class and provide input and output structures.
3. Creating a Web Service
- Create a FM, say ‘YFM_CREATE_WEB_SERVICE_TEST’ which is RFC Enabled.
- Go to Utilities -> More Utilities -> Create Web Service -> From the Function Module
3. Enter Web Service name and Description, and Continue.
4. Check Map Name -> Continue
If the checkbox Name Mapping is ticked, the wizard accepts the existing names for the end point
5. Choose approriate input -> Continue .
6. Tick Local object ->Continue
7. Click on Complete.
8. The Web Service has been created and now activate it.
9. Now, to test the Web Service
Press F8 -> Choose Generate Request Template -> Execute -> Execute the Request -> Output Successfully recieved
Call Successful: