青蛙爱大莹宝
2015-04-02 12:06
采纳率: 100%
浏览 3.3k
已采纳

IOS 调用C#写的Webservice ,传递的参数到Webservice取出的值为NULL

问题描述:IOS 调用C#写的Webservice ,传递的参数到Webservice取出的值为NULL,传递前在IOS里测试能取到值,麻烦用过这块的帮我看一下,已困扰我两天 啦~~哈哈

代码:

NSMutableString *tps=[NSMutableString stringWithString:@""]; //存储参数名称
NSMutableString *vps=[NSMutableString stringWithFormat:@""];//存储参数值
NSMutableString *ts=[NSMutableString stringWithFormat:@""];//组合字符串变量
NSMutableString *mreakString=[NSMutableString stringWithFormat:@""];//组合字符串变量
[mreakString appendString:@"<"];
[mreakString appendString:MethodName]; //方法名
[mreakString appendString:@" xmlns=\"http://tempuri.org/\">"];
//[ParametersKey count]

for (int i = 0; i <[ParametersKey count]; i++)
{
    tps = [ParametersKey objectAtIndex:i];
    vps = [ParametersValue objectAtIndex:i];
    [ts appendString:@"<"];
    [ts appendString:@"cnono"];//参数名
    [ts appendString:@">"];
    [ts appendString:@"17"]; //参数值  (--- 17 传递到webservice为NULL值 ----)
    [ts appendString:@"</"];
    [ts appendString:@"cnono"];
    [ts appendString:@">"];
    [mreakString appendString:ts];
}
[mreakString appendString:@"</"];
[mreakString appendString:MethodName];
[mreakString appendString:@">"];
NSMutableString *soapMessage2=[NSMutableString stringWithFormat:@""];;
[soapMessage2 appendString:@"</soap:Envelope>"];

生成的协议字符串为:

requestData-----><?xml version="1.0" encoding="utf-8"?>



/soap:Body
/soap:Envelope

<cnono>17</cnono>

/soap:Envelope

服务器返回的串为:

<?xml version="1.0" encoding="utf-8"?>soap:Body1:webservicer return:Sql=delete from C where Cno=,param=/soap:Body/soap:Envelope

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题