本文整理汇总了PHP中SoapClient::endSession方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::endSession方法的具体用法?PHP SoapClient::endSession怎么用?PHP SoapClient::endSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::endSession方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
/**
* @return bool
*/
public function logout()
{
if (null !== $this->sessionId) {
$this->soapClient->endSession($this->sessionId);
$this->sessionId = null;
return true;
}
return false;
}
示例2: SoapClient
<?php
$client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl', array("trace" => 1));
// 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');
// $id = $client->call($session, 'coupongenerator.clonerule', array('2', '__NDL_RULE', 'NEEDLE7'));
$result = $client->call($session, 'coupongenerator.info', 2);
print_r($result);
// $result = $client->call($session, 'coupongenerator.delete', $id);
// If you don't need the session anymore
$client->endSession($session);
示例3: mamethodeAction
public function mamethodeAction()
{
echo "<pre>";
$baseDir = Mage::getBaseDir('code');
// include_once
// $baseDir.'app/code/community/IWD/OrderManager/Model/Order/Edit.php';
// echo $baseDir.'<br>';
// Mage::log($baseDir,null, 'wms-api.log');
// echo $this->apiUrl. " == " .$this->apiUser. " == "
// .$this->apiPassword;
$date = date('Y-m-d h:i:s');
echo "Date is " . $date . "<br>";
/**
* #####################################################################################
*/
// Establish the connection to WMS api
$proxy = new SoapClient($this->apiUrl);
$sessionId = $proxy->login($this->apiUser, $this->apiPassword);
echo $sessionId;
// $order_increment_Id = "151020C-811018";
// $order_increment_Id = "20151019C-1992393";
/*
* ComplexFilter For Order filter
*/
$complexFilterOrder = array('complex_filter' => array(array('key' => 'updated_at', 'value' => array('key' => 'from', 'value' => date('Y-m-d', strtotime("-6 days")) . " 00:00:00")), array('key' => 'updated_at', 'value' => array('key' => 'to', 'value' => date('Y-m-d') . " 00:02:00"))));
/*
* Get Updated Order list from the WMS
*/
$order_list = $proxy->salesOrderList($sessionId, $complexFilterOrder);
$count = 1;
/*
* Loop through each Order from WMS to check for Invoices and Shipment
*/
foreach ($order_list as $order) {
echo "<br>Order : " . $count . "<br>";
$count++;
/*
* Complex filter to filter out new Invoices and Shipment for the Corresponding OrderId Instead of the increment order ID
*/
$complexFilter = array('complex_filter' => array(array('key' => 'order_id', 'value' => array('key' => 'in', 'value' => $order->order_id)), array('key' => 'created_at', 'value' => array('key' => 'from', 'value' => date('Y-m-d', strtotime("-6 days")) . " 00:00:00")), array('key' => 'created_at', 'value' => array('key' => 'to', 'value' => date('Y-m-d') . " 00:02:00"))));
// echo "<br>##########################################<br>";
echo "---------------" . $order->order_id . "---------------<br>";
// echo "<br><br>";
/*
* Invoice list for the order.
*/
$invoice_list = $proxy->salesOrderInvoiceList($sessionId, $complexFilter);
/*
* shipment list for the order.
*/
$shipment_list = $proxy->salesOrderShipmentList($sessionId, $complexFilter);
/*
* If there is no invoice or shipment continu with next Order
*/
if (count($invoice_list) < 1 && count($shipment_list) < 1) {
echo "NO Invoice and Shipment<br>";
continue;
}
var_dump($invoice_list);
var_dump($shipment_list);
echo "<br>##########################################<br>";
/*
* $invoice_list =
* $proxy->salesOrderInvoiceList($sessionId,$complexFilter);
* $shipment_list =
* $proxy->salesOrderShipmentList($sessionId,$complexFilter);
* var_dump($invoice_list);
* var_dump($shipment_list);
*/
/*
* For each invoice in the invoice list
*/
foreach ($invoice_list as $invoice) {
$invoice_info = $proxy->salesOrderInvoiceInfo($sessionId, $invoice->increment_id);
// var_dump($invoice_info);
//var_dump(get_class($invoice_info));
$this->addInvoiceFromWMS($invoice_info, $order->order_id);
}
/*
* foreach shipment in the shipment list
*/
foreach ($shipment_list as $shipment) {
$shipment_info = $proxy->salesOrderShipmentInfo($sessionId, $shipment->increment_id);
//var_dump(get_class($shipment_info));
// var_dump($shipping_info->order_increment_id);
$this->addShipmentFromWMS($shipment_info, $order->order_id);
}
}
$proxy->endSession($sessionId);
echo "</pre>";
}
示例4: Processshopupdatepwd
public function Processshopupdatepwd($mageid, $newpswd)
{
$client = new SoapClient('http://' . $_SERVER['SERVER_NAME'] . '/shop/api/soap/?wsdl');
$sessionId = $client->login('apiintegrator', 'ap11ntegrator');
$result = $client->call($sessionId, 'customer.update', array('customerId' => $mageid, 'customerData' => array('password_hash' => $newpswd)));
/* if($result)
echo $mageid.' '.$rawpass.'success';*/
$client->endSession($sessionId);
}
示例5: productCreateOrUpdateWMS
//.........这里部分代码省略.........
// approach!
$product_image_mime_type = substr($file_info->buffer($product_image_content), 0, strpos($file_info->buffer($product_image_content), ';'));
// File Object to be send via the API
$product_image_file = array('name' => $product_image_name, 'content' => base64_encode($product_image_content), 'mime' => $product_image_mime_type);
// Image deails to be added or created at WMS
$product_image_details = array('file' => $product_image_file, 'types' => array('thumbnail', 'small_image', 'image'), 'exclude' => 0);
}
// Product details to be sent to WMS
$product_details = array('categories' => $product_categories, 'websites' => array(1), 'name' => $product_name, 'description' => $product_description, 'short_description' => $product_short_description, 'price' => $product_price, 'weight' => $product_weight, 'status' => $product_status, 'url_key' => $product_url_key, 'url_path' => $product_url_path, 'visibility' => $product_visibility, 'tax_class_id' => $product_tax_class_id, 'meta_title' => $product_meta_title, 'meta_keyword' => $product_meta_keyword, 'meta_description' => $product_description, 'stock_data' => array('qty' => $product_qty, 'is_in_stock' => $product_is_in_stock, 'manage_stock' => $product_manage_stock, 'use_config_manage_stock' => $product_use_config_manage_stock));
// Get attribute set
$attributeSets = $proxy->catalogProductAttributeSetList($sessionId);
$attributeSet = current($attributeSets);
// TODO removal of product image
// Fetch product details using the SKU from WMS
try {
$wms_product_exist = $proxy->catalogProductInfo($sessionId, $product_sku);
// Mage::log($wms_product_exist, null, 'shebin.log');
} catch (Exception $e) {
Mage::log("WMS: No such products!", 1, 'wms-api.log');
}
// If Product not exists in WMS then create
if ($wms_product_exist == null || $wms_product_exist == "") {
try {
$result = $proxy->catalogProductCreate($sessionId, $product_type, $attributeSet->set_id, $product_sku, $product_details);
// set the product WMS ID.
Mage::log($result, null, 'wms-api.log');
$product->setData('wms_pid', $result);
$product->getResource()->saveAttribute($product, 'wms_pid');
// Mage::log("CreateProduct:", null, 'shebin.log');
// Mage::log($result, null, 'shebin.log');
} catch (Exception $e) {
Mage::log($e->getMessage(), 3, 'wms-api.log');
Mage::log($e->getTraceAsString(), 3, 'wms-api.log');
Mage::log($product_details, null, 'wms-api.log');
}
// Product image add to WMS
if ($product_image != "no_selection" && $product_image != null) {
try {
$result = $proxy->catalogProductAttributeMediaCreate($sessionId, $product_sku, $product_image_details);
// Mage::log($result." :Image Create on Update", null,
// 'shebin.log');
} catch (Exception $e) {
Mage::log($e->getMessage() . 'Create fail', 3, 'wms-api.log');
Mage::log($product_image_details, null, 'wms-api.log');
}
}
} else {
// else Update the existing product
try {
$result = $proxy->catalogProductUpdate($sessionId, $product_sku, $product_details);
// Mage::log("UpdateProduct:", null, 'shebin.log');
// Mage::log($result, null, 'shebin.log');
} catch (Exception $e) {
Mage::log($e->getMessage(), 3, 'wms-api.log');
Mage::log($product_details, null, 'wms-api.log');
}
// if product image does not Exists create product image else
// update
if ($product_image != "no_selection" && $product_image != null) {
try {
// check exixstence of the product image
$result2 = $proxy->catalogProductAttributeMediaInfo($sessionId, $product_sku, $product_image);
// Mage::log($result2 , null, 'wms-api.log');
} catch (Exception $e) {
Mage::log($e->getMessage() . " WMS: No products image!", 1, 'wms-api.log');
// Mage::log($proxy->catalogProductAttributeMediaList(
// $sessionId, $product_sku), 1, 'wms-api.log');
}
// Check product image Exist or not
if ($result2 == null || ($result2 = "")) {
try {
$result = $proxy->catalogProductAttributeMediaCreate($sessionId, $product_sku, $product_image_details);
// Mage::log($result." :Image Create on Update",
// null,
// 'shebin.log');
} catch (Exception $e) {
Mage::log($e->getMessage() . 'Create fail', 3, 'wms-api.log');
Mage::log($product_image_details, null, 'wms-api.log');
}
} else {
// Product image Update
try {
$result = $proxy->catalogProductAttributeMediaUpdate($sessionId, $product_sku, $product_image, $product_image_details);
// Mage::log($result."Image update on Update", null,
// 'shebin.log');
} catch (Exception $e) {
Mage::log($e->getMessage() . " Update fail", 3, 'wms-api.log');
Mage::log($product_image_details, null, 'wms-api.log');
}
}
}
}
} else {
Mage::log($product_type . " products will not be added to WMS!", 5, 'wms-api.log');
return $this;
}
$proxy->endSession($sessionId);
// closing session
return $this;
}