View Full Version : sending xml data to server

Jun 23, 2008, 05:04 AM
Hi all , i want to send some xml data to server.So how should i send it and using which api's.

Jun 23, 2008, 05:13 AM
I think we'll need more details than that. Are we talking Cocoa, Carbon, Web App, scripting language (which one)? What protocol is the server expecting to receive this over (http? ftp? sftp? httpxmlrequest from a web page?)

Jun 23, 2008, 06:12 AM
Hi ,
I am using cocoa and server excepts http request.

Jun 23, 2008, 06:46 AM
Then the easiest way is probably to embed a webview (doesn't have to be visible) and use it to handle all the http bit.

Jun 23, 2008, 07:34 AM
I do no how to use webview to transfer the data.Please guide me how to do this.I saw there is HttpMethod which is by default get.How to set it to post and make use of it in transfering data to server.

Jun 23, 2008, 07:42 AM
You can't directly. You will have to craft a webpage that will be contained in the webview that will either use JavaScript to do an XMLHttpRequest if that's what the server expects, or using a form to upload as multipart MIME if that's what the server expects. In these cases please read the documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/DOMObjCBindings.html#//apple_ref/doc/uid/TP30001206)

If the server expects a raw HTTP Upload then you are pretty much on your own! Cocoa does not provide an easy solution to this. I'd suggest ConnectionKit (http://opensource.utr-software.com/connection/).

Note I am having to be vague: you are not providing sufficient detail on what you are trying to do or what the server expects. If you really want help I'd suggest you put more effort into asking the question and telling us exactly and precisely what you want and what you've already tried (and if you've not tried anything go and try some stuff before posting a question).

Jun 23, 2008, 08:07 AM
Thanks for reply.
I had one more doubt abt threads.can we run the applications in background.I am developing app which has to download for every 24 hours some xml files from net.so how to do this.If it is not possiable by threads then can i use timer .If so then how to do this.

Jun 23, 2008, 08:12 AM
can we run the applications in background

On a Mac yes, on an iPhone no. You've not said which you are using. As I said above have you sat down and tried either threads or timers? Either can be made to work. I'm not about to write your code for you. It sounds like this is a commercial application and asking us to do you job is not really on is it?