...

View Full Version : Using PHP to consume web services/parse XML



chornbeck
02-28-2008, 01:05 AM
I'm having a little trouble understanding this from a theoretical perspective, wondering if anyone could provide some insight. I have little experience with web services, but have a set of them I need to make operational..

Here's the scenario (this is all theoretical for now):

1. Simple HTML form feeds form data to webservice.asmx via http POST for processing

2. webservice.asmx returns an XML data set

I'm questioning when I get the chance parse the XML, instead of having it directly displayed upon execution of the webservice. I'm assuming the webservice will return a simple XML page...

How can I get the webservice to return the xml to a page that can parse the xml (with php), as opposed to just displaying the xml (which is what it looks like happens currently)?

I figure I can get it done with AJAX, because the asynchronous nature of the requests makes more sense to me in this circumstance, but I suck at the syntax, so here I am looking for a PHP solution...

Help is appreciated!

oesxyl
02-28-2008, 01:31 AM
WS is not for presentation.



A Web service is a software system designed to support interoperable machine-to-machine interaction over a network


This is probably what you need:

http://www.w3.org/TR/ws-arch/#whatis

xml is for data exchange between service provider and agent using soap.

look also to this:

http://www.w3.org/TR/2004/NOTE-ws-arch-scenarios-20040211/#Cases

I hope this help.

best regards

chornbeck
02-28-2008, 01:36 AM
I guess what I'm asking then is, can I build an agent to send requests and process the xml that is returned from the web service?

I can obviously send a simple HTTP POST request to the web service with my script, I'm just trying to figure out how to process what the service gives back to me...

Or am I just completely confused? :)

oesxyl
02-28-2008, 02:00 AM
I guess what I'm asking then is, can I build an agent to send requests and process the xml that is returned from the web service?

I can obviously send a simple HTTP POST request to the web service with my script, I'm just trying to figure out how to process what the service gives back to me...

Or am I just completely confused? :)
you can use soap php extension:

http://www.php.net/manual/en/ref.soap.php

I guess you must dig a little into the soap and wsdl recomandation and make some experiments. You have two links to soap 1.2 and wsdl 1.1 on the page with php soap extension.
Also you could find very good articles about both on the

http://xml.com/

left column, look for web services

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum