Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shilpa

macrumors member
Original poster
May 29, 2008
33
0
Hi all , i want to send some xml data to server.So how should i send it and using which api's.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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?)
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.
 

shilpa

macrumors member
Original poster
May 29, 2008
33
0
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.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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

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.

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).
 

shilpa

macrumors member
Original poster
May 29, 2008
33
0
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.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.