Skip to Content

Weather Magnet

Last week Prakash Singh in Create a weather magnet  using xml feed from and then Thomas Jung in BSP: Create a weather magnet using xml feed from created Weather Magnets based on the 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 “

“; 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.

You must be Logged on to comment or reply to a post.