Consuming WCF Service with PHP
I would like to consume WCF service (created by ASP .NET) with PHP. I do not usually develop with PHP but I know it well enough to write my code by examples or references. In the end - it's like any other language I know. I am not heavily experienced with web services but I created some clients in Java and ASP before. So, I need to find a simple but good solution in PHP to consume the Service.svc file. I tried SOAP extensions but they do not recognize "definitions" in the XML because the structure is like so:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?><feed xml:base="http://site.com/Service.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataserv开发者_如何学Cices/metadata" xmlns="http://www.w3.org/2005/Atom"><title type="text">Title Text</title><id>http://site.com/Service.svc/Buildings</id><updated>2011-02-21T00:50:19Z</updated><link rel="self" title="Buildings" href="Buildings" /><entry><id>http://site.com/Service.svc/Buildings(1234)</id><title type="text"></title><updated>2011-02-21T00:50:19Z</updated><author><name /></author><link rel="edit" title="Building" href="Buildings(1234)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Townhouses" type="application/atom+xml;type=feed" title="Townhouses" href="Buildings(1234)/Townhouses" /><category term="SiteModel.Building" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><content type="application/xml"><m:properties><d:BuildingID m:type="Edm.Int32">1234</d:BuildingID><d:BuildingName></d:BuildingName><d:Address>123 Main Street</d:Address> ETC...
So it's an Atom file. Also, parser related question. How to handle "links" for each item? The item may have links to "files" i.e. images and they would need to be retrieved for each item. I suspect I need a parser to make request main file and make all necessary requests to get images? Please explain how to handle it or recommend existing solutions which can ease my work.
Thank you.
Zend Framework's atom feed reader will parse this feed easily.
http://framework.zend.com/manual/en/zend.feed.consuming-atom.html
精彩评论