Hi all,
I am working on an image upload from iphone to an C# web service. Here is the iPhone code
NSString *soapMessage=[NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<PutImage xmlns=\"http://tempuri.org/\">\n"
"<ImgInputString>%@</ImgInputString>\n"
"</PutImage>\n"
"</soap:Body>\n"
"</soap:Envelope>\n",imageString];
NSLog(soapMessage);
NSURL *url=[NSURL URLWithString:@"http://192.168.2.7/ImageWebService/Service1.asmx"];
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:url];
NSString *msgLength=[NSString stringWithFormat:@"%d",[soapMessage length]];
[theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"http://tempuri.org/PutImage" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
But when i am accessing the server I am getting this error message. But when i copy and paste the image string in the webservice directly I get the image. It's only from the iPhone it is throwing the error.
Please help