我正在调用.net webservice,因为两个参数(LAT,LONG)都是地理数据类型,当我向这些参数发送浮点值时它给我错误错误将数据类型navarchar转换为geographicdatatype,如何解决这个问题,贝娄是我的代码,谢谢......
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_DEPT xmlns=\"http://tempuri.org/\">\n"
"<StrEntityId>%@</StrEntityId>\n"
"<StrDeptId>%@</StrDeptId>\n"
"<StrStage>%@</StrStage>\n"
"<StrInwardNo>%@</StrInwardNo>\n"
"<StrMode>%@</StrMode>\n"
"</NI_TDR_QUESTION_ANSWER_DEPT>\n"
"</soap:Body>\n"
"</soap:Envelope>\n",StrEntityId,StrDeptId,stageSelected,StrInwardNo,StrMode];
NSLog(@"%@",soapMessage);
NSURL *url = [NSURL URLWithString:@"My 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_DEPT" 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");
}
}