ThinkPhp调用webservice,thinkphpwebservice
程序员文章站
2024-01-23 11:26:04
...
ThinkPhp调用webservice,thinkphpwebservice
模板页:
1 DOCTYPE html> 2 html> 3 head> 4 meta charset="UTF-8"> 5 title>Insert title heretitle> 6 script type="text/javascript" src="../Public/jquery-1.8.0.min.js">script> 7 script type="text/javascript"> 8 $(function() { 9 var OCXobj = document.getElementById("PlayViewOCX"); 10 OCXobj.SetOcxMode(0); 11 $.ajax({ 12 //要用post方式 13 type : "Post", 14 //方法所在页面和方法名 15 url : "../Home/User/GetPreViewXml", 16 success : function(data) { 17 //返回的数据用data.d获取内容 18 if (data) { 19 OCXobj.StartTask_Preview_InWnd(data, 0); 20 } 21 }, 22 error : function(err) { 23 alert("调用webservice过程中发生了错误!"); 24 } 25 }); 26 }); 2738 script> 39 head> 40 body> 41 42 input id='previewXml' value='{$previewXml}' type='hidden' /> 43 div> 44 input type="button" value="开始预览" 45 id="StartPlayView" /> br /> 46 div style="width: 750px; float: left; overflow: hidden"> 47 br /> 48 49 object classid="clsid:D5E14042-7BF6-4E24-8B01-2F453E8154D7" 50 id="PlayViewOCX" width="750" height="450" name="ocx"> object> 51 div> 52 div> 53 body> 54 html>
控制器代码:
1 function GetPreViewXml() 2 { 3 $client = new \SoapClient("http://192.168.1.113/services/CmsService?wsdl"); 4 $funs = array( 5 $client->__getFunctions() 6 ); 7 8 $userLogin = new \stdClass(); 9 $userLogin->userName = 'admin'; 10 $userLogin->pwd = '5B9BD37AE194BCE2D53666BCB9D99B01'; 11 $userLogin->clientIp = '192.168.1.105'; 12 $userLogin->clientPort = '80'; 13 $userLogin->cmsUrl = 'http://192.168.1.113'; 14 15 $loginResponse = $client->__call("userLogin", array( 16 $userLogin 17 )); 18 19 $getCameraInfoByDeviceInfo = new \stdClass(); 20 $getCameraInfoByDeviceInfo->indexCode = 2; 21 $getCameraInfoByDeviceInfo->sessionId = $loginResponse->return->sessionId; 22 $getCameraInfoByDeviceInfoResponse = $client->__call("getCameraInfoByDeviceInfo", array( 23 $getCameraInfoByDeviceInfo 24 )); 25 26 $getPreviewParam = new \stdClass(); 27 $getPreviewParam->sessionId = $loginResponse->return->sessionId; 28 $cameraArray = $getCameraInfoByDeviceInfoResponse->return->cameraArray; 29 $cameraIndexCode = ''; 30 if (is_array($cameraArray)) { 31 $cameraIndexCode = $cameraArray[0]->indexCode; 32 } else { 33 $cameraIndexCode = $cameraArray->indexCode; 34 } 35 $getPreviewParam->cameraIndexCode = $cameraIndexCode; 36 37 $getPreviewParamResponse = $client->__call("getPreviewParam", array( 38 $getPreviewParam 39 )); 40 41 $this->ajaxReturn($getPreviewParamResponse->return->previewXml); 42 } View Code上一篇: 220/09/07笔试cvte知识点
下一篇: CVTE二面问题汇总
推荐阅读
-
ThinkPhp调用webservice,thinkphpwebservice
-
PHP调用.NET的WebService 简单实例,.netwebservice_PHP教程
-
thinkphp-用weiphp开发微信如何在代码中调用文本回复?然后如何获取用户输入的内容?
-
怎么用PHP调用WebService
-
ThinkPHP里common.php里方法调用有关问题
-
Thinkphp如何调用数据库中表前缀不同的数据表
-
php使用NuSoap产生webservice结合WSDL让asp.net调用_PHP教程
-
ThinkPHP调用百度翻译类实现在线翻译
-
PHP使用SOAP调用.net的WebService问题
-
php怎么调用.net的webservice?100分送上