making a soap request in iphone

后端 未结 3 2169
鱼传尺愫
鱼传尺愫 2020-12-18 16:12

I am trying to use a soap web service which only returns me a date(test). But I am not able to connect with the web service. I am only receiving the wsdl from the web servic

相关标签:
3条回答
  • 2020-12-18 16:36

    Please go through following link http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/

    I hope it will help you.

    0 讨论(0)
  • 2020-12-18 16:36

    Veery simple way is to generate WSDL classes. Can do that using https://code.google.com/p/wsdl2objc/. Folowing instruction from https://code.google.com/p/wsdl2objc/wiki/UsageInstructions

    0 讨论(0)
  • 2020-12-18 16:58

    The following code block helped me in handling web-service using SOAP request.

    -(void)getWebServiceContent {
    
        NSURL *url = [NSURL URLWithString:@"http://url_value_here"];
        NSString *soapBody = @"soap_body_here";
    
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        [request setHTTPBody:[soapBody dataUsingEncoding:NSUTF8StringEncoding]];
        [request setHTTPMethod:@"POST"]; //GET
        [request addValue:@"Value_to_be_added" forHTTPHeaderField:@"SOAPAction"];
        [request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    
        AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
        [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation,id responseObject{
    
            NSLog(@"Success : Content : %@",[operation responseString]);
        } failure:^(AFHTTPRequestOperation *operation,NSError *error) {
    
            NSLog(@"Failed");
        })];
    
        [operation start];
    }
    
    0 讨论(0)
提交回复
热议问题