This is my xml
NSString *Message = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<query>\n"
"<IdCategory>1088</IdCategory>\n"
"</query>\n"];
NSURL *url = [NSURL URLWithString:@"http://bvd.vndsupport.com/_ws/api/categories/index.asp"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [Message length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST开发者_开发问答"];
[theRequest setHTTPBody: [Message dataUsingEncoding:NSUTF8StringEncoding]];
NSString *returnString = [[NSString alloc] initWithData:[NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil] encoding:NSUTF8StringEncoding];
NSLog(@"%@",returnString);
I have simply pass this category id and get the result but returnString
always display all category details. I didn't get an exact result. Is this the correct way of passing xml data to webservice?
go and search for 'wsdl2objc' it does it all for you if you wanted to do soap requests.
This code will work perfectly. the problem is webservice page
精彩评论