EmmyS
EmmyS

Reputation: 12148

Getting started with SOAP

A site I developed has a new requirement to get weather data from the National Weather Service. They have quite a bit of info on how to use SOAP to get their data and display it in the browser, but what we need to do is use a cron job to get the data at specific intervals, then parse the data out into a database.

I have no problem writing PHP code that will run an XSLt and parse xml records out into SQL queries, but I have no idea how to handle this with SOAP (which I've never worked with.) Do I get the data via a SOAP request, save it to an XML file on my web server, then run the XSLt against that? Or is there some other way to go about this?

Upvotes: 0

Views: 841

Answers (2)

afarouk
afarouk

Reputation: 3

I am not a PHP expert, but the following is a simple tutorial for writing Soap Servers and Clients in PHP. I guess you will run the PHP script using the command line interface.

http://onlamp.com/pub/a/php/2007/07/26/php-web-services.html?page=2

But if you are running a cron job, other languages may be better. PHP's soap support is not well documented.

Upvotes: 0

Cratylus
Cratylus

Reputation: 54094

For the web service call, the HTTP response payload will contain a SOAP envelope encapsulating the application response.
Basically the whole HTTP response is XML, the SOAP part and the application data.

<soap>
     <header></header><!--Optional-->
     <body>
        <applicationData>
        </applicationData>
     </body>
</soap>

So you only need get the child of body to have the xml fragment that encapsulates the application data for your service and work on this.
There can be only 1 child element of body per WS-Profile BP specification.
Hopefully this helps

Upvotes: 1

Related Questions