这段客户端soap请求和服务端回复,怎么写php的soap服务端?

vicallee vicallee 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
客户端请求:
POST /onvif/device_service HTTP/1.1
Host: 192.168.0.218
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>


服务端正确回复:
HTTP/1.1 200 Data follows
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2083
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrf_bf="http://tempuri.org/wsrf_bf.xsd" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrf_r="http://tempuri.org/wsrf_r.xsd" xmlns:event="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:nc="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:np="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:pps="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:psm="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics"><SOAP-ENV:Body><tds:GetDeviceInformationResponse><tds:Manufacturer>manufacture</tds:Manufacturer><tds:Model>IPCAM-A5</tds:Model><tds:FirmwareVersion>Jul--9-2012</tds:FirmwareVersion><tds:SerialNumber></tds:SerialNumber><tds:HardwareId>20100523-0001-0001-0001-122334455667</tds:HardwareId></tds:GetDeviceInformationResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>


我写的服务端:但没办法做到正确回复,总是提示找不到方法 ???

function GetDeviceInformation ()
{
return array (
'Manufacturer'=>'manufacture',
'Model'=>'IPCAM-A5',
'FirmwareVersion'=>'M-A5.222',
'SerialNumber'=>'54545454',
'HardwareId'=>'333333333333333');
}

header ("Content-Type: application/soap+xml; charset=utf-8");

$s = new SoapServer (null, '怎么写?');
$s->addFunction ("GetDeviceInformation");
$s->handler ();
...全文

相关推荐

PHP微信开发之微信消息自动回复下所遇到的坑

微信回复原理: 当普通微信用户向公众账号发送消息时,微信服务器首先收到用户发送的消息; 然后将用户信息和消息打包成XML格式的数据包,再将这个XML数据包通过POST方法提交到开发者设置的URL上。 疑问一:为何使用$GLOBALS[“HTTP_RAW_POST_DATA”]保存POST过来的数据,而非$_POST数组? 回答: POST只能保存标准的数据类型,对于XML、SOAP或Application/Octet-steam之类的内容则无法解析。 而$GLOBALS[“HTTP_RAW_POST_DATA”]和$_POST是一样的,如果POST过来的数据PHP能够识别,则可以用$GLOB

weixin_38732740

C#开发ONVIF客户端工具实战:统一接入海康大华等网络摄像头

在安防监控系统集成中,不同品牌网络摄像头(如海康、大华、宇视)的统一接入是常见需求。ONVIF标准协议解决了设备互联互通问题,开发者只需一套客户端代码即可兼容多厂商设备。本文深入剖析基于C#与.NET框架构建ONVIF客户端工具的全过程,涵盖WS-Discovery设备发现、SOAP/XML能力协商、UsernameToken与HTTP Digest认证机制、RTSP取流预览以及PTZ云台控制等核心模块。通过具体代码示例,讲解了PasswordDigest生成、GetCapabilities动态获取服务地址

weixin_33847182

php短信接口文档

php短息开发接口

qq_15143653

ISPConfig-Mail-Management:ISPConfig 简单的邮件管理面板

ISPConfig-邮件-管理 ISPConfig 简单的邮件管理面板 界面管理尽可能简单。 安装 设置所有变量 define("SALT", ""); // Random string must be unique (eg s7fd8CB5s2qq6) define("IMAP", "localhost"); // IMAP Server IP define("ADMIN_EMAIL", "admin@domain.tld"); // Email administrator for API errors define("LOGFILE", dirname( __FILE__) . DIRECTORY_SEPARATOR . "log.log"); // LOGFILE &#40;required write permission by current web user&#41; define("SOA

清净平常心

php面试题

php面试题,php试题,php考试,收集的php面试题,给要找工作的人带来方便之门。

lwh7610423
评论 11
收藏 已收藏
分享
返回顶部
vicallee
Framework 4,250 成员 4,522 内容