2015-03-03 86 views
0

我试图用openERP或odoo与它们的示例一起使用的openERP连接。但是xmlrpc的Apache库,我找不到它。openERP与Android设备连接的库

这里是OpenERP的给人的文档,但它们使用Apache库:https://www.odoo.com/documentation/8.0/api_integration.html

而且库应该下载来自:http://www.apache.org/dyn/closer.cgi/ws/xmlrpc/

但链接给了我404错误的,没有人知道一个好的库/文档以使其与Android设备一起使用?

public class MainActivity extends Activity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 


    OpenErpConnect oc = OpenErpConnect.connect("2x7.13x.xxx.xxx", 8069, "DBNAME", "admin", "xxxxxxxxxxxxxxxx"); 
    List<HashMap<String, Object>> list = oc.read("res.partners", new Integer[] {1, 2, 3}, new String[] {"name"}); 
    String result = ""; 
    for (HashMap<String, Object> item : list) { 
     result += (String)item.get("name")+"\n"; 
    } 
} 


@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.main, menu); 
    return true; 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 
    // Handle action bar item clicks here. The action bar will 
    // automatically handle clicks on the Home/Up button, so long 
    // as you specify a parent activity in AndroidManifest.xml. 
    int id = item.getItemId(); 
    if (id == R.id.action_settings) { 
     return true; 
    } 
    return super.onOptionsItemSelected(item); 
} 
} 

回答

0

您是否试过aXMLRPC?看起来非常强大和简单:https://github.com/timroes/aXMLRPC

+0

叶已经尝试过,但是当我尝试与openERP建立连接时,它给了我一个崩溃。 – 2015-03-03 11:11:00

+0

请提供崩溃堆栈跟踪 – 2015-03-03 11:14:43

+0

我收录了aXMLRPC库,这不会给我一个错误。但是我现在正在实现https://github.com/zikzakmedia/android-openerp类。当我尝试使用该aXMLRPC库连接到openERP时,它无法在call.java中获得userid。 在我的主要活动中,我这样做: OpenErpConnect oc = OpenErpConnect.connect(“ip”,port,“dbname”,“admin”,“pw”);在openERPconnect类中有一行:Integer id =(Integer)client.call(“login”,db,user,pass);这转到XMLRPCclient的调用操作,这给了我一个例外。 – 2015-03-03 11:56:07