this is url :- http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit
download TouchXml freamwork
then #import "TouchXML.h"
/////////////////////////////////////////////////////// in your .h file \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
@interface RootViewController : UIViewController {
NSString *strBarcodeid;
NSMutableData *webData;
NSXMLParser *xmlParser;
NSString *element;
}
-(IBAction)onParse:(id)sender;
/////////////////////////////////////////////////////// in your .m file \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-(IBAction)onClickParse:(id)sender{
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<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"
"<CelsiusToFahrenheit xmlns=\"http://tempuri.org/\">\n" //hear action pass check
"<Celsius>100</Celsius>\n"//HERE PARAMETER PASS
"</CelsiusToFahrenheit>\n" //hear action pass check in link
"</soap:Body>\n"
"</soap:Envelope>\n"
];
NSLog(@"%@",soapMessage);
NSURL *url = [NSURL URLWithString:@"http://www.w3schools.com/webservices/tempconvert.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/CelsiusToFahrenheit" forHTTPHeaderField:@"SOAPAction"]; //hear action pass
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if( theConnection )
{
webData = [[NSMutableData data] retain];
}
else
{
NSLog(@"theConnection is NULL");
}
}
///////////connection delegate method for responce---------
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
webData = [[NSMutableData data] retain];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[webData appendData:data];
NSLog(@">>>>>>>>>>>>>>>>>>>>>>>>");
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"ERROR with theConenction %@",error);
UIAlertView *connectionAlert = [[UIAlertView alloc] initWithTitle:@"Information !" message:@"Internet / Service Connection Error" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[connectionAlert show];
[connectionAlert release];
[connection release];
[webData release];
return;
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *theXML = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
theXML = [theXML stringByReplacingOccurrencesOfString:@">" withString:@">"];
theXML = [theXML stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
NSLog(@"Received data :%@",theXML);
/* CXMLDocument *doc = [[[CXMLDocument alloc] initWithData:webData options:0 error:nil] autorelease];
NSArray *nodes1 = [doc nodesForXPath:@"//return" error:nil];
NSLog(@"node counts : %d", [nodes1 count]);
for (CXMLElement *node in nodes1) {
for(int counter = 0; counter < [node childCount]; counter++) {
if ([[[node childAtIndex:counter] name] isEqualToString:@"username"]) {
NSString *str = [[node childAtIndex:counter] stringValue];
NSLog(@"=====================>>string for username : %@\n", str);
}
}
}*/
[connection release];
[webData release];
}
