昨天跟夢想家的 Emma 談到 Irose 前台改版成 PHP 的方案。
因為 Irose 採用 Mobocash 的 Web Service 來執行付款機制,但是 PHP 早期並沒有內建 SOAP ,必須透過一些 3rd Party 的程式來呼叫 Web Service。
另外好消息是 PHP5 已經有內建 SOAP extension,官方發佈消息如下:
Some of the key features of PHP 5 include:
- The Zend Engine II with a new object model and dozens of new features.
- XML support has been completely redone in PHP 5, all extensions are now focused around the excellent libxml2 library ( http://www.xmlsoft.org/ ).
- A new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa.
- A brand new built-in SOAP extension for interoperability with Web Services.
- A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL’s new features, such as prepared statements.
- SQLite has been bundled with PHP. For more information on SQLite, please visit their website .
- Streams have been greatly improved, including the ability to access low-level socket operations on streams.
(以上資料來源: http://www.php.net/)
如果使用的是 PHP 4.3.0 以上,又不想用3rd Party的函式,可以參考這篇:
http://www.onlamp.com/pub/a/php/2003/10/30/amazon_rest.html
至於 PHP 早期的版本,比較有名的3rd Party 就屬 XML-RPC 跟 NuSOAP 了,XML-RPC 則是從 PHP 3 時代就能使用了,NuSOAP 目前到現在程式還是有在維護。
XML-RPC 官方網站
http://xmlrpc.usefulinc.com/php.html
XML-RPC SourceForge 網站
http://sourceforge.net/project/showfiles.php?group_id=34455
XML-RPC 使用範例:
http://php.weblogs.com/xml-rpc
NuSOAP 官方網站:
http://dietrich.ganx4.com/index.php?category=NuSOAP
NuSOAP 使用範例:
http://www.phpbuilder.com/columns/kramberger20031226.php3
XML-RPC 及 NuSOAP 使用範例:
http://www.xml.com/pub/a/ws/2004/03/24/phpws.html
在美國 Web Service 組織的網站中,可以找到 PHP 相關的資訊:
http://www.webservices.org/index.php/ws/content/search?SearchText=php
3 comments On PHP 的 Web Service Solution
實際上,PHP4 是可以使用 PEAR 來達到 SOAP connection,又或者使用 NuSOAP 來完成。
要建立 SOAP Server 的話,PHP4 就不是一個很好的選擇;
如果只是要建立 SOAP Client,PHP4 + PEAR 應該是不錯的。
Raymond 大哥:
沒想到您會上來留言,多謝您的補充喔! ^_^
http://tw2.php.net/manual/en/ref.soap.php
這個有人用過嗎?
我看不太懂
SoapClient 與 SoapServer 的區別
到底
如果php要在Server端寫一個類似ASP.NET的 asmx 的WebServices的話
該怎麼寫?