我想通过我的 Android 应用程序将数据(只是名称的名称)发送到我的 OpenErp (Odoo 9)。我在我的 Odoo 帐户中创建了一个成功插入的模块,它只有字段“名称”。但我在 Android Studio 中遇到了这个问题:
cannot access XmlRpcController ,XmlRpcHttpRequestConfig !!
Button click ;
static final String TAG = "OERP";
final String url = "l";
final String db = "database";
final String username = "admin";
final String password = "123";
static final XmlRpcClient client = new XmlRpcClient();
static final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
click=(Button)findViewById( R.id.button);
View.OnClickListener l=new View.OnClickListener() {
@Override
public void onClick(View v) {
try{
Map emptyMap = Collections.emptyMap();
**/*first error*/** common_config.setServerURL(
new URL(String.format("%s/xmlrpc/2/common", url)));
**/*second error*/** int uid = (int) client.execute(
common_config, "authenticate", asList(
db, username, password, emptyMap));
**/*third error*/** final XmlRpcClient models = new XmlRpcClient() {{
setConfig(new XmlRpcClientConfigImpl() {{
setServerURL(new URL(String.format("%s/xmlrpc/2/object", url)));
}});
}};
final Integer id = (Integer) models.execute("execute_kw", asList(
db, uid, password,
"pointage.task", "create",
asList(new HashMap() {{
put("name", "New Partner");
}})
));
} catch (MalformedURLException e){
Log.e(TAG,"/ :: "+e.getMessage(),e);
}
}
};click.setOnClickListener(l);
}
}
这是我的日志:
Error:(60, 19) error: cannot accessXmlRpcHttpRequestConfig class file for org.apache.xmlrpc.common.XmlRpcHttpRequestConfig not found
Error:(62, 28) error: cannot access XmlRpcHttpRequestConfigImpl class file for
org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl not foundError:(67, 34) error: cannot access XmlRpcController class file for org.apache.xmlrpc.common.XmlRpcController not found
最佳答案
错误消息听起来像是缺少某些库文件。您可以在 https://ws.apache.org/xmlrpc/download.html 下载 XMLRPC 库.或者,
正如@Steven7 在评论中所说:
U need to dowload the jar file xmlrpc-common from http://java2s.com/Code/Jar/x/Downloadxmlrpccommon31jar.htm, coz it has these files u need :
accessXmlRpcHttpRequestConfig
,XmlRpcHttpRequestConfigImpl
andXmlRpcController
.
关于android - 无法访问 XmlRpcController ,XmlRpcHttpRequestConfig,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36037771/