Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 将数据类型nvarchar转换为地理类型时出错_Ios_.net_Xcode_Web Services_Ios8 - Fatal编程技术网

Ios 将数据类型nvarchar转换为地理类型时出错

Ios 将数据类型nvarchar转换为地理类型时出错,ios,.net,xcode,web-services,ios8,Ios,.net,Xcode,Web Services,Ios8,我调用.net webservice是因为两个参数(LAT,LONG)都是地理数据类型,当我向这些参数发送浮点值时,将数据类型navarchar转换为地理CDATA类型时会出现错误,如何解决这个问题,下面是我的代码,谢谢 NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"

我调用.net webservice是因为两个参数(LAT,LONG)都是地理数据类型,当我向这些参数发送浮点值时,将数据类型navarchar转换为地理CDATA类型时会出现错误,如何解决这个问题,下面是我的代码,谢谢

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");
    }
}
NSString*soapMessage=[NSString stringWithFormat:
@“\n”
“\n”
“\n”
“\n”
“%@\n”
“%@\n”
“%@\n”
“%@\n”
“%@\n”
“\n”
“\n”
“\n”、强度ID、标准选项、阶段选择、横向编号、标准模式];
NSLog(@“%@”,soapMessage);
NSURL*url=[NSURL URLWithString:@“我的url”];
NSMutableURLRequest*theRequest=[NSMutableUrlRequestWithURL:url];
NSString*msgLength=[NSString stringWithFormat:@“%ld”,[soapMessage length]];
[theRequest addValue:@“text/xml;charset=utf-8”用于HttpHeaderField:@“Content Type”];
[请求附加值:@”http://tempuri.org/NI_TDR_QUESTION_ANSWER_DEPTforHTTPHeaderField:@“SOAPAction”];
[theRequest addValue:msgLength for HttpHeaderField:@“内容长度”];
[TheRequestSetHttpMethod:@“POST”];
[TheRequestSetHttpBody:[soapMessage数据使用编码:NSUTF8StringEncoding];
NSURLConnection*连接=[[NSURLConnection alloc]initWithRequest:theRequest委托:self];
if(连接)
{
webData=[[NSMutableData alloc]init];
}
其他的
{
NSLog(@“连接为空”);
}
}

您发布的lat/long值是多少?如果您控制着(大概是)SQL Server,请查看它是否有帮助。我正在长时间发送用户的当前位置