Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSURL *url = [NSURL URLWithString:@"http://webservice.net2survey.com/servicejson.svc/basic"];
- NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
- [request setHTTPMethod:@"POST"];
- [request setValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
- [request setValue:@"http://webservice.net2survey.com/servicejson.svc/basic" forHTTPHeaderField:@"SOAPAction"];
- NSString *soapMessage = [NSString stringWithFormat:
- @"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope\">"
- "<ToPostalCode>734301</ToPostalCode>"
- "<FromPostalCode>700001</FromPostalCode>"
- "<Weight>Africa</Weight>"
- "<DeliveryServiceName></DeliveryServiceName>"
- "</SingaporePostalInfoDetailsRequest>"];
- NSString *messageLength = [NSString stringWithFormat:@"%d",[soapMessage length]];
- [request setValue:messageLength forHTTPHeaderField:@"Content-Length"];
- [request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
- NSData *data= [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
- NSString *responseStr=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- NSLog(@"response string is %@",responseStr);
Advertisement
Add Comment
Please, Sign In to add comment