【问题标题】:Consuming WCF Service with PHP使用 PHP 使用 WCF 服务
【发布时间】:2011-02-21 01:09:23
【问题描述】:

我想使用 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 文件。另外,解析器相关的问题。如何处理每个项目的“链接”?该项目可能具有指向“文件”的链接,即图像,并且需要为每个项目检索它们。我怀疑我需要一个解析器来发出请求主文件并发出所有必要的请求来获取图像?请解释如何处理它或推荐可以减轻我工作的现有解决方案。

谢谢。

【问题讨论】:

    标签: php web-services wcf atom-feed


    【解决方案1】:

    Zend Framework 的原子提要阅读器将轻松解析此提要。

    http://framework.zend.com/manual/en/zend.feed.consuming-atom.html

    【讨论】:

    • 谢谢。这个框架是否需要安装一些服务器配置?我不确定我是否可以通过我的第三方托管服务提供商做到这一点。
    • 无需服务器配置(Zend Framework 是模块化的),只需将所需的库下载到您的服务器,包含它并按照文档中的示例运行代码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 1970-01-01
    • 1970-01-01
    • 2019-03-25
    相关资源
    最近更新 更多