Hey there,
i'm trying to build an app, which can interact with an webserver. It's already able to download XML files with the get() Method. But i want to upload XML Data too. I haven't found any examples for a put() operation yet and all things i tried failed.
I tried it this way:
I get the following Error LogCode:private class SendXMLActivity extends AsyncTask<Message,Void, String> { protected String doInBackground(Message...msg) { String str; try { // Create a new RestTemplate instance RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter()); restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); restTemplate.put("http://10.0.2.2:8080/testservlet/static",msg); str="XML gesendet!"; } catch(Exception e) { Log.e("SendXML",e.getMessage(),e); str=e.getMessage(); } return str; } protected void onPostExecute(String response) { Toast.makeText(TestAppActivity.this,response, Toast.LENGTH_SHORT).show(); } }
It seems that the put operation is'nt the problem right now. But which Message Converter should I use? I tried the same request once just with a string, wich caused an error 403-forbidden. I'm just starting to make android apps and using spring, so don't blame me if my Problems are too obviousCode:Could not write request: no suitable HttpMessageConverter found for Request type.
Hope you can help me.
regards
Erik


.
Reply With Quote