Calling a method / interface
From Visual Studio I imported a WSDL via the Service References tool. From the methodsin the WSDL I need to call a method GetSessionID. The method is part of an Interface IdoSession. When I try to reference it in C# the compiler keeps telling me I am doing it wrong. What would be the correct syntax to call the GetSessionID method?
If I use this code
SSISSoapTester.IdoSession.IdoSession getID;
idResponse = getID.GetSessionID(idRequest);
The compiler tells me "Use of unassigned local varible 'getID'
If I use this code
SSISSoapTester.IdoSession.IdoSession getID;
getID = new SSISSoapTester.IdoSession.IdoSession();
idResponse = getID.GetSessionID(idRequest);
The compiler tells me开发者_运维知识库 "Cannot create an instance of the abstract calls or interface"
Granted this error makes sense to me because an interface is not a class.
It is hard to tell based on what you posted (please post actual code in the future), but I am guess ing that IdoSessionClient
implements the IdoSession
interface, which is what you have selected in your screenshot. In that case, you probably want to do something similar to:
GetSessionIdRequest request = new GetSessionIdRequest();
IdoSession client = new IdoSessionClient();
client.GetSessionId(request);
精彩评论