Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 04-22-2009, 07:26 AM   #52 (permalink)
gagandeepb
Registered Member
 
Join Date: Sep 2008
Posts: 76
Default

Quote:
Originally Posted by ashwanik04 View Post
Hello :
I used the code posted in this thread. It helped me a lot.
But now I am facing an issue please help me.
I want to send data to web service in the form of xml like

<son>
<child name="XYZ">
</son>
and get back some information related to child.
But 0 byte response is received please help me in fixing this issue
Thanks in advance
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
gagandeepb is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,258
Threads: 39,041
Posts: 171,229
Top Poster: smasher (2,573)
Welcome to our newest member, bburd
Powered by vBadvanced CMPS v3.1.0

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