iOS Development background Request error, help to look at the XML format where there is a problem in a hurry!!! Great gods!

Source: Internet
Author: User
Error: Entity:line 1:parser error:start tag expected, ' < ' not found
The following is the request XML, with the ASIHTTPRequest request framework, where the error is not known
com.portal.android.ExecuteAndroid changestate

Request Data Code:
NSString *KVR = [NSString stringwithformat:@] ", @" ", Cell.shipnametextfield.text,cargoremark,self.dockmodel.t2,self.berthmodel.t2,cargotype, self.cargomodel.t2,self.cargomodel.t1,cell.cargoweighttextfield.text,cell.billinfotextfield.text,@ "", cell.delegatetextfield.text,@ "Nodecl", appdelegate.userinfo.org_name,appdelegate.userinfo.org_id, APPDELEGATE.USERINFO.USER_ID,APPDELEGATE.USERINFO.USER_NAME,APPDELEGATE.USERINFO.USER_ID, APPDELEGATE.USERINFO.USER_NAME,SELF.PERSONMODEL.T2];
[Req sendrequest:@ "com.portal.android.ExecuteAndroid" methername:@ "changestate" KVRSTR:KVR andtag:4001 andurl: Webserveurl];

  • (void) SendRequest: (NSString ) ClassPath methername: (nsstring ) methername kvrstr: (nsstring ) kvrstr Andtag :(Nsinteger) Tag andurl: (nsstring ) URL
    {
    __block asihttprequest *request = [[ASIHTTPRequest alloc] Initwithurl:[nsurl Urlwithstring:url]];
    NSLog (@ "%@", Webserveurl);
    nsmutablestring *requestxml = [[Nsmutablestring alloc] init];
    [RequestXML appendstring:@ " "];
    [RequestXML appendstring:@ " "];
    [RequestXML appendstring:@ " "];
    NSString *name = [NSString stringwithformat:@ " %@ %@ ", Classpath,methername];
    [RequestXML Appendstring:name];

    [RequestXML APPENDSTRING:KVRSTR];
    [RequestXML appendstring:@ ""];
    [RequestXML appendstring:@ ""];

    NSLog (@ "%@", RequestXML);
    NSData *requestdata = [RequestXML datausingencoding:nsutf8stringencoding];

    [Request Appendpostdata:requestdata];
    [Request setrequestmethod:@ "POST"];

    Request to complete the rollback
    [Request setcompletionblock:^{

       NSLog (@ "Success");   NSData *decompressdata = [request ResponseData];   Gdataxmldocument *doc = [[Gdataxmldocument alloc] Initwithdata:decompressdata options:0 Error:nil];   Gdataxmlelement *rootelement = [Doc rootelement];   Nsarray *result = [rootelement elementsforname:@ "result"];       For (gdataxmlelement *response in result) {NSString *code = [[Response attributeforname:@ ' code '] stringvalue];       NSString *msg = [[Response attributeforname:@ "MSG"] stringvalue]; 01 is the success, the rest is the error if (![       Code isequaltostring:@ ""]) {[Self showalert:msg];           } else {Nsarray *datasetarray = [rootelement elementsforname:@ "Kvdata"];           Nsarray *kvadaarray = [rootelement elementsforname:@ "DataSet"];           Gdataxmlelement *data = [Kvadaarray objectatindex:0];           Nsarray *dataarray = [Data elementsforname:@ "data"];           if ([Datasetarray count] > 0) {[_delegate didreceivedata:datasetarray Andtag:tag];     }else{          [_delegate Didreceivedata:dataarray Andtag:tag]; }}} request = nil;

    }];

    Exception appears
    [Request setfailedblock:^{

       //NSLog(@"Failed");   [self showAlert:@"网络请求失败,请稍后再试"];   //        [_delegate didFairToReceiveData:nil andTag:tag];

    }];

    [Request startasynchronous];
    }

Reply content:

Error: Entity:line 1:parser error:start tag expected, ' < ' not found
The following is the request XML, with the ASIHTTPRequest request framework, where the error is not known
com.portal.android.ExecuteAndroid changestate

Request Data Code:
NSString *KVR = [NSString stringwithformat:@] ", @" ", Cell.shipnametextfield.text,cargoremark,self.dockmodel.t2,self.berthmodel.t2,cargotype, self.cargomodel.t2,self.cargomodel.t1,cell.cargoweighttextfield.text,cell.billinfotextfield.text,@ "", cell.delegatetextfield.text,@ "Nodecl", appdelegate.userinfo.org_name,appdelegate.userinfo.org_id, APPDELEGATE.USERINFO.USER_ID,APPDELEGATE.USERINFO.USER_NAME,APPDELEGATE.USERINFO.USER_ID, APPDELEGATE.USERINFO.USER_NAME,SELF.PERSONMODEL.T2];
[Req sendrequest:@ "com.portal.android.ExecuteAndroid" methername:@ "changestate" KVRSTR:KVR andtag:4001 andurl: Webserveurl];

  • (void) SendRequest: (NSString ) ClassPath methername: (nsstring ) methername kvrstr: (nsstring ) kvrstr Andtag :(Nsinteger) Tag andurl: (nsstring ) URL
    {
    __block asihttprequest *request = [[ASIHTTPRequest alloc] Initwithurl:[nsurl Urlwithstring:url]];
    NSLog (@ "%@", Webserveurl);
    nsmutablestring *requestxml = [[Nsmutablestring alloc] init];
    [RequestXML appendstring:@ " "];
    [RequestXML appendstring:@ " "];
    [RequestXML appendstring:@ " "];
    NSString *name = [NSString stringwithformat:@ " %@ %@ ", Classpath,methername];
    [RequestXML Appendstring:name];

    [RequestXML APPENDSTRING:KVRSTR];
    [RequestXML appendstring:@ ""];
    [RequestXML appendstring:@ ""];

    NSLog (@ "%@", RequestXML);
    NSData *requestdata = [RequestXML datausingencoding:nsutf8stringencoding];

    [Request Appendpostdata:requestdata];
    [Request setrequestmethod:@ "POST"];

    Request to complete the rollback
    [Request setcompletionblock:^{

       NSLog (@ "Success");   NSData *decompressdata = [request ResponseData];   Gdataxmldocument *doc = [[Gdataxmldocument alloc] Initwithdata:decompressdata options:0 Error:nil];   Gdataxmlelement *rootelement = [Doc rootelement];   Nsarray *result = [rootelement elementsforname:@ "result"];       For (gdataxmlelement *response in result) {NSString *code = [[Response attributeforname:@ ' code '] stringvalue];       NSString *msg = [[Response attributeforname:@ "MSG"] stringvalue]; 01 is the success, the rest is the error if (![       Code isequaltostring:@ ""]) {[Self showalert:msg];           } else {Nsarray *datasetarray = [rootelement elementsforname:@ "Kvdata"];           Nsarray *kvadaarray = [rootelement elementsforname:@ "DataSet"];           Gdataxmlelement *data = [Kvadaarray objectatindex:0];           Nsarray *dataarray = [Data elementsforname:@ "data"];           if ([Datasetarray count] > 0) {[_delegate didreceivedata:datasetarray Andtag:tag];     }else{          [_delegate Didreceivedata:dataarray Andtag:tag]; }}} request = nil;

    }];

    Exception appears
    [Request setfailedblock:^{

       //NSLog(@"Failed");   [self showAlert:@"网络请求失败,请稍后再试"];   //        [_delegate didFairToReceiveData:nil andTag:tag];

    }];

    [Request startasynchronous];
    }

Because the request data is encrypted, the processing data is not decrypted when the callback is requested, which causes the error

Format yes, well, you can use an XML-enabled IDE to open it and know that there are no syntax errors ...

is the request data error?
Can you post the code for your print request data?

  • 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.