开发者

Calling a method / interface

开发者 https://www.devze.com 2023-03-24 19:49 出处:网络
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 ref

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?

Calling a method / interface

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消