Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
6,532

Introduction

This Document explains how to create web service using PHP, how to create proxy and Consuming the web service in SAP.

Prerequisites

To create a web service you need

1. WSDL editor like (Eclipse or Zend server or Altova).

2. Xampp/Wamp/Apache server with MySQL connections

3. SAP user id with all authorizations

Creating SOAP Web service in PHP

This section explains how to create a web service using php code. To create a WSDL file:

1. Open Zend Studio >> File menu >> New >> Other >> Web services >> WSDL.

2. Click next and name your wsdl file (let us name it as service.Wsdl) and select any parent directory to save this file.

3. In Target Namespace, type http://localhost/service/

4. Check Create WSDL Skelton and select SOAP for protocol drop down list, select rpc literal radio button and click finish.

5. Now you will see xml code. At the lower left corner of this xml, there are two tabs Design and Source. Click on the design tab.

6. In Service Soap box, type http://localhost/service.php

7. Rename New Operation to your function name in the above class (test)

8. Rename the input parameter from parameters to Val (this step is optional)

9. Save the wsdl file and move it from the project directory to /var/www(in xampp c:/xampp/htdocs/service)

10. As a test for your web-service, you can use something like this

Simple server.php code as follows

URL for your web service looks like: http://localhost/service/server.php?wsdl

“Note: When your consuming web service in SAP replace localhost with your system IP otherwise sap system will not recognize the web service URL like http://10.137.72.134/service/service.php?wsdl

Consuming Web service in SAP

This Section explains how to consume web service in SAP.

1. Login into sap

2. Goto transaction SE80

3. Right click on enterprise services -> Service Consume -> Right click and select Create

4. Opens popup in that select external wsdl click continue button.

5. Then select URL radio button and click continue

6. Give your web service URL and click continue.

7. Mention package and request/Task id click continue.

8. Popup open click enter

9. Final step click complete.

10. Save and activate the web service.

11. Now copy proxy name from proxy tab on right hand side.

12. Go to SOAMANAGER transaction it opens browser.

13. In the browser select web service configuration link

14. Search you web service by selecting Consumer Proxy from search by drop down menu.

15. In Search pattern give your proxy name which is copies in step 11.

16. Below it shows search results select and click apply selection button.

17. Below select Configuration tab

18. Click Create button in the pop up window fill all the details.

Like Logical port name description and give webservice URL.

19. Then save and activate the proxy. Copy the logical port name and come back to your SAP screen.

20. Then excute the web serivice

21. Give logical port and execute.

22. You will get xml screen. Click xml editor(cntrl+F2)

23. Replace string 1 with username it gives firstname.

6 Comments
Labels in this area