本文整理汇总了PHP中xmlrpcmsg类的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpcmsg类的具体用法?PHP xmlrpcmsg怎么用?PHP xmlrpcmsg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpcmsg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getSocketConnect
public function getSocketConnect()
{
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$is_sesson = $this->checkConfigurationChange();
if (!$is_sesson || !is_int($userId)) {
$sock = $this->getSocket();
$msg = new xmlrpcmsg('login');
$msg->addParam(new xmlrpcval(self::$odoo_db, "string"));
$msg->addParam(new xmlrpcval(self::$odoo_user, "string"));
$msg->addParam(new xmlrpcval(self::$odoo_pwd, "string"));
$resp = $sock->send($msg);
if ($resp->faultCode()) {
$userId = $resp->faultString();
} else {
$val = $resp->value();
$id = $val->scalarval();
if ($id > 0) {
$userId = $id;
} else {
$userId = 'Invalid Odoo Login Details.';
}
}
Mage::getSingleton('adminhtml/session')->setUserId($userId);
}
}
开发者ID:kozinthetdbp,项目名称:shopmyar,代码行数:25,代码来源:Connection.php
示例2: xmlrpcCall
function xmlrpcCall($url, $method, $params)
{
// xmlrpc encode parameters
for ($i = 0; $i < count($params); $i++) {
if (get_class($params[$i]) != 'xmlrpcval') {
$params[$i] = xmlrpc_encode($params[$i]);
}
}
// send request
$message = new xmlrpcmsg($method, $params);
debug("XML-RPC message", $message->serialize());
$addr = parse_url($url);
$client = new xmlrpc_client($url, $addr['host'], $addr['port']);
//if($debug)
// $client->setDebug(1);
debug("XML-RPC", "call to " . $url);
$response = $client->send($message);
// process response
debug("XML-RPC Response", $response->serialize());
if (!$response) {
debug("No response", "probably host is unreachable");
} elseif ($response->faultCode() != 0) {
// there was an error
debug("Error response: ", $response->faultCode() . " " . $response->faultString());
} else {
$retval = $response->value();
if ($retval) {
$retval = xmlrpc_decode($retval);
}
debug("Response", $retval);
return $retval;
}
return NULL;
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:34,代码来源:rpc_Utils.class.php
示例3: __createXmlRpcMsg
function __createXmlRpcMsg($server_method, $params_arr)
{
$xml_val = my_xmlrpc_encode($params_arr);
$xml_msg = new xmlrpcmsg($server_method);
$xml_msg->addParam($xml_val);
return $xml_msg;
}
开发者ID:zeroleo12345,项目名称:freeIBS,代码行数:7,代码来源:xmlrpc.php
示例4: gFaultXmlRequest
function gFaultXmlRequest($faultCode, $faultString)
{
global $stylevar;
$faultMethod = 'return_fault';
$xml = new xmlrpcmsg($faultMethod);
$xml->addParam($faultCode);
$xml->addParam($faultString);
$rxml = $xml->serialize($stylevar['charset']);
return $rxml;
}
开发者ID:patrickrolanddg,项目名称:dragonfly-tapatalk,代码行数:10,代码来源:common.php
示例5: syncStoreAtOdoo
public function syncStoreAtOdoo($store_data)
{
$response = 0;
$auto_warehouse_generation = Mage::getStoreConfig('magerpsync/mobmultishop/auto_warehouse_generation');
$auto_pricelist_generation = Mage::getStoreConfig('magerpsync/mobmultishop/auto_pricelist_generation');
$store_data['auto_warehouse'] = $auto_warehouse_generation;
$store_data['auto_pricelist'] = $auto_pricelist_generation;
$store_array = php_xmlrpc_encode($store_data);
$helper = Mage::helper('magerpsync/connection');
$context = $helper->getOdooContext();
$client = $helper->getClientConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg->addParam(new xmlrpcval("magento.store.view", "string"));
$msg->addParam(new xmlrpcval("sync_store_view", "string"));
$msg->addParam($store_array);
$msg->addParam(new xmlrpcval($context, "struct"));
$resp = $client->send($msg);
if ($resp->faultCode()) {
$error = "Sync Error, Store " . $store_data['name'] . " >>" . $resp->faultString();
Mage::log($error, null, 'odoo_connector.log');
} else {
$response = 1;
$odoo_id = $resp->value()->me["int"];
$store = Mage::getModel("mobmultishop/mobmultishop");
$store->setOdooStoreId($odoo_id);
$store->setMageStoreId($store_data['store_id']);
$store->setCreatedBy($helper::$mage_user);
$store->save();
}
return $response;
}
开发者ID:babycarenl,项目名称:360,代码行数:35,代码来源:Mobmultishop.php
示例6: exportAttributeSet
public function exportAttributeSet($setName, $setId)
{
$helper = Mage::helper('magerpsync/connection');
$client = $helper->getClientConnect();
$context = $helper->getOdooContext();
$mapped_ids = $this->getMappedAttributeSetIds();
if (!in_array($setId, $mapped_ids)) {
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$attributeset_array = array('name' => new xmlrpcval($setName, "string"), 'set_id' => new xmlrpcval($setId, "int"), 'created_by' => new xmlrpcval($helper::$mage_user, "string"));
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg->addParam(new xmlrpcval("magento.attribute.set", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($attributeset_array, "struct"));
$msg->addParam(new xmlrpcval($context, "struct"));
$resp = $client->send($msg);
if ($resp->faultCode()) {
$error_message = $resp->faultString();
return array('erp_set_id' => 0, 'success' => false, 'message' => $error_message);
} else {
$odoo_id = $resp->value()->me["int"];
$mapping_data = array('name' => $setName, 'mage_id' => $setId, 'odoo_id' => $odoo_id, 'created_by' => $helper::$mage_user);
$this->setmapping($mapping_data);
return array('success' => true, 'erp_set_id' => $odoo_id);
}
}
return array('success' => true);
}
开发者ID:kozinthetdbp,项目名称:shopmyar,代码行数:30,代码来源:Attributeset.php
示例7: register
/**
* Dekodiere die via XMLRPC übertragenen Atributte, dann führe die
* parent Methode aus und transformiere die Antwort.
*
* @param xmlrpcmsg $xmlrpcmsg Die XMLRPC Anfrage
* @return xmlrpcresp Gibt den Statuscode 1 für Erfolg zurück
*/
public function register($xmlrpcmsg)
{
$name = $xmlrpcmsg->getParam(0)->scalarval();
//Zugriff auf den ersten Parameter
$age = $xmlrpcmsg->getParam(1)->scalarval();
//Zugriff auf den zweiten Parameter
$res = parent::register($name, $age);
//übergebe Parameter an parent Methode
$resConverted = new xmlrpcval($res, "int");
//Kodiere Rückgabewert der parent Methode
return new xmlrpcresp($resConverted);
//Erstelle XMLRPC Antwort aus dem Rückgabewert für Clienten
}
开发者ID:weprogora,项目名称:blog-webservices,代码行数:20,代码来源:server.php
示例8: exec
function exec($method, $params = NULL)
{
$message = new xmlrpcmsg($method);
if ($params && is_array($params)) {
foreach ($params as $value) {
$message->addParam(php_xmlrpc_encode($value));
}
}
$result = $this->db->send($message, 15);
if ($result->faultCode()) {
throw new Exception($result->faultString());
}
return $result->value();
}
开发者ID:karepwes,项目名称:OcsPanels,代码行数:14,代码来源:webmin.php
示例9: CheckOdooActiveConfig
public function CheckOdooActiveConfig()
{
$helper = Mage::helper('magerpsync/connection');
$helper->getSocketConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
if ($userId > 0) {
$mage_url = Mage::getBaseUrl();
$client = $helper->getClientConnect();
$fields = array('magento_url' => new xmlrpcval($mage_url, "string"));
$msg2 = new xmlrpcmsg('execute');
$msg2->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg2->addParam(new xmlrpcval($userId, "int"));
$msg2->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg2->addParam(new xmlrpcval("magento.configure", "string"));
$msg2->addParam(new xmlrpcval("fetch_connection_info", "string"));
$msg2->addParam(new xmlrpcval($fields, "struct"));
$resp = $client->send($msg2);
if ($resp->faultcode()) {
$error = $this->__("Fetch Odoo Config Error,") . $resp->faultString();
Mage::log($error, null, 'odoo_connector.log');
} else {
$data = $resp->value()->scalarval();
if ($data) {
$this->ERP_CATEG = $data['category']->me['array'][0]->me['int'];
$this->ERP_LANG = $data['language']->me['string'];
$this->ERP_WAREHOUSE = $data['warehouse_id']->me['array'][0]->me['int'];
$this->ERP_INSTANCE = $data['id']->me['int'];
$this->setToSession();
return true;
}
}
}
return false;
}
开发者ID:babycarenl,项目名称:360,代码行数:34,代码来源:Data.php
示例10: CheckOdooActiveConfig
public function CheckOdooActiveConfig()
{
$helper = Mage::helper('magerpsync/connection');
$mage_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
/*$fields = array('magento_url'=>new xmlrpcval($mage_url, "string"),);*/
$helper->getSocketConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
if ($userId > 0) {
$client = $helper->getClientConnect();
$fields = array('magento_url' => new xmlrpcval($mage_url, "string"));
$msg2 = new xmlrpcmsg('execute');
$msg2->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg2->addParam(new xmlrpcval($userId, "int"));
$msg2->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg2->addParam(new xmlrpcval("magento.configure", "string"));
$msg2->addParam(new xmlrpcval("fetch_connection_info", "string"));
$msg2->addParam(new xmlrpcval($fields, "struct"));
$resp = $client->send($msg2);
$data = $resp->value()->scalarval();
if ($data) {
$this->ERP_CATEG = $data['category']->me['array'][0]->me['int'];
$this->ERP_LANG = $data['language']->me['string'];
$this->ERP_WAREHOUSE = $data['warehouse_id']->me['array'][0]->me['int'];
$this->ERP_INSTANCE = $data['id']->me['int'];
$this->setToSession();
return true;
}
}
return false;
}
开发者ID:kozinthetdbp,项目名称:shopmyar,代码行数:30,代码来源:Data.php
示例11: forward_request
/**
* Forward an xmlrpc request to another server, and return to client the response received.
* @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
* @return xmlrpcresp
*/
function forward_request($m)
{
// create client
$timeout = 0;
$url = php_xmlrpc_decode($m->getParam(0));
$c = new xmlrpc_client($url);
if ($m->getNumParams() > 3) {
// we have to set some options onto the client.
// Note that if we do not untaint the received values, warnings might be generated...
$options = php_xmlrpc_decode($m->getParam(3));
foreach ($options as $key => $val) {
switch ($key) {
case 'Cookie':
break;
case 'Credentials':
break;
case 'RequestCompression':
$c->setRequestCompression($val);
break;
case 'SSLVerifyHost':
$c->setSSLVerifyHost($val);
break;
case 'SSLVerifyPeer':
$c->setSSLVerifyPeer($val);
break;
case 'Timeout':
$timeout = (int) $val;
break;
}
// switch
}
}
// build call for remote server
/// @todo find a weay to forward client info (such as IP) to server, either
/// - as xml comments in the payload, or
/// - using std http header conventions, such as X-forwarded-for...
$method = php_xmlrpc_decode($m->getParam(1));
$pars = $m->getParam(2);
$m = new xmlrpcmsg($method);
for ($i = 0; $i < $pars->arraySize(); $i++) {
$m->addParam($pars->arraymem($i));
}
// add debug info into response we give back to caller
xmlrpc_debugmsg("Sending to server {$url} the payload: " . $m->serialize());
return $c->send($m, $timeout);
}
开发者ID:5haman,项目名称:knowledgetree,代码行数:51,代码来源:proxy.php
示例12: createOdooOrder
public function createOdooOrder($This_order, $pricelist_id, $erpAddressArray)
{
$odoo_order_id = 0;
$partner_id = $erpAddressArray[0];
$partner_invoice_id = $erpAddressArray[1];
$partner_shipping_id = $erpAddressArray[2];
$increment_id = $This_order->getIncrementId();
$helper = Mage::helper('magerpsync/connection');
$client = $helper->getClientConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$warehouse_id = Mage::getSingleton('adminhtml/session')->getErpWarehouse();
$order_array = array('partner_id' => new xmlrpcval($partner_id, "int"), 'partner_invoice_id' => new xmlrpcval($partner_invoice_id, "int"), 'partner_shipping_id' => new xmlrpcval($partner_shipping_id, "int"), 'pricelist_id' => new xmlrpcval($pricelist_id, "int"), 'date_order' => new xmlrpcval($This_order->getCreatedAt(), "string"), 'client_order_ref' => new xmlrpcval($increment_id, "string"), 'warehouse_id' => new xmlrpcval($warehouse_id, "int"), 'channel' => new xmlrpcval('magento', "string"));
/* Adding Shipping Information*/
if ($This_order->getShippingMethod()) {
$shipping_method = $This_order->getShippingMethod();
$shipping_code = explode('_', $shipping_method);
if ($shipping_code) {
$shipping_code = $shipping_code[0];
$erp_carrier_id = Mage::getModel('magerpsync/carrier')->checkSpecificCarrier($shipping_code);
if ($erp_carrier_id > 0) {
$order_array['carrier_id'] = new xmlrpcval($erp_carrier_id, "int");
}
}
}
/* Adding Payment Information*/
$payment_method = $This_order->getPayment()->getMethodInstance()->getTitle();
if ($payment_method) {
$payment_info = 'Payment Information:- ' . $payment_method;
$order_array['note'] = new xmlrpcval($payment_info, "string");
}
/* Adding Store Information */
$store_id = $This_order->getStoreId();
$collection = Mage::getModel('mobmultishop/mobmultishop')->getCollection()->addFieldToFilter('mage_store_id', array('eq' => $store_id));
foreach ($collection as $col) {
$erp_store_id = $col->getOdooStoreId();
$order_array['wk_shop'] = new xmlrpcval($erp_store_id, "int");
}
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg->addParam(new xmlrpcval("sale.order", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($order_array, "struct"));
$resp = $client->send($msg);
if ($resp->faultcode()) {
$error = "Export Error, Order " . $increment_id . " >>" . $resp->faultString();
Mage::log($error, null, 'odoo_connector.log');
} else {
$odoo_order_id = $resp->value()->me["int"];
}
return $odoo_order_id;
}
开发者ID:babycarenl,项目名称:360,代码行数:53,代码来源:Order.php
示例13: atheme
function atheme($hostname, $port, $path, $sourceip, $username, $password, $service, $command, $params)
{
$message = new xmlrpcmsg("atheme.login");
$message->addParam(new xmlrpcval($username, "string"));
$message->addParam(new xmlrpcval($password, "string"));
$client = new xmlrpc_client($path, $hostname, $port);
$response = $client->send($message);
$session = NULL;
if (!$response->faultCode()) {
$session = explode("<string>", $response->serialize());
$session = explode("</string", $session[1]);
$session = $session[0];
} else {
return "Authorisation failed";
}
$message = new xmlrpcmsg("atheme.command");
$message->addParam(new xmlrpcval($session, "string"));
$message->addParam(new xmlrpcval($username, "string"));
$message->addParam(new xmlrpcval($sourceip, "string"));
$message->addParam(new xmlrpcval($service, "string"));
$message->addParam(new xmlrpcval($command, "string"));
if ($params != NULL) {
if (sizeof($params) < 2) {
foreach ($params as $param) {
$message->addParam(new xmlrpcval($param, "string"));
}
} else {
$firstparam = $params[0];
$secondparam = "";
for ($i = 1; $i < sizeof($params); $i++) {
$secondparam .= $params[$i] . " ";
}
$message->addParam(new xmlrpcval($firstparam, "string"));
$message->addParam(new xmlrpcval($secondparam, "string"));
}
$response = $client->send($message);
}
if (!$response->faultCode()) {
return $response->serialize();
} else {
return "Command failed: " . $response->faultString();
}
}
开发者ID:byteturtle,项目名称:atheme,代码行数:43,代码来源:atheme.php
示例14: call
function call($url, $method, $params)
{
// xmlrpc encode parameters
for ($i = 0; $i < count($params); $i++) {
if (get_class($params[$i]) != 'xmlrpcval') {
$params[$i] = xmlrpc_encode($params[$i]);
}
}
// send request
$message = new xmlrpcmsg($method, $params);
if ($this->debug) {
// $this->display_xml($message->serialize());
print "<PRE>" . htmlentities($message->serialize()) . "</PRE>\n";
//("XML-RPC message:\n $message->serialize()",0);
}
$addr = parse_url($url);
$client = new xmlrpc_client($url, $addr['host'], $addr['port']);
if ($this->debug) {
$client->setDebug(1);
}
debug("XML-RPC", "call to " . $url);
$response = $client->send($message);
if ($this->debug) {
print "<PRE>" . htmlentities($response->serialize()) . "</PRE>\n";
}
// process response
//debug("XML-RPC Response", $response->serialize());
if (!$response) {
addError("No response: probably host is unreachable");
} elseif ($response->faultCode() > 0) {
// there was an error
addError("Error response: " . $response->faultCode() . " " . $response->faultString());
} else {
$retval = $response->value();
if ($retval) {
$retval = xmlrpc_decode($retval);
}
//debug("Response", $retval);
return $retval;
}
return NULL;
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:42,代码来源:rpc_Utils.class.php
示例15: Erp_customer_create
public function Erp_customer_create($customer_array, $mage_customer_id, $mage_address_id)
{
$odoo_id = 0;
$helper = Mage::helper('magerpsync/connection');
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$client = $helper->getClientConnect();
$context = $helper->getOdooContext();
$customer = Mage::getModel('customer/customer')->load($mage_customer_id);
$mage_id = $customer->getStoreId();
$language_mapping = Mage::getModel('mobmultilang/mobmultilang')->getCollection()->addFieldToFilter('mage_store_id', array('eq' => $mage_id));
$erp_lang = '';
foreach ($language_mapping as $mapping) {
$erp_lang = $mapping->getOdooLang();
}
$customer_array['lang'] = new xmlrpcval($erp_lang, "string");
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg->addParam(new xmlrpcval("res.partner", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($customer_array, "struct"));
$msg->addParam(new xmlrpcval($context, "struct"));
$resp = $client->send($msg);
if ($resp->faultCode()) {
$error = "Export Error, Customer Id " . $mage_customer_id . "(" . $mage_address_id . ") >>" . $resp->faultString();
$response['odoo_id'] = 0;
$response['error'] = $error;
Mage::log($error, null, 'odoo_connector.log');
} else {
$odoo_id = $resp->value()->me["int"];
/* entry inside Mapping table*/
if ($odoo_id && $mage_customer_id && $mage_address_id) {
$mapping_data = array('erp_customer_id' => $odoo_id, 'mage_customer_id' => $mage_customer_id, 'mage_address_id' => $mage_address_id, 'created_by' => $helper::$mage_user);
Mage::getModel("magerpsync/magerpsync")->mappingerp($mapping_data);
if ($odoo_id > 0 && $mage_address_id) {
$map_array = array('cus_name' => new xmlrpcval($odoo_id, "int"), 'oe_customer_id' => new xmlrpcval($odoo_id, "int"), 'mag_customer_id' => new xmlrpcval($mage_customer_id, "string"), 'mag_address_id' => new xmlrpcval($mage_address_id, "string"), 'created_by' => new xmlrpcval($helper::$mage_user, "string"), 'instance_id' => $context['instance_id']);
$map = new xmlrpcmsg('execute');
$map->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$map->addParam(new xmlrpcval($userId, "int"));
$map->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$map->addParam(new xmlrpcval("magento.customers", "string"));
$map->addParam(new xmlrpcval("create", "string"));
$map->addParam(new xmlrpcval($map_array, "struct"));
$msg->addParam(new xmlrpcval($context, "struct"));
$resp = $client->send($map);
}
}
}
return $odoo_id;
}
开发者ID:babycarenl,项目名称:360,代码行数:51,代码来源:Commonsocket.php
示例16: doPing
function doPing($title, $URI)
{
include "include/xmlrpc.inc";
$client = new xmlrpc_client("http://sindice.com/xmlrpc/api");
$payload = new xmlrpcmsg("weblogUpdates.ping");
$payload->addParam(new xmlrpcval($title));
$payload->addParam(new xmlrpcval($URI));
$response = $client->send($payload);
$xmlresponsestr = $response->serialize();
$xml = simplexml_load_string($xmlresponsestr);
$result = $xml->xpath("//value/boolean/text()");
if ($result) {
if ($result[0] == "0") {
// echo "<p>Submitting $URI to $servicetitle succeeded.</p>";
return;
}
} else {
$err = "Error Code: " . $response->faultCode() . "<br /> Error Message: " . $response->faultString();
// echo "<p>Failed to submit $URI to $servicetitle.</p>";
}
}
开发者ID:trevorlazarus,项目名称:discover-me-semantically,代码行数:21,代码来源:sindicePing.php
示例17: run
private function run($service, $command, $params)
{
if (!$this->ci->config->item('atheme_enabled')) {
return;
}
$hostname = $this->ci->config->item('atheme_server');
$port = $this->ci->config->item('atheme_port');
$path = $this->ci->config->item('atheme_path');
$username = $this->ci->config->item('atheme_username');
$password = $this->ci->config->item('atheme_password');
$sourceip = '127.0.0.1';
$message = new xmlrpcmsg("atheme.login");
$message->addParam(new xmlrpcval($username, "string"));
$message->addParam(new xmlrpcval($password, "string"));
$client = new xmlrpc_client($path, $hostname, $port);
$response = $client->send($message);
$session = NULL;
if (!$response->faultCode()) {
$session = explode("<string>", $response->serialize());
$session = explode("</string", $session[1]);
$session = $session[0];
} else {
return "Authorization failed";
}
$message = new xmlrpcmsg("atheme.command");
$message->addParam(new xmlrpcval($session, "string"));
$message->addParam(new xmlrpcval($username, "string"));
$message->addParam(new xmlrpcval($sourceip, "string"));
$message->addParam(new xmlrpcval($service, "string"));
$message->addParam(new xmlrpcval($command, "string"));
if ($params != NULL) {
foreach ($params as $param) {
$message->addParam(new xmlrpcval($param, "string"));
}
$response = $client->send($message);
}
if (!$response->faultCode()) {
return $response->serialize();
} else {
return "Command failed: " . $response->faultString();
}
}
开发者ID:nodecast,项目名称:projectNarwhal,代码行数:42,代码来源:atheme.php
示例18: _mapOnErp
protected function _mapOnErp($mage_id, $erp_id)
{
$helper = Mage::helper('magerpsync/connection');
$helper->getSocketConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
if ($userId > 0) {
$client = $helper->getClientConnect();
$map_array = array('cat_name' => new xmlrpcval($erp_id, "int"), 'oe_category_id' => new xmlrpcval($erp_id, "int"), 'mag_category_id' => new xmlrpcval($mage_id, "int"), 'created_by' => new xmlrpcval('Manual Mapping', "string"));
$catg_map = new xmlrpcmsg('execute');
$catg_map->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$catg_map->addParam(new xmlrpcval($userId, "int"));
$catg_map->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$catg_map->addParam(new xmlrpcval("magento.category", "string"));
$catg_map->addParam(new xmlrpcval("create", "string"));
$catg_map->addParam(new xmlrpcval($map_array, "struct"));
$catg_map_resp = $client->send($catg_map);
}
}
开发者ID:kozinthetdbp,项目名称:shopmyar,代码行数:18,代码来源:CategoryController.php
示例19: getErpTaxArray
public static function getErpTaxArray()
{
$Tax = array();
$helper = Mage::helper('magerpsync/connection');
$helper->getSocketConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
if ($userId > 0) {
if (!Mage::helper('magerpsync')->CheckOdooActiveConfig()) {
array_push($Category, array('label' => Mage::helper('magerpsync')->__('Check Odoo Configuration Default Settings'), 'value' => ''));
return $Category;
}
$context = $helper->getOdooContext();
$client = $helper->getClientConnect();
$key = array();
$msg_ser = new xmlrpcmsg('execute');
$msg_ser->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg_ser->addParam(new xmlrpcval($userId, "int"));
$msg_ser->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg_ser->addParam(new xmlrpcval("account.tax", "string"));
$msg_ser->addParam(new xmlrpcval("search", "string"));
$msg_ser->addParam(new xmlrpcval($key, "array"));
$resp0 = $client->send($msg_ser);
if ($resp0->faultCode()) {
array_push($Tax, array('label' => Mage::helper('magerpsync')->__('Not Available(Error in Fetching)'), 'value' => ''));
return $Tax;
} else {
$val = $resp0->value()->me['array'];
$key1 = array(new xmlrpcval('id', 'int'), new xmlrpcval('name', 'string'), new xmlrpcval('amount', 'string'));
$msg_ser1 = new xmlrpcmsg('execute');
$msg_ser1->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg_ser1->addParam(new xmlrpcval($userId, "int"));
$msg_ser1->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg_ser1->addParam(new xmlrpcval("account.tax", "string"));
$msg_ser1->addParam(new xmlrpcval("read", "string"));
$msg_ser1->addParam(new xmlrpcval($val, "array"));
$msg_ser1->addParam(new xmlrpcval($key1, "array"));
$msg_ser1->addParam(new xmlrpcval($context, "struct"));
$resp1 = $client->send($msg_ser1);
if ($resp1->faultCode()) {
$msg = Mage::helper('magerpsync')->__('Not Available- Error: ') . $resp1->faultString();
array_push($Tax, array('label' => $msg, 'value' => ''));
return $Tax;
} else {
$value_array = $resp1->value()->scalarval();
$count = count($value_array);
for ($x = 0; $x < $count; $x++) {
$id = $value_array[$x]->me['struct']['id']->me['int'];
$name = $value_array[$x]->me['struct']['name']->me['string'] . ' (' . $value_array[$x]->me['struct']['amount']->me['double'] * 100 . '%)';
array_push($Tax, array('value' => $id, 'label' => Mage::helper('adminhtml')->__($name)));
}
}
}
array_unshift($Tax, array('label' => Mage::helper('magerpsync')->__('--Select Odoo Tax--'), 'value' => ''));
return $Tax;
} else {
array_push($Tax, array('label' => Mage::helper('magerpsync')->__('Not Available(Connection Error)'), 'value' => ''));
return $Tax;
}
}
开发者ID:babycarenl,项目名称:360,代码行数:59,代码来源:Tax.php
示例20: _try_multicall
/**
* Attempt to boxcar $msgs via system.multicall.
* Returns either an array of xmlrpcreponses, an xmlrpc error response
* or false (when received response does not respect valid multicall syntax)
* @access private
*/
function _try_multicall($msgs, $timeout, $method)
{
// Construct multicall message
$calls = array();
foreach ($msgs as $msg) {
$call['methodName'] = new xmlrpcval($msg->method(), 'string');
$numParams = $msg->getNumParams();
$params = array();
for ($i = 0; $i < $numParams; $i++) {
$params[$i] = $msg->getParam($i);
}
$call['params'] = new xmlrpcval($params, 'array');
$calls[] = new xmlrpcval($call, 'struct');
}
$multicall = new xmlrpcmsg('system.multicall');
$multicall->addParam(new xmlrpcval($calls, 'array'));
// Attempt RPC call
$result =& $this->send($multicall, $timeout, $method);
if ($result->faultCode() != 0) {
// call to system.multicall failed
return $result;
}
// Unpack responses.
$rets = $result->value();
if ($this->return_type == 'xml') {
return $rets;
} else {
if ($this->return_type == 'phpvals') {
///@todo test this code branch...
$rets = $result->value();
if (!is_array($rets)) {
return false;
// bad return type from system.multicall
}
$numRets = count($rets);
if ($numRets != count($msgs)) {
return false;
// wrong number of return values.
}
$response = array();
for ($i = 0; $i < $numRets; $i++) {
$val = $rets[$i];
if (!is_array($val)) {
return false;
}
switch (count($val)) {
case 1:
if (!isset($val[0])) {
return false;
// Bad value
}
// Normal return value
$response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');
break;
case 2:
/// @todo remove usage of @: it is apparently quite slow
$code = @$val['faultCode'];
if (!is_int($code)) {
return false;
}
$str = @$val['faultString'];
if (!is_string($str)) {
return false;
}
$response[$i] = new xmlrpcresp(0, $code, $str);
break;
default:
return false;
}
}
return $response;
} else {
$rets = $result->value();
if ($rets->kindOf() != 'array') {
return false;
// bad return type from system.multicall
}
$numRets = $rets->arraysize();
if ($numRets != count($msgs)) {
return false;
// wrong number of return values.
}
$response = array();
for ($i = 0; $i < $numRets; $i++) {
$val = $rets->arraymem($i);
switch ($val->kindOf()) {
case 'array':
if ($val->arraysize() != 1) {
return false;
// Bad value
}
// Normal return value
$response[$i] = new xmlrpcresp($val->arraymem(0));
break;
//.........这里部分代码省略.........
开发者ID:gggeek,项目名称:ggwebservices,代码行数:101,代码来源:xmlrpc.inc.php
注:本文中的xmlrpcmsg类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论