webService Request Type Casting Problem
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();
}
Client:
List<BOLibrary.Flight.DTContract> BoList = new List<BOLibrary.Flight.DTContract>();
BOLibrary.Flight.DTContract dtConboj = new BOLibr开发者_如何学Cary.Flight.DTContract();
dtConboj.ValidatingCarrier = "AA";
DTContract[] loc1 = BoList .ToArray();
service.GetCommission(loc1);
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...
Use: GetCommission(DTContract[] Loc)
Did you try boxing it?
//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);
精彩评论