本文整理汇总了PHP中SoapClient::call方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::call方法的具体用法?PHP SoapClient::call怎么用?PHP SoapClient::call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
/**
* Call soap api.
*
* @param string $resource
* @param array $params
*
* @return array
*
* @throws NotConnectedException
* @throws RestCallException
*/
public function call($resource, $params = null)
{
if ($this->isConnected()) {
try {
$stopWatch = new Stopwatch(microtime(true));
$stopWatch->start('prestashopSoapCall');
$response = $this->client->call($this->session, $resource, $params);
$event = $stopWatch->stop('prestashopSoapCall');
$this->profiler->logCallDuration($event, $resource);
} catch (\SoapFault $e) {
if ($resource === 'core_prestashop.info' && $e->getMessage() === AbstractGuesser::PRESTASHOP_CORE_ACCESS_DENIED) {
$response = ['prestashop_version' => AbstractGuesser::UNKNOWN_VERSION];
} elseif ($e->getMessage() === AbstractGuesser::PRESTASHOP_CORE_ACCESS_DENIED) {
throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s" Called resource : "%s" with parameters : %s.' . ' Soap user needs access on this resource. Please ' . 'check in your Prestashop webservice soap roles and ' . 'users configuration.', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params)), $e->getCode(), $e);
} else {
throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s". Called resource : "%s" with parameters : %s', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params)), $e->getCode(), $e);
}
}
if (is_array($response) && isset($response['isFault']) && $response['isFault']) {
throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s". Called resource : "%s" with parameters : %s.' . 'Response from API : %s', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params), json_encode($response)));
}
return $response;
} else {
throw new NotConnectedException();
}
}
示例2: demo_api
public function demo_api()
{
$objClient = new SoapClient($this->wdsl, 'wsdl', FALSE, FALSE, FALSE, FALSE, 30, 60);
$objClient->decode_utf8 = false;
$result = $objClient->call('Fdt_tracking_list', array('b_ma_dvi' => '160', 'b_so_hieu' => '1212'));
$items = $result['Fdt_tracking_listResult']['TrackingItem'];
print_r($items);
// $param = Array(
// 'input' => $inputCall
// );
// $result = $objClient->submit($param);
}
示例3: call
/**
* @param ActionInterface $action
* @param bool $throwsException
*
* @return array|false
* @throws \Exception
*/
public function call(ActionInterface $action, $throwsException = true)
{
try {
$this->checkSecurity();
$result = $this->soapClient->call($this->sessionId, $action->getMethod(), $action->getArguments());
return $result;
} catch (\Exception $e) {
if ($throwsException) {
throw $e;
}
return false;
}
}
示例4: testUnHold
public function testUnHold()
{
$session = $this->_prepare();
$client = new SoapClient("http://hackathon.dev/api/soap/?wsdl");
//soap handle
try {
print_r($client->call($session, 'sales_order.unhold', '100000094'));
} catch (Exception $e) {
//while an error has occured
echo "==> Error: " . $e->getMessage();
//we print this
}
}
示例5: indexAction
public function indexAction()
{
if (Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) {
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
$validate_url = false;
if ($isSecure) {
if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) {
$validate_url = true;
}
} else {
if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) {
$validate_url = true;
}
}
if ($validate_url) {
$details = Mage::app()->getRequest()->getParams();
$user = $details['userapi'];
$api_key = $details['keyapi'];
$deviceToken = $details['token'];
$flag = $details['notification_flag'];
$device_type = $details['device_type'];
$url = $details['magento_url'] . 'api/soap?wsdl';
try {
$soap = new SoapClient($url);
$session_id = $soap->login($user, $api_key);
} catch (SoapFault $fault) {
$result['error'] = $fault->getMessage();
$jsonData = Mage::helper('core')->jsonEncode($result);
return Mage::app()->getResponse()->setBody($jsonData);
}
if ($session_id) {
$data[] = array('user' => $user, 'key' => $api_key, 'devicetoken' => $deviceToken, 'session_id' => $session_id, 'notification_flag' => $flag, 'device_type' => $device_type, 'is_logout' => 0);
$result = $soap->call($session_id, 'mobileassistant.create', $data);
$jsonData = Mage::helper('core')->jsonEncode($result);
return Mage::app()->getResponse()->setBody($jsonData);
}
} else {
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.');
}
} else {
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
}
$jsonData = Mage::helper('core')->jsonEncode($result);
return Mage::app()->getResponse()->setBody($jsonData);
}
示例6: updateLicence
public function updateLicence($post_data)
{
$result = array();
$post_data['remote_addr'] = $_SERVER['REMOTE_ADDR'];
$post_data['server_name'] = $_SERVER['SERVER_NAME'];
$res = $this->getConfigData();
$url = base64_decode($res['url']);
$webuser = base64_decode($res['webuser']);
$webuser_pass = base64_decode($res['webuser_pass']);
Mage::log($url . $webuser . $webuser_pass);
$proxy = new SoapClient($url);
$sessionId = $proxy->login($webuser, $webuser_pass);
try {
$result = $proxy->call($sessionId, 'user_licence.update', array('data' => $post_data));
} catch (Exception $e) {
//echo $e->getMessage();
Mage::getSingleton('core/session')->addError($e->getMessage());
}
return $result;
}
示例7: SoapClient
$user = 'zoffioblog';
$passwd = 'GqMh3wQLvE';
$subscriber = null;
$result = null;
$client = new SoapClient($api_url);
// intialise the api URL
// If somestuff requires api authentification,
// then get a session token
$session = $client->login($user, $passwd);
//login to API sessions with the
//print_r($session);
if (isset($_POST)) {
if (isset($_POST['email'])) {
$subscriber = $_POST['email'];
// print_r($_POST['email']);
}
//print_r($subscriber);
if ($subscriber != '') {
$result = $client->call($session, 'newsletterapi_api.newslettersubscribers', array(array($subscriber)));
}
echo "<pre>";
print_r($result);
echo "</pre>";
}
?>
<form action="newsletter-api-test.php" method="POST">
Email:<br>
<input type="email" name="email" id="email">
<br>
<input type="submit" name="Submit" value="Subscribe">
</form>
示例8: json_encode
<?php
require_once "inc.php";
require_once "ChromePhp.php";
$proxy = new SoapClient('http://rdxsports.com/api/soap/?wsdl');
$sessionId = $proxy->login('naveed', 'doooop');
$filters = json_decode($_GET['f'], true);
$data = $proxy->call($sessionId, $_GET['a'], $filters);
echo json_encode($data);
//pr($products,'Products: '.count($products));
示例9: SoapClient
<?php
$client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl');
// If soap isn't default use this link instead
// http://youmagentohost/api/soap/?wsdl
// If somestuff requires api authentification,
// we should get session token
$session = $client->login('needle', '123456');
$result = $client->call($session, 'salesrule.list');
// If you don't need the session anymore
$client->endSession($session);
print $result;
示例10: actionTagnote
public function actionTagnote()
{
$finaoId = isset($_REQUEST['finao']) && is_numeric($_REQUEST['finao']) ? $_REQUEST['finao'] : null;
$requestData = array('tagnoteId' => $finaoId);
$client = new SoapClient('http://' . $_SERVER['SERVER_NAME'] . '/shop/api/soap/?wsdl');
$sessionId = $client->login('apiintegrator', 'ap11ntegrator');
$tagnoteResponse = $client->call($sessionId, 'finao.info', array($requestData));
$user = User::model()->findAllByAttributes(array('mageid' => $tagnoteResponse['customerId']));
$userimage = UserProfile::model()->findAllByAttributes(array('user_id' => $user[0]['userid']));
$this->renderPartial('_tagnote', array('tagnote' => isset($tagnoteResponse['finao']) ? $tagnoteResponse['finao'] : '', 'user' => $user, 'userimage' => $userimage));
}
示例11: call
public function call($method, $params)
{
try {
$data = array_merge(array($this->session, $method), array($params));
return parent::call($data);
} catch (Exception $e) {
throw new MagentoSoapClientException($e->getMessage());
}
}
示例12: json_encode
<?php
require_once "inc.php";
$proxy = new SoapClient('http://rdxsports.com/api/soap/?wsdl');
$sessionId = $proxy->login('naveed', 'doooop');
$products = $proxy->call($sessionId, 'catalog_category.tree');
echo json_encode($products);
//pr($products,'Products: '.count($products));
示例13: SoapClient
<?php
if ($_GET) {
$proxy = new SoapClient('http://www.elitestore.es/api/soap/?wsdl=1');
$user = "cuartafoto";
$password = "29843cd7dbfd10cf832792f9b2c2a1cb";
$sessionId = $proxy->login($user, $password);
if ($_GET['sku'] != "") {
$filters = array('sku' => array('like' => $_GET['sku']), 'type' => array('like' => 'configurable'));
$products = $proxy->call($sessionId, 'product.list', array($filters));
//var_dump($products);
if (count($products) == 0) {
echo "<span style='color:red;'>el producto no existe</span>";
} else {
$productSku = $products[0]["sku"];
/*foreach ($products as $productSkuSearch):
if($productSkuSearch["type"]=="configurable")
$productSku = $productSkuSearch["sku"];
endforeach;*/
$result = $proxy->call($sessionId, 'catalog_product.info', $productSku);
$ruta = $result["rutaimagen"];
$rutaimagen = "http://www.elitestore.es" . substr($ruta, 0, -5) . "3.jpg";
$file_headers = @get_headers($rutaimagen);
if ($file_headers[0] != 'HTTP/1.1 404 Not Found') {
//file_exists($rutaimagen)):
//insrtar imagen en producto como cuarta foto
//echo file_get_contents($rutaimagen);
$newImage = array('file' => array('name' => 'file_name', 'content' => base64_encode(file_get_contents($rutaimagen)), 'mime' => 'image/jpeg'), 'position' => 3, 'exclude' => 0, 'defaultimg' => 0);
$imageFilename = $proxy->call($sessionId, 'product_media.create', array($productSku, $newImage));
$result = $proxy->call($sessionId, 'catalog_product.update', array($productSku, array('has_four_images' => 1)));
echo "imagen subida correctamente<br/>sku: " . $productSku . "</br> imagen:</br> <img src='" . $rutaimagen . "' width='200px' />";
示例14: activeAction
public function activeAction()
{
try {
$module = $this->getRequest()->getParam('module');
$orderid = $this->getRequest()->getParam('orderid');
$type_site = $this->getRequest()->getParam('site');
if (empty($type_site)) {
$type_site = "live_site";
}
$type_comment = Mage::helper("mcore")->getModuleTypeComment($module);
if (!Mage::app()->getCookie()->get($module)) {
Mage::app()->getCookie()->set($module, '1', Mage::getStoreConfig('mcore/timelock'));
} else {
if (Mage::app()->getCookie()->get($module) < Mage::getStoreConfig('mcore/timestolock')) {
Mage::app()->getCookie()->set($module, intval(Mage::app()->getCookie()->get($module)) + 1, Mage::getStoreConfig('mcore/timelock'));
}
}
if (Mage::app()->getCookie()->get($module) == Mage::getStoreConfig('mcore/timestolock')) {
echo "You have tried to activate too many times. Please try again in next 60 minutes.";
return;
} else {
$domain = Mage::helper('mcore')->getDomain();
if (Mage::helper('mcore')->activeOnLocal($domain, $type_site)) {
echo "Can not activate on localhost.";
return;
} else {
if (Mage::helper('mcore')->activeOnDevelopSite($domain, $type_site)) {
echo "Can not activate the extension on the development site.";
return;
} else {
if ($module != "" && $orderid != "") {
$extend_name = Mage::helper('mcore')->getModuleEdition($module);
$newmodule = $module;
if (!empty($extend_name)) {
$newmodule = $module . strtolower($extend_name);
}
if (class_exists('SoapClient')) {
$arr_info_api = array();
$arr_info_api = array('module' => $newmodule, 'orderid' => $orderid, 'domain' => $domain, 'type_site' => $type_site, 'module_system' => $module, 'comment' => $type_comment);
Mage::getModel('core/config')->saveConfig('mcore/errorSoap', 0);
Mage::getConfig()->reinit();
$client = new SoapClient(Mage::getStoreConfig('mcore/activelink'));
$session = $client->login(Mage::getStoreConfig('mcore/userapi'), Mage::getStoreConfig('mcore/codeapi'));
$result = $client->call($session, 'managelicense.verifyPro', array($arr_info_api));
Mage::helper('mcore')->getCommentActive($arr_info_api, $result);
echo $result[1];
} else {
Mage::getModel('core/config')->saveConfig('mcore/errorSoap', 1);
Mage::getConfig()->reinit();
echo 'It requires to enable PHP SOAP extension to activate online. Or please <a href="http://www.mage-world.com/contacts/">contact us</a> get offline activation key.</div>';
}
} else {
echo "Can not connect to server because extension name or order number is null. Please try again later. ";
}
return;
}
}
}
} catch (Exception $e) {
echo "Can not connect to server. Please try again later. Error message: " . $e;
return;
}
}
示例15: clientAction
/**
* @Route("/client", name="client")
*/
public function clientAction()
{
$client = new \SoapClient('/server?wsdl', true);
$result = $client->call('hello', array('name' => 'Scott'));
}