Magento API v1 之webservice

简介:

sales/etc/api.xml

Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <config>  
  3.     <api>  
  4.         <resources>  
  5.             <sales_order translate="title" module="sales">  
  6.                 <model>sales/order_api</model>  
  7.                 <title>Order API</title>  
  8.                 <acl>sales/order</acl>  
  9.                 <methods>  
  10.                     <list translate="title" module="sales">  
  11.                         <title>Retrieve list of orders by filters</title>  
  12.                         <method>items</method>  
  13.                         <acl>sales/order/info</acl>  
  14.                     </list>  
  15.                     <info translate="title" module="sales">  
  16.                         <title>Retrieve order information</title>  
  17.                         <acl>sales/order/info</acl>  
  18.                     </info>  
  19.                 </methods>  
  20.                 <faults module="sales">  
  21.                     <not_exists>  
  22.                         <code>100</code>  
  23.                         <message>Requested order not exists.</message>  
  24.                     </not_exists>  
  25.                     <filters_invalid>  
  26.                         <code>101</code>  
  27.                         <message>Invalid filters given. Details in error message.</message>  
  28.                     </filters_invalid>  
  29.                     <data_invalid>  
  30.                         <code>102</code>  
  31.                         <message>Invalid data given. Details in error message.</message>  
  32.                     </data_invalid>  
  33.                     <status_not_changed>  
  34.                         <code>103</code>  
  35.                         <message>Order status not changed. Details in error message.</message>  
  36.                     </status_not_changed>  
  37.                 </faults>  
  38.             </sales_order>  
  39.         </resources>  
  40.         <acl> <!-- 后台管理中显示权限 -->  
  41.             <resources>  
  42.                 <sales translate="title" module="sales">  
  43.                     <title>Sales</title>  
  44.                     <sort_order>2</sort_order>  
  45.                     <order translate="title" module="sales">  
  46.                         <title>Order</title>  
  47.                         <change translate="title" module="sales">  
  48.                             <title>改变状态,添加备注</title>  
  49.                         </change>  
  50.                         <info translate="title" module="sales">  
  51.                             <title>获取订单信息</title>  
  52.                         </info>  
  53.                     </order>  
  54.                 </sales>  
  55.             </resources>  
  56.         </acl>  
  57.     </api>  
  58. </config>  

sales/model/order/api.php服务端代码 有<method>items</method>

Java代码   收藏代码
  1. public function items($filters = null){  
  2. ..................  
  3.     return $result;  
  4. }  
  5. public function info($orderIncrementId){  
  6. ..................  
  7.     return $result;  
  8. }  

后台配置client的访问用户和权限,直接用api的方法

Java代码   收藏代码
  1. Mage::getModel('sales/order_api')->items();  

 

系统->网络服务->用户

系统->网络服务->角色  角色资源

client端代码

Java代码   收藏代码
  1. public function actionView()  
  2. {  
  3.     define("TEST_API_URL""http://www.test.com/api/?wsdl");  
  4.     $client  = new SoapClient(TEST_API_URL, array("trace" => 0"exceptions" => 0));  
  5.     $client->soap_defencoding = 'utf-8';  
  6.     $client->decode_utf8 = false;  
  7.   
  8.     $session = $client->login(API_USER,API_KEY); //需后台配置  
  9.     $order_id = Yii::app()->request->getParam('id');  
  10.     $result = $client->call($session, 'sales_order.list', array($order_id));  
  11. //print_r($result);   
  12.     $client->endSession($session);  
  13. }  
相关文章
|
5天前
|
存储 监控 BI
HIS系统是什么?一套前后端分离云HIS系统源码 接口技术RESTful API + WebSocket + WebService
医院管理信息系统(全称为Hospital Information System)即HIS系统。 常规模版包括门诊管理、住院管理、药房管理、药库管理、院长查询、电子处方、物资管理、媒体管理等,为医院管理提供更有力的保障。 HIS系统以财务信息、病人信息和物资信息为主线,通过对信息的收集、存储、传递、统计、分析、综合查询、报表输出和信息共享,及时为医院领导及各部门管理人员提供全面、准确的各种数据。 门诊医生工作站采用下拉式汉化菜单,界面友好,实用性强,设有与门诊挂号收费系统、医技科室信息系统、住院结算信息系统的软件接口。
37 1
|
API 数据格式 XML
ArcGIS API for Silverlight 调用WebService出现跨域访问报错的解决方法
原文:ArcGIS API for Silverlight 调用WebService出现跨域访问报错的解决方法       群里好几个朋友都提到过这样的问题,说他们在Silverlight中调用了WebService方法,总报这个错误,贴图如下: 解决办法:      1、确定你的Silver...
1147 0
|
Java 关系型数据库 API
Magento SOAP API V2 开放接口修改订单状态
//==========Magento版本号1.9.1===============// 一、 创建 Web Service 角色 1、进入后台如下图找到system 2、新建角色名如下图...
1285 0
|
XML API 网络架构
WCF 、Web API 、 WCF REST 和 Web Service 的区别
  The .Net framework has a number of technologies that allow you to create HTTP services such as Web Service, WCF and now Web API.
1386 0
|
API 数据格式 XML
ArcGIS API for Silverlight 调用WebService出现跨域访问报错的解决方法
      群里好几个朋友都提到过这样的问题,说他们在Silverlight中调用了WebService方法,总报这个错误,贴图如下: 解决办法:      1、确定你的Silverligh...
737 0
|
XML API 网络架构
转 Difference between WCF and Web API and WCF REST and Web Service
http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.
921 0
|
3天前
|
监控 安全 数据挖掘
Email 接口API有哪些?具体分析一下阿里云和AOK的优点
本文介绍了常见的Email接口API,如阿里云邮件推送、AOKSend、SendGrid、Mailgun和Amazon SES。阿里云API以其高稳定性和数据分析功能脱颖而出,支持批量发送和多语言;而AOKSend API以易于集成、高安全性和优秀客户支持为亮点。企业在选择时应考虑自身需求和预算,以优化邮件营销效果。

热门文章

最新文章