一、SoapServer 服务器

1、__construct
作用:创建 SoapServer 对象
用法:__construct ( mixed wsdl [, array options] )
参数:wsdl 文件地址,options soap_version,encoding,actor,classmap
返回:对象

2、addFunction
作用:为客户端导出一个或多个函数
用法:addFunction ( mixed functions )
参数:functions 函数,一个或多个,全部 SOAP_FUNCTIONS_ALL
返回:无

3、getFunctions
作用:获取全部函数
用法:getFunctions ()
参数:无
返回:函数数组

4、setClass
作用:导出类中的全部函数
用法:setClass ( string class_name [, mixed args [, mixed ...]]
)
参数:class_name 类名 args 参数
返回:无

5、setPersistence
作用:允许保存在PHP之间的会话请求数据
用法:setPersistence ( int mode )
参数:mode SOAP_PERSISTENCE_SESSION SOAP_PERSISTENCE_REQUEST
返回:无

6、fault
作用:允许保存在PHP之间的会话请求数据
用法:fault ( string code, string string [, string actor [, mixed
details [, string name]]] )
参数:code 错误代码 string 简短错误信息 actor 导致错误的字符串 details 错误详细信息
返回:无

7、handle ( [string soap_request] )
作用:处理一个SOAP请求,调用必要的功能,并发送回一个响应。
用法:handle ( [string soap_request] )
参数:soap_request 请求
返回:无

二、SoapClient 客户端

1、__construct
作用:创建 SoapClient 对象
用法:__construct ( mixed wsdl [, array options] )
参数:wsdl 文件地址 或 null,
options
a、soap_version soap版本,encoding 编码,compression 压缩,classmap
b、http身份验证 :login , password
c、代理服务:proxy_host, proxy_port, proxy_login and proxy_password
d、证书验证:local_cert , passphrase
e、wsdl 为null 时:location , uri
返回:对象

2、__call
作用:调用函数
用法:__call ( string function_name, array arguments [, array options
[, array input_headers [, array output_headers]]] )
参数:function_name,arguments
返回:无

3、__doRequest
作用:在执行HTTP请求
用法:__doRequest ( string request, string location, string action,
int version [, int one_way] )
参数:request XML的SOAP请求 location 请求地址 action ,version
返回:字符串

4、__getFunctions
作用:获取全部方法
用法:__getFunctions( )
参数:无
返回:函数数组

5、__getFunctions
作用:获取全部方法
用法:__getFunctions( )
参数:无
返回:函数数组

6、__setCookie
作用:设置cookie
用法:__setCookie ( string name [, string value] )
参数:name cookie名称 value cookie值
返回:无

7、__getLastRequest
作用:获取最后的请求
用法:__getLastRequest ()
参数:无
返回:最后的请求

8、__getLastRequestHeaders
作用:获取最后的请求头部信息
用法:__getLastRequestHeaders ()
参数:无
返回:最后的请求头部信息

9、__getLastResponse
作用:获取最后的回应
用法:__getLastRequest ()
参数:无
返回:最后的请求回应

10、__getLastResponseHeaders
作用:获取最后的回应头部信息
用法:__getLastResponseHeaders ()
参数:无
返回:最后的回应头部信息

三、SoapVar 参数

1、__construct
作用:创建 SoapVar 对象
用法:__construct ( mixed data, int encoding [, string type_name [,
string type_namespace [, string node_name [, string
node_namespace]]]] )
参数:data 数据,encoding 编码
返回:参数对象

四、SoapParam 参数

1、__construct
作用:创建 SoapParam 对象
用法:__construct ( mixed data, string name )
参数:data 传递的变量,name 变量的值
返回:参数对象

__construct ( string namespace, string name [, mixed data [,
bool mustUnderstand [, mixed actor]]] )

五、SoapHeader 头部

1、__construct
作用:创建 SoapHeade 对象
用法:__construct ( string namespace, string name [, mixed data [,
bool mustUnderstand [, mixed actor]]] )
参数: namespace 命名空间 name SOAP 头标签名称 ,data 头部内容
返回:对象

六、SoapFault 头部

1、__construct
作用:创建 SoapFault 对象
用法:__construct ( string faultcode, string faultstring [, string
faultactor [, mixed detail [, string faultname [, SoapHeader
headerfault]]]] )
参数: faultcode 错误代码,faultstring 错误信息 ,faultactor 导致错误字符串,detail
错误详情
返回:对象

七、例子

1、定义一个类

<?php

    class  Culculator
{
public function sum( $x , $y )
{
return $x + $y ;
}
} class Culculator
{
public function sum($x,$y)
{
return $x + $y;
}
} ?>

2、使用Zend Studio生成wsdl文件;

3、SOAP 服务器端 (server.php)

<?php

    require   './Culculator.php' ;  

    $server  = newSoapServer( './wps.wsdl' );
$server ->setClass( 'Culculator' );
$server ->handle(); require './Culculator.php'; $server = newSoapServer('./wps.wsdl');
$server->setClass('Culculator');
$server->handle(); ?>

3、SOAP 客户端(client.php)

<?php

    $soap  = newSoapClient( './wps.wsdl' );
echo $soap ->sum(1,2);
//运行输出 3
?>

PHP SOAP 教程的更多相关文章

  1. Soap 教程

    SOAP 构建模块 一条 SOAP 消息就是一个普通的 XML 文档,包含下列元素: · 必需的 Envelope 元素,可把此 XML 文档标识为一条 SOAP 消息 · 可选的 Header 元素 ...

  2. W3Cschool菜鸟教程离线版下载链接

    请在电脑上打开以下链接进行下载w3cschool 离线版(chm):http://pan.baidu.com/s/1bniwRCV(最新,2014年10月21日更新)w3cschool 离线版(htm ...

  3. C#使用SOAP调用Web Service

    程序代码 using System;using System.IO;using System.Net;using System.Text; namespace ConsoleApplication1{ ...

  4. w3school教程整理

    原文链接:http://www.flygon.net/w3school 原文链接:https://github.com/wizardforcel/w3school w3school教程整理 离线版大部 ...

  5. Spring Boot SOAP Webservice例子

    前言 本文将学习如何利用Spring boot快速创建SOAP webservice服务: 虽然目前REST和微服务越来越流行,但是SOAP在某些情况下,仍然有它的用武之地: 在本篇 spring b ...

  6. Web Services 教程

    Web Services 可使您的应用程序成为 Web 应用程序. Web Services 通过 Web 进行发布.查找和使用. Web Services 是应用程序组件 Web Services  ...

  7. W3School 教程整理

    离线版大部分整理自 w3cschool ,少部分整理自 w3school ,由本人整理. 感谢 w3cschool 站长的无私奉献. 由于本人精力有限,此处的列表不一定能够及时更新,最新版本请到本人博 ...

  8. 硅谷新闻2--禁止viewpager预加载

    ContentFragment.java class MyOnPageChangeListener implements ViewPager.OnPageChangeListener { ..... ...

  9. [转]【eoeAndroid索引】史上最牛最全android开发知识汇总

    一.开发环境搭建 (已完成) 负责人:kris 状态:已完成 所整理标签为:搭建 SDK JDK NDK Eclipse ADT 模拟器 AVD 调试器(DEBUG) DDMS 测试 日志 Logca ...

随机推荐

  1. Windows下绿色版Tomcat部署Thingworx 7.4

    绿色版Tomcat部署Thingworx7.4和安装只有一个不同之处,安装版Tomcat需要在Configure Tomcat的Java标签下设置Java Options,但是绿色版并没有这个exe程 ...

  2. ZBrush中Flatten展平笔刷介绍

    本文我们来介绍ZBrush®中的Flatten展平笔刷,Flatten笔刷能增加粗糙的平面在模型表面,利用它能够制作出完全的平面. Flatten展平笔刷 Flatten(展平):Flatten笔刷可 ...

  3. 脚本_统计每个远程IP访问本机apache的次数

    #!bin/bash#功能:统计每个远程IP访问本机apache的次数#作者:liusingbonawk '{ip[$1]++} END{for(i in ip){print ip[i],i}}'  ...

  4. Pyhton学习——Day9(阶段性练习)

    # 1.文件内容如下,标题为:姓名,性别,年纪,薪资## egon male 18 3000# alex male 38 30000# wupeiqi female 28 20000# yuanhao ...

  5. 04 SqlServer

    数据库的注释 –(两个横线) 主键表 外键表 主键,组合主键 SqlServer 使用附加 权限 主文件mdf 日志文件ldf 数据类型 char varchar nchar nvarchar cha ...

  6. 小学生都能学会的python(编码 and 字符串)

    小学生都能学会的python(编码 and 字符串) 一,编码 最早的计算机编码是ASCII. 有英文+数字+特殊字符 8bit => 1byte 没有中文, 后面的编码必须兼容ASCII    ...

  7. linux上重启jboss服务器

    ps -ef|grep jboss  :查看当前jboss进程 kill -9 进程id         :杀掉进程,kill -9发送的信号是SIGKILL,即exit.exit信号不会被系统阻塞 ...

  8. STM32 关于头文件路径没添加错误问题(cannot open source input file "spi.h": No such file or directory)

    error:  #5: cannot open source input file "spi.h": No such file or directory 1.出现这种问题,首先要确 ...

  9. vue路由传值params和query的区别

    vue路由传值params和query的区别1.query传参和接收参数传参: this.$router.push({ path:'/xxx' query:{ id:id } })接收参数: this ...

  10. linux中fork()函数详解(搬砖)

    一.fork入门知识 一个进程,包括代码.数据和分配给进程的资源.fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程,也就是两个进程可以做完全相同的事,但如果初始参数或者传入的变量不同, ...