当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Soap_Client::getSoapClient方法代码示例

本文整理汇总了PHP中Zend_Soap_Client::getSoapClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Soap_Client::getSoapClient方法的具体用法?PHP Zend_Soap_Client::getSoapClient怎么用?PHP Zend_Soap_Client::getSoapClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Soap_Client的用法示例。


在下文中一共展示了Zend_Soap_Client::getSoapClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: performRequest

 public function performRequest($wsdl, $operation, $params, $options = array('encoding' => 'UTF-8'), $fullReponse = false)
 {
     if (!extension_loaded('soap')) {
         return 'Extension SOAP not found';
     }
     if (!isset($options['soap_version'])) {
         $options['soap_version'] = SOAP_1_1;
     }
     $client = new Zend_Soap_Client($wsdl, $options);
     $soap_params = array();
     foreach ($params as $param_name => $param_value) {
         preg_match('/^(.*)\\:(.*)$/', $param_name, $matches);
         if (count($matches) == 3) {
             if (!isset($soap_params[$matches[1]])) {
                 $soap_params[$matches[1]] = array();
             }
             $soap_params[$matches[1]][$matches[2]] = $param_value;
         } else {
             $soap_params[$param_name] = $param_value;
         }
     }
     try {
         // Set (Session) cookies before the call
         if ($this->allowCookies) {
             if (is_array($this->cookies)) {
                 foreach ($this->cookies as $cookieName => $cookieValue) {
                     $client->setCookie($cookieName, $cookieValue[0]);
                 }
             }
         }
         // Perform the SOAP request
         $result = call_user_func_array(array($client, $operation), $soap_params);
         // Pick up any new cookies from the server
         if ($this->allowCookies) {
             $last_response = $client->getLastResponseHeaders();
             $soapClt = $client->getSoapClient();
             $this->cookies = array_merge($soapClt->_cookies, $this->cookies);
         }
     } catch (SoapFault $e) {
         trigger_error($e->getMessage());
         return $e->getMessage();
     }
     // Unless the full response result is specified, only reply the returned result, and not the "out" parameter results
     if (is_object($result) && !$fullReponse) {
         $result_name = $operation . 'Result';
         if (isset($result->{$result_name})) {
             return $result->{$result_name};
         }
     }
     return $result;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:51,代码来源:soaplib.php

示例2: testSetSoapClient

 public function testSetSoapClient()
 {
     $clientMock = $this->getMock('SoapClient', array('__setCookie'), array(null, array('uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com')));
     $soap = new Zend_Soap_Client();
     $soap->setSoapClient($clientMock);
     $this->assertSame($clientMock, $soap->getSoapClient());
 }
开发者ID:netvlies,项目名称:zf,代码行数:7,代码来源:ClientTest.php


注:本文中的Zend_Soap_Client::getSoapClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。