使用 PHP 使用 WCF 服务
我想使用 PHP 来使用 WCF 服务(由 ASP .NET 创建)。我通常不使用 PHP 进行开发,但我非常了解它,可以通过示例或参考来编写我的代码。最后 - 它就像我所知道的任何其他语言一样。我对 Web 服务没有丰富的经验,但我之前用 Java 和 ASP 创建了一些客户端。因此,我需要在 PHP 中找到一个简单但良好的解决方案来使用 Service.svc 文件。 我尝试了 SOAP 扩展,但它们无法识别 XML 中的“定义”,因为结构如下所示:
<?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/dataservices/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...
所以它是一个 Atom 文件。另外,解析器相关的问题。如何处理每个项目的“链接”?该项目可能具有指向“文件”(即图像)的链接,并且需要为每个项目检索它们。我怀疑我需要一个解析器来发出请求主文件并发出所有必要的请求来获取图像?请解释如何处理它或推荐可以简化我的工作的现有解决方案。
谢谢。
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/dataservices/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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Zend Framework 的原子提要阅读器将轻松解析此提要。
http://framework.zend.com/manual/en/zend .feed.consuming-atom.html
Zend Framework's atom feed reader will parse this feed easily.
http://framework.zend.com/manual/en/zend.feed.consuming-atom.html