本文整理汇总了PHP中SoapClient::__getFunctions方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__getFunctions方法的具体用法?PHP SoapClient::__getFunctions怎么用?PHP SoapClient::__getFunctions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__getFunctions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetRegZavod
public static function GetRegZavod()
{
$debug = false;
$wsdl_url = dirname(__FILE__) . '/RegZavodServicePort.wsdl';
if (!file_exists($wsdl_url)) {
echo 'Missing WSDL shema for RegZavodServicePort.wsdl', "\n";
echo 'WSDL PATH: ', $wsdl_url, "\n";
die;
}
$client = new SoapClient($wsdl_url, array('exceptions' => 0, 'trace' => 1, 'user_agent' => 'Bober'));
$result = $client->__soapCall('getRegZavod', array());
if ($debug) {
var_dump($client->__getFunctions());
echo 'REQUEST HEADERS:', "\n", $client->__getLastRequestHeaders(), "\n";
echo 'REQUEST:', "\n", $client->__getLastRequest(), "\n";
var_dump($result);
if (is_soap_fault($result)) {
trigger_error('SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})', E_USER_ERROR);
}
print_r($result);
}
if ($result != '' && !is_soap_fault($result)) {
$result = json_decode(json_encode($result), true);
return $result;
} else {
return array();
}
}
示例2: checkSoapClient
private function checkSoapClient()
{
try {
$defaultTimeout = ini_get("default_socket_timeout");
ini_set("default_socket_timeout", 15);
$soapClient = new \SoapClient($this->getWSDLUrl());
$this->aMethods = $soapClient->__getFunctions();
$this->aTypes = $soapClient->__getTypes();
$this->setEstado(true);
} catch (SoapFault $f) {
$mensajeError = '';
$msg = $f->faultstring;
if (strstr($msg, 'failed to load external entity')) {
$mensajeError = 'Error de conexión - ';
} else {
if ($f->faultcode == 'HTTP' && strstr(strtolower($f->faultstring), 'error fetching http headers')) {
$mensajeError = 'Tiempo de espera superado - ';
}
}
$mensajeError .= $msg;
$this->setEstado(false);
$this->setMensaje($mensajeError);
}
ini_set("default_socket_timeout", $defaultTimeout);
return $this->getEstado();
}
示例3: loadService
/**
* Loads the service class
*
* @access private
*/
private function loadService()
{
$name = $this->dom->getElementsByTagNameNS('*', 'service')->item(0)->getAttribute('name');
$this->log($this->display('Starting to load service ') . $name);
$this->service = new Service($name, $this->types, $this->documentation->getServiceDescription());
$functions = $this->client->__getFunctions();
foreach ($functions as $function) {
$matches = array();
if (preg_match('/^(\\w[\\w\\d_]*) (\\w[\\w\\d_]*)\\(([\\w\\$\\d,_ ]*)\\)$/', $function, $matches)) {
$returns = $matches[1];
$function = $matches[2];
$params = $matches[3];
} else {
if (preg_match('/^(list\\([\\w\\$\\d,_ ]*\\)) (\\w[\\w\\d_]*)\\(([\\w\\$\\d,_ ]*)\\)$/', $function, $matches)) {
$returns = $matches[1];
$function = $matches[2];
$params = $matches[3];
} else {
// invalid function call
throw new Exception('Invalid function call: ' . $function);
}
}
$this->log($this->display('Loading function ') . $function);
$this->service->addOperation($function, $params, $this->documentation->getFunctionDescription($function));
}
$this->log($this->display('Done loading service ') . $name);
}
示例4: index
/**
* 首页
*/
public function index()
{
if (!class_exists("SoapClient")) {
exit("请开启Soap扩展!");
}
$ws = "http://www.webservicex.net/globalweather.asmx?wsdl";
//webservice服务的地址
$ws = "http://122.224.230.4:18003/newyorkWS/ws/CheckGoodsDecl?wsdl";
// $ws = "http://122.224.230.4:18003/newyorkWS/ws/ReceivedDeclare?wsdl";
$client = new \SoapClient($ws);
/*
* 获取SoapClient对象引用的服务所提供的所有方法
*/
echo "SOAP服务器提供的开放函数:";
echo '<pre>';
var_dump($client->__getFunctions());
//获取服务器上提供的方法
echo '</pre>';
echo "SOAP服务器提供的Type:";
echo '<pre>';
var_dump($client->__getTypes());
//获取服务器上数据类型
echo '</pre>';
echo "执行GetGUIDNode的结果:";
// $result=$client->checkReceived(array('xmlStr'=>'zhengzhou','xmlType'=>'IMPORT_COMPANY','sourceType'=>'1'));//查询中国郑州的天气,返回的是一个结构体
// var_dump($result);
$result = $client->check(array('companyCode' => 'zhengzhou', 'subCarriageNo' => '1'));
//查询中国郑州的天气,返回的是一个结构体
dump(simplexml_load_string($result->return));
// $this->display();
// echo $result->return;
exit;
}
示例5: createFromClient
/**
* Возвращает экземпляр Resolver на основе переданного SOAP клиента
*
* @param \SoapClient $client Клиент
*
* @return Resolver
*/
public static function createFromClient(\SoapClient $client)
{
$functions = $client->__getFunctions();
$types = $client->__getTypes();
$functionParser = new FunctionParser($functions);
$typeParser = new TypeParser($types);
return new Resolver($functionParser->getFunctions(), $typeParser->getTypes());
}
示例6: getControllerFunctions
/**
*
* @return string
*/
private function getControllerFunctions()
{
$result = '';
foreach ($this->soapClient->__getFunctions() as $f) {
$result .= $this->getFunction($f);
}
return $result;
}
示例7: getFunctions
/**
* Return a list of available functions
*
* @return array
* @throws Zend_Soap_Client_Exception
*/
public function getFunctions()
{
if ($this->getWsdl() == null) {
throw new Zend_Soap_Client_Exception('\'getFunctions\' method is available only in WSDL mode.');
}
if ($this->_soapClient == null) {
$this->_initSoapClientObject();
}
return $this->_soapClient->__getFunctions();
}
示例8: generate_xend_waybill_no
public function generate_xend_waybill_no($ordernumber)
{
error_reporting(E_ALL);
//require_once('lib/nusoap.php');
// declare variables
$exceptionFlag = false;
// initialize SOAP clients
$wsdl = 'https://www.xend.com.ph/api/ShipmentService.asmx?wsdl';
$client = new SoapClient($wsdl, array());
$funcs = $client->__getFunctions();
// initialize SOAP header
/*$headerbody = array('UserToken' => '92c14d24-bebb-49a8-a7b5-8a8358fb137e');*/
//test waybill
//http://www.xend.com.ph/GetWaybill.aspx?no=736345530
$headerbody = array('UserToken' => '92c14d24-bebb-49a8-a7b5-8a8358fb137e');
$header = new SoapHeader('https://www.xend.com.ph/api/', 'AuthHeader', $headerbody);
$client->__setSoapHeaders($header);
// prepare parameters
// all orders
$this->load->model('xend_model');
//print_r($this->xend_model->get_orders_by_number($ordernumber));
foreach ($this->xend_model->get_orders_by_number($ordernumber) as $order) {
// if($order->ship_zone=="Metro Manila"){
// $shipping_fee=79;
// } else {
// $shipping_fee=150;
// }
$shipping_fee = $order->shipping;
$param = array('ServiceTypeValue' => 'MetroManilaExpress', 'ShipmentTypeValue' => 'Parcel', 'Weight' => 0.5, 'DimensionL' => 0.0, 'DimensionW' => 0.0, 'DimensionH' => 0.0, 'DeclaredValue' => $order->total, 'RecipientName' => $order->ship_firstname . ' ' . $order->ship_lastname, 'RecipientCompanyName' => $order->ship_company, 'RecipientAddress1' => $order->ship_address1, 'RecipientAddress2' => $order->ship_address2, 'RecipientCity' => $order->ship_city, 'RecipientProvince' => $order->ship_zone, 'RecipientCountry' => $order->ship_country, 'IsInsured' => 0, 'SpecialInstructions' => 'Fragile', 'Description' => 'DESCRIPTION', 'ClientReference' => $order->order_number, 'PurposeOfExportValue' => 'None', 'DateCreated' => date('Y-m-d\\TH\\:i\\:s\\.u', time()), 'DatePrinted' => date('Y-m-d\\TH\\:i\\:s\\.u', time()), 'ShippingFee' => $shipping_fee, 'InsuranceFee' => 0);
}
// execute SOAP method
try {
$result = $client->Create(array('shipment' => $param));
//$result = $client->__soapCall("Create", array("shipment" => $param));
} catch (SoapFault $soapfault) {
$exceptionFlag = true;
$exception = $soapfault->getMessage();
preg_match_all('/: (.*?). at/s', $exception, $error, PREG_SET_ORDER);
echo "<b> Error : </b> " . $error[0][1];
//echo $soapfault->faultcode;
}
if (!$exceptionFlag) {
return $result->CreateResult;
}
}
示例9: SoapClient
function __construct($wsdlurl)
{
$client = new SoapClient($wsdlurl);
$functions = $client->__getFunctions();
$typeStrings = $client->__getTypes();
$types = array();
foreach ($typeStrings as $t) {
$types = $types + $this->extractParameterInfo($t);
}
$this->types = $types;
$operations = array();
foreach ($functions as $f) {
$operation = $this->extractFunctionInfo($types, $f);
$key = $operation->toString();
if (!array_key_exists($key, $operations)) {
$operations[$key] = $operation;
}
}
$this->operations = $operations;
// var_dump($client->);
// echo "<br />";
}
示例10: getTracking
/**
* Retrieving tracking information given the waybill number of the
* shipment.
*
* @return array
*/
public function getTracking()
{
// initialize SOAP client
$client = new SoapClient(self::TRACKING_WSDL, array());
$funcs = $client->__getFunctions();
// initialize SOAP header
$headerbody = array(self::USER_TOKEN => $this->_userToken);
$header = new SoapHeader(self::HEADER, self::AUTH_HEADER, $headerbody);
$client->__setSoapHeaders($header);
// prepare parameters
$query = array(self::WAY_BILL_NO => $this->_wayBillNo);
// execute SOAP method
try {
$result = $client->GetList($query);
//catch soap fault
} catch (SoapFault $soapfault) {
$this->_exceptionFlag = true;
$exception = $soapfault->getMessage();
preg_match_all('/: (.*?). at/s', $exception, $error, PREG_SET_ORDER);
//Print error
return $error[0][1];
}
return $result;
}
示例11: getResponse
/**
* Retrieves the calculated rate based on the shipment information.
*
* @return integer|float
*/
public function getResponse()
{
// initialize SOAP client
$client = new SoapClient(self::RATE_WSDL);
$funcs = $client->__getFunctions();
// initialize SOAP header
$headerbody = array(self::USER_TOKEN => $this->_userToken);
$header = new SoapHeader(self::HEADER, self::AUTH_HEADER, $headerbody);
$client->__setSoapHeaders($header);
// prepare parameters
$query = array(self::SERVICE_TYPE => $this->_serviceType, self::SHIPMENT_TYPE => $this->_shipmentType, self::DESTINATION_VALUE => $this->_destinationValue, self::WEIGHT => $this->_weight, self::LENGTH => $this->_length, self::WIDTH => $this->_width, self::HEIGHT => $this->_height, self::VALUE => $this->_declaredValue, self::INSURANCE => true);
// execute SOAP method
try {
$result = $client->Calculate($query);
//catch soap fault
} catch (SoapFault $soapfault) {
$this->_exceptionFlag = true;
$exception = $soapfault->getMessage();
preg_match_all('/: (.*?). at/s', $exception, $error, PREG_SET_ORDER);
//Print error
return $error[0][1];
}
return $result->CalculateResult;
}
示例12: SoapClient
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
ini_set('soap.wsdl_cache_enabled', '0');
//关闭缓存
$soap = new SoapClient('http://wl.com/api.php/soap/op/api');
echo "提供的方法\n";
print_r($soap->__getFunctions());
echo "相关的数据结构\n";
print_r($soap->__getTypes());
var_dump($soap->receive(array('arg0' => file_get_contents(SITE_ROOT . 'YUN.xml')))->return);
示例13: SoapClient
<?php
ini_set('soap.wsdl_cache_enabled', '0');
include_once '../global/customize.php';
try {
// $wsdl_loc = "http://media2.hgkz.ch/hgkmedialib-backend/soap/inc/auth.wsdl";
$wsdl_loc = "http://localhost/winet-backend/soap/wsdl/HgkMediaLib_Authentication.wsdl";
echo $wsdl_loc . '<br>';
$feed_client = new SoapClient($wsdl_loc);
$func = $feed_client->__getFunctions();
echo '<pre>';
print_r($func);
echo '</pre>';
$feed_client = new SoapClient($wsdl_loc);
$types = $feed_client->__getTypes();
echo '<pre>';
print_r($types);
echo '</pre>';
} catch (SoapFault $f) {
$fault = "SOAP Fehler:<br>faultcode: {$f->faultcode}<br>";
$fault .= "faultstring: {$f->faultstring}<br>";
$fault .= "faultactor: {$f->faultactor}<br>";
$fault .= "faultdetail: {$f->detail}<br>";
die($fault);
}
示例14: generateClassFromWsdl
/**
* @param string $wsdlFile
* @param string $className
* @param array $methods
* @param array $options
*
* @return string
* @throws PHPUnit_Framework_MockObject_RuntimeException
*/
public function generateClassFromWsdl($wsdlFile, $className, array $methods = array(), array $options = array())
{
if ($this->soapLoaded === null) {
$this->soapLoaded = extension_loaded('soap');
}
if ($this->soapLoaded) {
$options = array_merge($options, array('cache_wsdl' => WSDL_CACHE_NONE));
$client = new SoapClient($wsdlFile, $options);
$_methods = array_unique($client->__getFunctions());
unset($client);
sort($_methods);
$templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR;
$methodTemplate = new Text_Template($templateDir . 'wsdl_method.tpl');
$methodsBuffer = '';
foreach ($_methods as $method) {
$nameStart = strpos($method, ' ') + 1;
$nameEnd = strpos($method, '(');
$name = substr($method, $nameStart, $nameEnd - $nameStart);
if (empty($methods) || in_array($name, $methods)) {
$args = explode(',', substr($method, $nameEnd + 1, strpos($method, ')') - $nameEnd - 1));
$numArgs = count($args);
for ($i = 0; $i < $numArgs; $i++) {
$args[$i] = substr($args[$i], strpos($args[$i], '$'));
}
$methodTemplate->setVar(array('method_name' => $name, 'arguments' => join(', ', $args)));
$methodsBuffer .= $methodTemplate->render();
}
}
$optionsBuffer = 'array(';
foreach ($options as $key => $value) {
$optionsBuffer .= $key . ' => ' . $value;
}
$optionsBuffer .= ')';
$classTemplate = new Text_Template($templateDir . 'wsdl_class.tpl');
$namespace = '';
if (strpos($className, '\\') !== false) {
$parts = explode('\\', $className);
$className = array_pop($parts);
$namespace = 'namespace ' . join('\\', $parts) . ';' . "\n\n";
}
$classTemplate->setVar(array('namespace' => $namespace, 'class_name' => $className, 'wsdl' => $wsdlFile, 'options' => $optionsBuffer, 'methods' => $methodsBuffer));
return $classTemplate->render();
} else {
throw new PHPUnit_Framework_MockObject_RuntimeException('The SOAP extension is required to generate a mock object ' . 'from WSDL.');
}
}
示例15: array
$order = array('Title' => 'asc');
try {
$client = new SoapClient(HKGMEDIALIB_WSDL_BASEDIR . '/Auth.wsdl');
//$client = new SoapClient('http://media1.hgkz.ch/winet-backend/soap/wsdl/HgkMediaLib_Authentication.wsdl');
echo "we call getSession('user', 'pwd', 'domain') - Returns a new session id:\n";
echo "*******************************************\n\n";
$session = $client->getSession('user', 'pwd', 'domain');
var_export($session);
echo "\n";
echo "\n";
echo HKGMEDIALIB_WSDL_BASEDIR . 'Read.wsdl';
$client = new SoapClient(HKGMEDIALIB_WSDL_BASEDIR . 'Read.wsdl');
//$client = new SoapClient('http://media1.hgkz.ch/winet-backend/soap/wsdl/HgkMediaLib_Reading.wsdl');
echo "Functions available:\n";
echo "********************\n";
var_export($client->__getFunctions());
echo "\n\n";
echo "we get the following server:\n";
echo "****************************\n\n";
var_export($client);
echo "\n\n";
echo "we call the getSuggestions():\n";
echo "*****************************\n\n";
$result = $client->getSuggestions($session, "title");
var_export($result);
echo "\n\n";
echo "we call the findByTitle():\n";
echo "**************************\n\n";
$result = $client->find($session, $clause, $order, 20, 'de');
var_export($result);
echo "\n\n";