Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos
Introduction
Last week prakash.singh4/blog in Create a weather magnet  using xml feed from weather.com and then thomas.jung3/blog in BSP: Create a weather magnet using xml feed from weather.com created Weather Magnets based on the Weather.com XML service. Craig Cmehill threw the gauntlet into the PHP group to rise to the challenge.

It was pointed out that PHP already has free scripts available via a simple search that access this interface. Therefore to make the implementation a little more relevant and provide reuse of almost everything Thomas implemented, the following solution builds on Thomas' example and uses ABAP to process the XML feed. PHP then uses a remote enabled function module via a SOAP call to get the transformed HTML.

PHP Code

"ASTILL", 'trace' => 1, "password" => "password") ); $res = array(); $res = $client->ZJA_WEATHER(); echo $res->RV_HTML; } catch (SoapFault $exception) { echo "

Exception
"; echo $exception; echo "

Request :
", htmlspecialchars($client->__getLastRequest()), "
"; echo "Response :
", htmlspecialchars($client->__getLastResponse()), "
"; } ?>

ABAP Function Module
This is essentially the same code that Thomas created in the OnInitialization Event Handler for his BSP. It has been copied into a remote enabled function module with the location ID coming in as an input parameter and the HTML going out as a return.
The stylesheet for the transformation is also essentially the same as the original file. The only concession is that the images are referenced on the PHP server, thus when the translation is performed and the HTML output, the paths to the images are the paths on the PHP server not the WebAS.

wsdl file
The WSDL file was taken directly from the service browser entry, no manual intrvention was required.

3 Comments