From: James F. <jam...@gm...> - 2010-03-30 15:08:29
|
On Tue, Mar 30, 2010 at 3:55 PM, Jérémy Cazaux <jer...@gm...> wrote: > Hello, > > I have a communication problem between android and eXist. I need to send > information/file from android to eXist. > > My terminal in Android should be able to submit files of type XML to eXist > database. I'm using android in VPN. > I tried using the PUT&GET method of HTTP (i think GET&PUT method are aviable > with eXIst, see=>http://exist.sourceforge.net/devguide_rest.htm ): ok first step, u sure you can access eXist e.g. u sending right creds or have it setup to be writeable by guest ? > > private static String url = "http://localhost:8080/exist/rest/db/"; you will need to give a name to the new document e.g. http://localhost:8080/exist/rest/db/test.xml > HttpClient httpclient = new DefaultHttpClient (); > HttpPut httpput = new HttpPut (url); > > try ( > httpput.setEntity (new StringEntity ( "<the goes here> xml")); ummm, unsure of what this line is ... cause its not xml ... perhaps u are trying to upload binary document ? > httpput.setHeader ( "Content-Type", "text / xml"); > HttpResponse response; > response = httpclient.execute (httpput); > > ) Catch (ClientProtocolException e) ( > e.printStackTrace (); > > ) Catch (IOException e) ( > e.printStackTrace (); > ) > > I get no result and no error in compilation or execution. > > I therefore ask you one example of Java code, or if an explanation of the > "right way" to use. > > Thanks you for your help a simple HTTP PUT should work but u need to check access, make sure u are slinging xml (if thats your intention), give it a name ... u sure u dont see anything in the eXist logs (usually here webapp/WEB-INF/logs/exist.log) hth, James Fuller > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Exist-development mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-development > > |