4
votes

I want to send data(just a name for name) to my OpenErp (Odoo 9 ) through my Android application . I create a module that i inserted successfully in my Odoo Account ,tht only have the field "name" . but i have this problems in 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);


}

 }

and this is my logcat:

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 found

Error:(67, 34) error: cannot access XmlRpcController class file for org.apache.xmlrpc.common.XmlRpcController not found

1
hello..sir i have the same problem ...may i know how you have solved the problemVivek Patel
@Steven7 have u got any solution for that.I am also facing the same issueShubhank Gupta
@ShubhankGupta , U need to dowload the jar file xmlrpc-common from [here ] (java2s.com/Code/Jar/x/Downloadxmlrpccommon31jar.htm ) coz it has these files u need : accessXmlRpcHttpRequestConfig,XmlRpcHttpRequestConfigImpl and XmlRpcController . It worked for meSteven7
@VivekPatel Same for you my friendSteven7
thanks @Steven7 its work for me alsoShubhank Gupta

1 Answers

0
votes

The error message sounds like some library file is missing. You can download the XMLRPC library at https://ws.apache.org/xmlrpc/download.html. Or,

As @Steven7 said in the comment:

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 and XmlRpcController .