原文:
php中soap的使用例子
php 使用soap有兩種方式。
一、用wsdl檔案
伺服器端。
<?phpclass
service
public
function
add($a,$b)
}$server=new
soapserver('soap.wsdl',array('soap_version' => soap_1_2));
$server->setclass("service");
$server->handle();
?>
資源描述檔案,可以用工具(zend studio)生成。其實就是乙個xml檔案。
<?xml version="1.0" encoding="utf-8"?>
客戶端呼叫
二、不用wsdl檔案
伺服器端
<?phpclass service
public function add($a,$b)
}$server=new soapserver(null,array('uri' => "abcd"));
$server->setclass("service");
$server->handle();
?>
客戶端
<?phptrycatch(exction $e)
?>
PHP 使用SOAP實現WEB SERVICE
文章摘自 例項部分做了改動。php有兩個擴充套件可以實現web service,乙個是nusoap,乙個是php 官方的soap擴充套件,由於soap是官方的,所以我們這裡以soap來實現web service.由於預設是沒有開啟soap擴充套件的,所以自己先看一下soap擴充套件有沒有開啟。在so...
使用PHP的soap擴充套件, 進行wdsl操作
本文是乙個使用php soap訪問webservice的例子.wsdl檔案請見 這個 裡面有很多好用的伺服器.大部分可以免費使用,有一部分要收費.以中文簡繁轉換為例.簡繁轉換的wsdl檔案位址為 下面是php 其中有說明.wsdl 以wsdl方式,例項化類.soap new soapclient w...
PHP 使用soap有兩種方式。
一 用wsdl檔案 伺服器端。class service public function add a,b server new soapserver soap.wsdl array soap version soap 1 2 server setclass service server handle...