骑着毛驴追火箭 发表于 2013-2-3 14:15:34

网上找了个 webservice_helper .php 不知这个webservice_helper怎么用

本帖最后由 骑着毛驴追火箭 于 2013-2-3 14:43 编辑


<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

      
         //密钥
         functionget_encryt_key(){
               return "64faa1e027c38d257f24889c070f45f8";
             }
            
             //获取通信密码
             function get_safty_key(){
                return "b72533da894024113d642496bfb42f83";
             }
      

      if(!function_exists("call_web_service")){
                /**
               * 调用webservice,方法集
               * @param unknown_type $locationwebservice的url
               * @param unknown_type $method    方法名
               * @param unknown_type $params    传递给该方法的参数,可能包含通信密码
               */
                function call_web_service($location,$method,$params){
                        $soap_client=new SoapClient(null,array("location"=>$location,"uri"=>$location));
                        return      $soap_client->__soapCall($method,$params);
                }      
      }
      
      if(!function_exists("get_web_service_class")){
                /**
               * 获得以类作为webservice的一个远程对象
               */
                function get_web_service_class($url){
                        $soap_client=new SoapClient(null,array("location"=>$url,"uri"=>$url));
                        return $soap_client;
                }
      }
      
      
      if(!function_exists("get_touch_encrypt_key")){
                /**
               * 获得通信密码
               */
                function get_touch_encrypt_key(){
                        $ci=& get_instance();
                        $ci->load->library("syscrypt",array(get_encryt_key()));
                        return $ci->syscrypt->php_encrypt(get_safty_key());
                }
      
      }
      
      /**
         * 建立若干个方法的webservice
         */
      if(!function_exists("create_web_service")){
                function create_web_service($uri,$methods=array()){
                        $soap_server=new SoapServer(null,array("uri"=>$uri));
                        foreach ($methods as $key=>$val) {
                              if(function_exists($val)){
                                        $soap_server->addFunction($val);
                              }else{
                                        show_error("the funciton you want to created in the web service can not find!");
                              }
                        }
                        $soap_server->handle();
                }
      }
      
      /**
         * 建立若干个方法的webservice
         */
      if(!function_exists("create_web_service_class")){
                function create_web_service_class($uri,$c){
                        $soap_server=new SoapServer(null,array("uri"=>$uri));
                        if(class_exists($c)){
                              $soap_server->setClass($c);
                        }else{
                              show_error("the class you want to created in the web service can not find!");
                        }
                        $soap_server->handle();
                }
      }
      
      
/**
$soap_client=new SoapClient(null,array("location"=>"file:///C:\Users\DEVINS~1.ING\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.pnghttp://192.168.1.110:9898/index.php/share/service",
    "uri"=>"file:///C:\Users\DEVINS~1.ING\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.pnghttp://192.168.1.110:9898/index.php/share/service"));
$syscrypt=new SysCrypt("64faa1e027c38d257f24889c070f45f8");
$key=$syscrypt->php_encrypt("b72533da894024113d642496bfb42f83");    //通信密码
$params1 = array($key,"xxx");
$reversed = $soap_client->__soapCall('get_frequence',$params1);
**/



网上找了个webservice_helper .php 不知这个webservice_helper怎么用
求助大吓,非常感谢 ,本人对php不熟悉,求解



骑着毛驴追火箭 发表于 2013-2-3 14:33:47

求助呀,怎么群里没有人呀回答呀

楓閒殘月 发表于 2013-2-3 14:50:07

看着函数调用就是了。。。想要干啥就直接调用。。

骑着毛驴追火箭 发表于 2013-2-3 14:55:52

楓閒殘月 发表于 2013-2-3 14:50 static/image/common/back.gif
看着函数调用就是了。。。想要干啥就直接调用。。

回,谢谢了

yunnysunny 发表于 2013-2-4 09:23:32

这个是soap类型的webservice,现实应用中,这种类型的webservice因为太过复杂,用的正在逐渐减少,rest类型的webservice正在逐渐增多。

骑着毛驴追火箭 发表于 2013-2-4 10:04:52

yunnysunny 发表于 2013-2-4 09:23 static/image/common/back.gif
这个是soap类型的webservice,现实应用中,这种类型的webservice因为太过复杂,用的正在逐渐减少,rest类型 ...

不太清楚这种类型的在CI框架中怎么调用,怎么用,求帮助

yunnysunny 发表于 2013-2-5 12:50:14

骑着毛驴追火箭 发表于 2013-2-4 10:04 static/image/common/back.gif
不太清楚这种类型的在CI框架中怎么调用,怎么用,求帮助

首先得清除提供服务的,是用的什么技术,然后你这边才能相应采取措施。
页: [1]
查看完整版本: 网上找了个 webservice_helper .php 不知这个webservice_helper怎么用