L
Lopamudra
Hi,
I have a webservice which inherits additionally from an interface. This
webservice provides implementation for the methods in the interface as well
as provides addtiional methods.
One of the methods of my assembly takes as parameter a type of the
interface. My webservice instance should be passed as the value for this
parameter. However, I am getting an Invalid Cast Exception.
I have posted the code below:
MyWebservice.asmx:
using myInterfaceAssembly; //Contains the interface
public class MyWebservice : System.Web.Services.WebService, myInterface {
public MyWebservice()
{ }
[WebMethod]
public string getUserName(string userID) {
return ("xxx"); //Simplified the code for posting in forum
}
}
myWebform.aspx:
MyMethod signature:
MyMethod(System.Web.UI.Page ,
myInterfaceAssembly.myInterface);
MyMethod call:
MyMethod(this, new MyWebservice()); //Call to my method,
passing webservice instance
This cast is cuasing issue. Any inputs?
Regards
Lopa
I have a webservice which inherits additionally from an interface. This
webservice provides implementation for the methods in the interface as well
as provides addtiional methods.
One of the methods of my assembly takes as parameter a type of the
interface. My webservice instance should be passed as the value for this
parameter. However, I am getting an Invalid Cast Exception.
I have posted the code below:
MyWebservice.asmx:
using myInterfaceAssembly; //Contains the interface
public class MyWebservice : System.Web.Services.WebService, myInterface {
public MyWebservice()
{ }
[WebMethod]
public string getUserName(string userID) {
return ("xxx"); //Simplified the code for posting in forum
}
}
myWebform.aspx:
MyMethod signature:
MyMethod(System.Web.UI.Page ,
myInterfaceAssembly.myInterface);
MyMethod call:
MyMethod(this, new MyWebservice()); //Call to my method,
passing webservice instance
This cast is cuasing issue. Any inputs?
Regards
Lopa