PHP SAP communication
This document refers the Moodle installation in windows system and enabling the SOAP web service for PHP and communicating with SAP. In this document we are going to communicate with SAP from PHP program using Moodle database. We are not using Moodle web services here for sap communication. This document contains process of fetching student details from sap system to Moodle database using background job. This background job will execute recurrently depend on our requirement.
This document also contains additional program steps used in php to get data from SAP. Back ground job will run using software moodle_cron. Moodle_cron is a small software which will do background jobs based on time interval what we mention. You can download moodle_cron.exe form the site.
To install Moodle in windows system below are the prerequisites.
- Xampp latest version setup files(xampp is bundle of Apache server and MySQL database you can download from Here)
Enabling web services in xampp server
To Communicate with SAP we use SOAP web service. Below is the process to enable SOAP web service in PHP.
- To enable SOAP module open php.ini file form the path C:\xampp\php
- Search for the line “extension=php_soap.dll” in php.ini if not exists add it under Dynamic Extension. If already present uncomment it by removing ; symbol in front of the line.
- Restart the Apache server.
- After restarting the server open phpinfo () page from local host link looks like: http://localhost/xampp/ left side in the menu select the phpinfo ().
- Check in the page soap module enables or not as shown in the below figure.
Setting up SOAP in SAP and Connecting with PHP
For more information see the YouTube video: http://www.youtube.com/watch?v=GG85rUbhXMg&feature=player_embeddedSAP Setup
In transaction SICF active the following services
- Create your function modules in SE80/ SE37don’t forget these must be remote-enabled
- Create webservice from that function module by right clicking on the function module and create -> web service and follow the instructions
- Optionally Create Service User.
- From within the transaction soamanager:
Business administration – Web Service Administration.
- Find your web service and choose the Overview Tab. Get the WSDL URL from the link “Open WSDL document for selected binding” http://www.mattbartlett.co.uk/wp-content/uploads/2011/12/overview-wsdl-url.png
Optionally you can also setup authentication here.
Run PHP code by calling WSDL link