开发者

Getting started with SOAP

开发者 https://www.devze.com 2023-02-11 19:04 出处:网络
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 th

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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号