iOS calls C # background Interface message format

Source: Internet
Author: User

-NSString *soapmessage =-[NSString stringWithFormat:-@"<?xml version=\"1.0\"encoding=\ "utf-8\"?>"-"<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/\ ">"-"<soap:Body>"-"<save xmlns=\ "http://www.myapp.com/\" >"-"<par1>%i</par1>"-"<par2>%@</par2>"-"<par3>%@</par3>"-"</Save>"-"</soap:Body>"-"</soap:Envelope>", Par1, par2, Par3-      ];-Nsurl *url = [Nsurl urlwithstring:@"Http://....asmx"];-Nsmutableurlrequest *request =[Nsmutableurlrequest Requestwithurl:url];--NSString *msglength = [NSString stringWithFormat:@"%lu", (unsignedLong) [SoapMessage length]];--[Request AddValue:@"text/xml; Charset=utf-8"Forhttpheaderfield:@"Content-type"];-[Request Addvalue:msglength Forhttpheaderfield:@"Content-length"];--[Request Sethttpmethod:@"POST"];-[Request Sethttpbody: [SoapMessage datausingencoding:nsutf8stringencoding];--Afhttprequestoperation *operation =[[Afhttprequestoperation alloc] initwithrequest:request];-Operation.responseserializer =[Afxmlparserresponseserializer serializer];-[Operation setcompletionblockwithsuccess:^ (Afhttprequestoperation *operation,IDresponseobject) {-if([Self.Delegaterespondstoselector: @selector (myapphttpclientdelegate:didupdatewithweather:)]) {-[Self.Delegatemyapphttpclientdelegate:self Didupdatewithweather:responseobject];-         }-} failure:^ (Afhttprequestoperation *operation, Nserror *error) {-if([Self.Delegaterespondstoselector: @selector (myAppHTTPClientDelegate:self:didFailWithError:)]) {-[Self.Delegatemyapphttpclientdelegate:self Didfailwitherror:error];-         }-     }];--[Operation start]; Updatensdictionary*s_request = @{@"par1": [NSString stringWithFormat:@"%i", Par1],@"par2": Par2,@"Par3": Par3,@"PAR4": [NSString stringWithFormat:@"%i", PAR4],@"PAR5": PAR5}; Afhttpsessionmanager* S_manager =[[Afhttpsessionmanager alloc] init]; [S_manager POST:@"Http://192.168.10.26/mywebservice/myservice.asmx?op=MethodName"Parameters:s_request success:^ (Nsurlsessiondatatask *task,IDresponseobject) {NSLog (@"done!"); } Failure:^ (Nsurlsessiondatatask *task, Nserror *error) {NSLog (@"FAILED%@,%@", [Error localizeddescription], [error Localizedfailurereason]); }];-[Manager SOAP:@"/webservices/weatherwebservice.asmx"constructingbodywithblock:^ (Nsmutableurlrequest *request) {-[Request Sethttpbody:[soapmessage datausingencoding:nsutf8stringencoding];-} success:^ (Afhttprequestoperation *operation,IDresponseobject) {-NSString *response = [[NSString alloc] Initwithdata: (NSData *) Responseobject encoding:nsutf8stringencoding];-NSLog (@"%@, %@", operation, response);-} failure:^ (Afhttprequestoperation *operation, Nserror *error) {-NSString *response = [[NSString alloc] Initwithdata: (NSData *) [Operation Responseobject] encoding:nsutf8stringencoding];-NSLog (@"%@, %@", operation, error);- }];

iOS calls C # background Interface message format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.