Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 04-22-2009, 08:31 AM   #53 (permalink)
ashwanik04
New Member
 
Join Date: Apr 2009
Posts: 16
Default Send xml data to web service

Quote:
Originally Posted by gagandeepb View Post
Use http post method here in IPhone to send data and add one aspx page in ur webservice and save that post data in to a xml file in page load of aspx page like this.


protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
int streamLength;
int streamRead;
Stream s = Request.InputStream;
streamLength = Convert.ToInt32(s.Length);
Byte[] streamArray = new Byte[streamLength];

streamRead = s.Read(streamArray, 0, streamLength);
for (int i = 0; i < streamLength; i++)
{
sb.Append(Convert.ToChar(streamArray[i]));
}

string strFilePath = Request.PhysicalApplicationPath;
strFilePath = strFilePath + "\\iPhone.xml";

FileStream fs = new FileStream(strFilePath, FileMode.Create, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs);
sw.Write(sb.ToString());
sw.Flush();
sw.Close();
fs.Close();
}

cheers,
Gagandeep
Thanks for your reply.
I forgot to say that the web service is external, I mean it cannot be changed.
So, is there any other way
ashwanik04 is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,742
Threads: 89,197
Posts: 380,549
Top Poster: BrianSlick (7,129)
Welcome to our newest member, MaximT
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:19 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.