webservice调用的参数变成null的问题
2008-04-28 16:05
302 查看
在c# asp.net站点中调用webservice的时候,传递给web服务方法的一个参数不知道怎么搞的,在服务方接收到的值总是会变成null,很郁闷,后来是什么办法都用过了,包括增加参数,重新排列参数顺序,可是这个string类型的名为searchCondition的参数传过去后总是会变成null,后来试着把参数名换成了sql,结果参数值正常了。虽然问题解决了,但是现在还是一头雾水,难道真的是这个参数名的问题吗?如果是,那么searchCondition参数名又是怎样引起这个错误的呢?难道微软在封装webservice服务的内部类中的某个类名或者其他什么东西和这个参数名冲突了,汗,有空再调试了!
--------------------------------------------------------------改变参数名前---------------------------------------------------------------------
/// <remarks>调用全局服务</remarks>
[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]));
}
--------------------------------------------------------------改变参数名后---------------------------------------------------------------------
/// <remarks>调用全局服务</remarks>
[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]));
}
--------------------------------------------------------------改变参数名前---------------------------------------------------------------------
/// <remarks>调用全局服务</remarks>
[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]));
}
--------------------------------------------------------------改变参数名后---------------------------------------------------------------------
/// <remarks>调用全局服务</remarks>
[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]));
}
相关文章推荐
- (转)Delphi 调用C#编写的WebService 参数为Null解决方法 附中文乱码问题
- 在Android中调用KSOAP2库访问webservice服务出现的服务端传入参数为null的问题解决
- webservice方法参数改名后 webservice 调用时参数变为null问题
- webservice方法参数改名后 webservice 调用时参数变为null问题
- Delphi 调用C#编写的WebService 参数为Null解决方法
- java调用Kotlin方法的参数为null异常问题
- 关于在java环境下调用 .net的 webservice无法获取参数的问题
- jQuery中通过ajax调用webservice传递数组参数的问题实例详解
- Delphi 调用C#编写的WebService 参数为Null解决方法
- jquery中通过ajax调用webservice传递数组参数的问题
- jQuery调用WebService返回JSON数据及参数设置注意问题
- C#webservice调用oracle存储过程参数是中文时变成问号
- jquery中通过ajax调用webservice传递数组参数的问题
- Delphi 调用C#编写的WebService 参数为Null解决方法
- 通过base64编码解决java的webservice调用中文参数乱码问题
- jQuery调用WebService返回JSON数据及参数设置注意问题
- Java调用.Net WebService问题,以及参数为空解决办法
- 解决Ruby调用带中文参数的WebService的问题。
- xfire调用webservice[#document: null]问题
- 调用webservice接口方法参数越界问题