Posts

Showing posts with the label WebService

WebService Handler on AFNetworking

Step1 pod 'AFNetworking','~> 2.5' Step 2 #import "AFNetworking.h" @interface WebServiceHandler : NSObject @property ( nonatomic , strong ) AFHTTPRequestOperationManager *reqOperationManager; -( void )call:( eMethodType )methodType withUrl:( NSString *)serviceUrl withParameter:( NSDictionary *)parameters onCompletion:( void (^)( eResponseType responseType, id response))completionBlock; Step 3 #import "WebServiceHandler.h" #import "Reachability.h" #define TIME_OUT 60.0f @implementation WebServiceHandler -( instancetype )init {     self = [ super init ];     if ( self ) {                  _reqOperationManager = [[ AFHTTPRequestOperationManager alloc ] initWithBaseURL :[ NSURL URLWithString : kBASE_URL ]];              }     return self ; } /**  *  This method creates NSMutab...

SOAP WebServices

-(IBAction)callwebservices {     NSLog(@"Avneesh");     NSString *soapMessage=[NSString stringWithFormat:@""];        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"];     [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];     [theRequest setHTTPMethod:@"POST"];     [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];     N...