Skip to Content
Introduction
Last week Prakash Singh in Create a weather magnet  using xml feed from weather.com and then Thomas Jung 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.

image

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.

To report this post you need to login first.

3 Comments

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

  1. Marilyn Pratt
    Nice work, John.
    For those of you who don’t know him, John Astill has helped raise the bar
    in the PHP forum.
    There’s a contest going on there as we speak.
    Looks like John has raced ahead to the finish line.
    Marilyn
    (0) 

Leave a Reply