webservice调用的参数变成null的问题

在c# asp.net站点中调用webservice的时候,传递给web服务方法的一个参数不知道怎么搞的,在服务方接收到的值总是会变成null,很郁闷,后来是什么办法都用过了,包括增加参数,重新排列参数顺序,可是这个string类型的名为searchCondition的参数传过去后总是会变成null,后来试着把参数名换成了sql,结果参数值正常了。虽然问题解决了,但是现在还是一头雾水,难道真的是这个参数名的问题吗?如果是,那么searchCondition参数名又是怎样引起这个错误的呢?难道微软在封装webservice服务的内部类中的某个类名或者其他什么东西和这个参数名冲突了,汗,有空再调试了!

--------------------------------------------------------------改变参数名前---------------------------------------------------------------------

        /// 调用全局服务
        [SoapDocumentMethod("http://tempuri.org/GlobalSearchService", RequestNamespace = "http://tempuri.org/",  ResponseNamespace = "http://tempuri.org/", Use = SoapBindingUse.Literal,            ParameterStyle = SoapParameterStyle.Wrapped)]
        [CompressionSoapExtension]
        public DataSet GlobalSearchService(string serviceName, string searchCondition, string ticket)
        {
            object[] results = Invoke("GlobalSearchService", new object[]
                                                                     {
                                                                         serviceName,
                                                                         searchCondition ,
                                                                         ticket
                                                                     });
            return ((DataSet)(results[0]));
        }

--------------------------------------------------------------改变参数名后---------------------------------------------------------------------

        /// 调用全局服务
        [SoapDocumentMethod("http://tempuri.org/GlobalSearchService", RequestNamespace = "http://tempuri.org/",  ResponseNamespace = "http://tempuri.org/", Use = SoapBindingUse.Literal,            ParameterStyle = SoapParameterStyle.Wrapped)]
        [CompressionSoapExtension]
        public DataSet GlobalSearchService(string serviceName, string sql, string ticket)
        {
            object[] results = Invoke("GlobalSearchService", new object[]
                                                                     {
                                                                         serviceName,
                                                                         sql,
                                                                         ticket
                                                                     });
            return ((DataSet)(results[0]));
        }

你可能感兴趣的:(DotNet开发)