ios - Objective-c : Unable to handle request without a valid action parameter. please supply a valid soap action -
i'm trying consume asmx web service objective-c using wsdl2objc tool. now, i'm trying consume temperature conversion web service.
using tool, client classes got generated consuming service (i have used link reference write code).
however, i'm continuously getting soap fault message "unable handle request without valid action parameter. please supply valid soap action".
while error message states need add "soapaction" header request headers, don't know how in case when using wsdl2objc tool generate client classes consuming web service.
i have searched long time in links referred, there no mention of situation occurring in objective-c.
please check code below:
- (ibaction)submitclicked:(id)sender { tempconvertsoap *binding = [tempconvertsvc tempconvertsoap]; tempconvertsoapresponse* response; tempconvertsvc_celsiustofahrenheit* request = [[tempconvertsvc_celsiustofahrenheit alloc] init]; request.celsius = self.txtcelcius.text; response = [binding celsiustofahrenheitusingparameters:request]; dispatch_async(dispatch_get_main_queue(), ^{ [self processresponse:response]; }); } -(void) processresponse: (tempconvertsoapresponse *) soapresponse { nsarray *responsebodyparts = soapresponse.bodyparts; id bodypart; @try{ bodypart = [responsebodyparts objectatindex:0]; } @catch (nsexception* exception) { uialertview* alert = [[uialertview alloc]initwithtitle:@"server error"message:@"error while trying process request" delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; return; } if ([bodypart iskindofclass:[soapfault class]]) { nsstring* errormesg = ((soapfault *)bodypart).simplefaultstring; uialertview* alert = [[uialertview alloc] initwithtitle:@"server error" message:errormesg delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; } else if([bodypart iskindofclass:[tempconvertsvc_celsiustofahrenheitresponse class]]) { tempconvertsvc_celsiustofahrenheitresponse* tempresponse = bodypart; uialertview* alert = [[uialertview alloc]initwithtitle:@"success!" message:[nsstring stringwithformat:@"result %@", tempresponse.celsiustofahrenheitresult] delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; } }
by referring this link, have tried directly consume web service manually creating soap message , making call i'm getting html of asmx web page response!! can't understand why such response!! have not changed single line of code while running particular code example given in link referred @ start of paragraph.
i'm totally new ios programming , might doing silly mistake or missing trivial. can kindly help?
please let me know if more information required.
thank you.
update:
suggested priya below, checked soap action header item in sethttpcallusingbody method. however, see being set. still i'm getting same fault message. check screen clip below. soap action not correct? should different?
soapaction header included in soap 1.1 - looks web services trying consume uses , expects header. more on header @ http://www.w3.org/tr/2000/note-soap-20000508/#_toc478383528
adding http header nsurlrequest easy. use - (void)setvalue:(nsstring *)value forhttpheaderfield:(nsstring *)field
thats defined on nsurlmutablerequest.
specifically, if using wsdl2objc tool mentioned in article, can include header in - (void)sendhttpcallusingbody:(nsstring *)outputbody soapaction:(nsstring *)soapaction foroperation:(barracudacloudapibindingoperation *)operation
method in barracudacloudapisvc.m file.
Comments
Post a Comment