Author: Avinash Palavai, SAP Technical Consultant, Atos India Pvt. Ltd.
This article demonstrates the entire process of creation and consuming of a WebService in SAP ABAP.
There are few changes made by SAP in the screens of transactions like SOAMANAGER, that we see in the process of configuring the WebService definition and the transaction LPCONFIG, which is used to create the logical port in the process of consuming the WebService is obsolete.
Now we come across this information message, when we run the transaction LPCONFIG,
So, this article helps out in following the new SAP screens and an alternative process of creating the logical port, rather than using the transaction LPCONFIG.
The entire article is divided into two parts,
- Creation of WebService and
- Consuming a WebService in ABAP.
PART – 1 :- Creation of WebService in SAP
1. Create an RFC. (Here I took an example of simple addition logic in the RFC).
2. Create a WebService from the above RFC.
3. It opens the following WebService creation wizard; enter the Service Definition name description.
4. Check the check box Map Name.
5. Select the security profile, which is the authentication method to be followed while consuming the WebService.
7. Click on complete. Now your WebService will be created.
8. Below is the service definition created and remember to activate it immediately.
9. Now this WebService has to be configured in SOA Management, to publish it.
Run the transaction “SOAMANAGER”, which would launch a Web Dynpro ABAP based SOA Management application in your Internet Browser.
10. Below is the SOA Management window. This screen has been modified by SAP. Now click on the WebService configuration link highlighted in orange color under the Service Administration tab.
11. Select your webservice and click on apply selection button.
12. Now the screen will be expanded with the part where the service has to be configured. Click on create under configurations tab.
13. A pop up will be opened. Enter the following details and click on apply settings ,
14. Now the screen will be extended with the part, where the authentication method has to be selected. Select User ID/Password under transport channel authentication and click on save.
15. The service definition has been configured.
16. Under the overview tab, click on “Show/ hide selected binding’s or services WSDL URL”, which would generate the WSDL link. Copy it locally.
PART – 2 :- Consuming a WebService in ABAP
- First create a consumer proxy as shown,
2. A consumer proxy creation wizard will be opened, select the Service Consumer.
3. Select the source as External WSDL.
4. Paste the WSDL URL copied locally in step 16 of part 1.
5. Save a give some prefix, to your proxy name.
6. Click on complete.
7. Service Consumer will be created and remember to activate it immediately.
8. Now the logical port has to be created. As the transaction LPCONFIG is obsolete, this can be done through the SOAMANAGER. Again run the SOAMANAGER and select the consumer proxy.
9. The screen will be extended, with a part to create the logical port. Click on create under configuration tab.
10. It will open a pop up to enter the logical port name and settings as follows. Under the WSDL location, enter the WSDL URL of the WebService to be consumed and the authentication credentials.
11. The logical port is created.
12.Now test the WebService by executing the service consumer from the SAP GUI by clicking on execute.
13. Enter the logical port created and execute.
14. Enter the values and execute.
15. Result will be displayed as,
16. Now create a program to consume the WebService in ABAP and execute.