2015-10-01 5 views
0

Я звоню в веб-службу .net, мне нужно передать 16 параметров, и одна из них - дата (StrCreatedOn), но когда я передаю ей дату, она дает мне ошибку - сервер не смог для обработки запроса. --- > Ошибка преобразования типа данных nvarchar в datetime. Я новичок в ios, и я не знаю, как решить эту проблему, пожалуйста, помогите мне. Кто-нибудь, пожалуйста, ответьте мне. Вот мой код:Ошибка вызова .net webService

NSString *soapMessage = [NSString stringWithFormat: 
          @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 
          "<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/\">\n" 
          "<soap:Body>\n" 
          "<NI_TDR_QUESTION_ANSWER_SAVE xmlns=\"http://tempuri.org/\">\n" 
          "<StrEntityId>1</StrEntityId>\n" 
          "<StrSerialNo>99</StrSerialNo>\n" 
          "<StrInwardNo>N/10/2013</StrInwardNo>\n" 
          "<StrQuestionId>2</StrQuestionId>\n" 
          "<StrMCQAns>होय</StrMCQAns>\n" 
          "<StrAnsReason>शिफारस आहे</StrAnsReason>\n" 
          "<StrDeptId>648</StrDeptId>\n" 
          "<StrFinalTag>null</StrFinalTag>\n" 
          "<StrCreatedBy>2719</StrCreatedBy>\n" 
          "<StrCreatedOn>04/04/2015</StrCreatedOn>\n" 
          "<StrModifiedBy>NULL</StrModifiedBy>\n" 
          "<StrModifiedOn>NULL</StrModifiedOn>\n" 
          "<StrSubQuestionId>१</StrSubQuestionId>\n" 
          "<StrStep>STEP1</StrStep>\n" 
          "<StrQuestionNo>1</StrQuestionNo>\n" 
          "<StrMode>I</StrMode>\n" 
          "</NI_TDR_QUESTION_ANSWER_SAVE>\n" 
          "</soap:Body>\n" 
          "</soap:Envelope>\n"]; 
    NSLog(@"%@",soapMessage); 


    NSURL *url = [NSURL URLWithString:@"<Host URL>"]; 
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; 
    NSString *msgLength = [NSString stringWithFormat:@"%ld", [soapMessage length]]; 

    [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; 
    [theRequest addValue: @"http://tempuri.org/NI_TDR_QUESTION_ANSWER_SAVE" forHTTPHeaderField:@"SOAPAction"]; 
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; 
    [theRequest setHTTPMethod:@"POST"]; 
    [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; 

    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 
    if(theConnection) 
    { 
     webData = [[NSMutableData alloc]init] ; 
    } 
    else 
    { 
     NSLog(@"theConnection is NULL"); 
    } 

ответ

0

Там нет ничего плохого с кодом. Кажется, это проблема с кодом сервера. Вы можете попросить своего парня решить эту проблему.

+0

OK Я проверю – amar