Easy. construct your xml into a stringBuffer and then dump it on a HttpEntity object and then use that enity object on a HttpPost object and execute that http method. done.
On Mar 25, 9:18 am, MobDev <[email protected]> wrote: > I'd be interested on how you succeeded with that ? Sending anxml > through a httpPost request ? > I have to do something similar ! > > On 18 mrt, 18:12, KC Dev Android 06 <[email protected]> > wrote: > > > > > Hi, i have managed to figure out how to send anxmlfile using > > httpPost. > > > my next question is how do i do the reverse i.e download a file but > > this time using HttpGet. > > > So far am i on the right track in doing this? > > > httpclient = new DefaultHttpClient(); > > > // Prepare a request object > > get = new HttpGet(url); > > > // Execute the request > > HttpResponse response; > > > try { > > response = httpclient.execute(get); > > > Log.d(TAG, "Response code = " + > > response.getStatusLine().toString()); > > > HttpEntity entity = response.getEntity(); > > > InputStream is = entity.getContent(); > > > FileOutputStream fOut = > > context.openFileOutput(fileName, > > context.MODE_WORLD_READABLE); > > > As you can see, i have stored the contents of the entity in a > > inputstream and i plan to read it byte by byte and transfer the bytes > > into the file output stream object i created just above. is this the > > way to do it? > > > Is their an easier way of simply downloading the whole file and just > > specify the destination? > > > On Mar 17, 3:24 pm, KC Dev Android 06 > > > <[email protected]> wrote: > > > damm i just reported one of your posts as spam by accident. mods > > > ignore that request! > > > > On Mar 17, 3:22 pm, KC Dev Android 06 > > > > <[email protected]> wrote: > > > > i dont know specificaly from the server guys but they said most likely > > > > all i need from them is a http url. They have not indicated how they > > > > will export thexmlstuff but tbh why should i know such things? my > > > > task is to simply send them data in a specific format and that format > > > > is axmlfile customizedxmltags that will later be designed. > > > > > All im expecting from them is maybe some call back saying that the > > > > data i sent to them is fine. thats all i am expecting and i therefore > > > > dont see the need to know exactly what they will do with thatxml > > > > data. > > > > > i should only be concerned on What data and what format they want from > > > > the android device. > > > > > I will check out the above links and see how far that goes for me. i > > > > just wanted to know really if its possible to send anxmlfile via > > > > http. If not then i may need to do it via socket connection. > > > > > On Mar 17, 3:03 pm, Chris Ross <[email protected]> wrote: > > > > > > But, do you know exactly what sort of HTTP operation is expected by > > > > > the server, and how it expects the "xmlfile" to be encoded and > > > > > transmitted? If you do not know these answers, very precisely, you > > > > > won't know how to code you client. > > > > > > As for HTTP and your second question, > > > > > seehttp://www.w3.org/Protocols/rfc2616/rfc2616.htmlandaquickgooglefindshttp://www.jmarshall.com/easy/http/whichmightbeatleast > > > > > as valuable. > > > > > > - Chris > > > > > > On Mar 17, 2010, at 10:50 AM, KC Dev Android 06 wrote: > > > > > > > The server basically expects the contacts stored on a android device > > > > > > in anxmlfile. > > > > > > > So in a HTTP get operation i can send any parameters i want be in a > > > > > >xmlfile, string, int etc? > > > > > > > On Mar 17, 2:44 pm, Chris Ross <[email protected]> wrote: > > > > > >> You can send parameters encoded in the url of an HTTP GET > > > > > >> operation, but I wouldn't suggest using anything long. I would > > > > > >> suggest using an HTTP POST operation, or if you actually want to > > > > > >> treat it as a file, rather than a "blob ofXMLdata", an HTTP PUT. > > > > > >> Most any web server software will know how to handle an HTTP POST, > > > > > >> for sure. > > > > > > >> The question is, what does the server expect? This is much more > > > > > >> an HTTP question than an android question. > > > > > > >> - Chris > > > > > > >> On Mar 17, 2010, at 10:38 AM, KC Dev Android 06 wrote: > > > > > > >>> What im trying to do is simply send axmlfile that i have created > > > > > >>> into a http server. The way i understand http is that the request > > > > > >>> and > > > > > >>> any kind of data ie a name value pair such as a username can be > > > > > >>> added > > > > > >>> and included in the actual url string. > > > > > > >>> my question is, how do you go about constructing a url connection > > > > > >>> with > > > > > >>> anxmlfile added to it? > > > > > > >>> On Mar 17, 2:23 pm, Chris Ross <[email protected]> wrote: > > > > > >>>> You probably want to look at HttpPost or HttpPut, which > > > > > >>>> implement HttpRequest, which is an available parameter to the > > > > > >>>> execute() method in the HttpClient interface. > > > > > > >>>> Not 100% sure what you're trying to do, but that's the path of > > > > > >>>> investigation I'd suggest. > > > > > > >>>> - Chris > > > > > > >>>> On Mar 17, 2010, at 5:14 AM, KC Dev Android 06 wrote: > > > > > > >>>>> Any suggestions? > > > > > > >>>>> On Mar 16, 4:45 pm, KC Dev Android 06 > > > > > >>>>> <[email protected]> wrote: > > > > > >>>>>> Hi, as the title says, is it possible to do so? in the > > > > > >>>>>> examples found > > > > > >>>>>> herehttp://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.... > > > > > > >>>>>> It seems that HttpClient only accepts a String as its > > > > > >>>>>> parameter? how > > > > > >>>>>> do i go about sending/uploading axmlfile using http? > > > > > > >>>>>> thanks in advance. > > > > > > >>>>> -- > > > > > >>>>> You received this message because you are subscribed to the > > > > > >>>>> Google > > > > > >>>>> Groups "Android Beginners" group. > > > > > > >>>>> NEW! Try asking and tagging your question on Stack Overflow at > > > > > >>>>>http://stackoverflow.com/questions/tagged/android > > > > > > >>>>> To unsubscribe from this group, send email to > > > > > >>>>> [email protected] > > > > > >>>>> For more options, visit this group at > > > > > >>>>>http://groups.google.com/group/android-beginners?hl=en > > > > > > >>> -- > > > > > >>> You received this message because you are subscribed to the Google > > > > > >>> Groups "Android Beginners" group. > > > > > > >>> NEW! Try asking and tagging your question on Stack Overflow at > > > > > >>>http://stackoverflow.com/questions/tagged/android > > > > > > >>> To unsubscribe from this group, send email to > > > > > >>> [email protected] > > > > > >>> For more options, visit this group at > > > > > >>>http://groups.google.com/group/android-beginners?hl=en > > > > > > > -- > > > > > > You received this message because you are subscribed to the Google > > > > > > Groups "Android Beginners" group. > > > > > > > NEW! Try asking and tagging your question on Stack Overflow at > > > > > >http://stackoverflow.com/questions/tagged/android > > > > > > > To unsubscribe from this group, send email to > > > > > > [email protected] > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe, reply using "remove me" as the subject.

