问题描述
我有一种情况,我有数组列表传递给WebService的。
I have a scenario where i have to pass the array list to the WebService.
WebService的:
[WebMethod]
public void GetCommission(List<BOLibrary.Flight.DTContract> Loc)
{
CommissionManager test = new CommissionManager();
}
客户:
List<BOLibrary.Flight.DTContract> BoList = new List<BOLibrary.Flight.DTContract>();
BOLibrary.Flight.DTContract dtConboj = new BOLibrary.Flight.DTContract();
dtConboj.ValidatingCarrier = "AA";
DTContract[] loc1 = BoList .ToArray();
service.GetCommission(loc1);
当我试图做到这一点我得到不能转换异常的 BOLibrary.Flight.DTContract
到 DTContract
这是因为当Web服务创建proxey考虑键入(DTContract)
不是命名空间(BOLibrary.Flight.DTContract)
我必须通过列表或数组列表 BOLibrary.Flight.DTContract
键入
when i am trying to do this i am getting the exception that cannot convert the BOLibrary.Flight.DTContract
to DTContract
This is because when webservice create proxey consider Type(DTContract)
not namespace(BOLibrary.Flight.DTContract)
and i have to pass the list or arraylist of BOLibrary.Flight.DTContract
Type.
请帮...
在此先感谢...
please Help...Thanks in Advance...
推荐答案
使用: GetCommission(DTContract [] LOC)
您是否尝试过拳击吗?
//Server
public void GetCommission(object oLoc) //or GetCommission(DTContract[] Loc)
{
List<BOLibrary.Flight.DTContract> Loc = oLoc as List<BOLibrary.Flight.DTContract>();
...
}
//Client
service.GetCommission(loc1 as object);
这篇关于WebService的请求类型转换问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!