Most of Enterprise Mobile Applications need to display large enterprise data generally stored on SAP Systems. For HTML5 Apps, data is accessed by making an AJAX call to the Website and which goes through only if the domain on which the AJAX call is made and the domain to which AJAX call is made, are same.
In such scenario, a simple PROXY can solve the issue. In simple words, we can develop a PHP Layer over our SAP Backend, which it self calls SAP Web-Service, collects the response and as it is echos it to the application.
Below is a sample code for PROXY file in PHP
<?php
define ('HOSTNAME', 'http://LinkToYour.Url');
define ('USERNAME', 'TEST');
define ('PASSWORD', 'TEST');
$path = $_GET['path'];
$request = HOSTNAME.$path;
$ch = curl_init($request);
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_USERPWD, USERNAME . ":" . PASSWORD);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //REQUIRED for HTTPS
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($ch);
header("Content-Type: text/xml");
echo $xml;
curl_close($session);
?>