Question Access Web Service methods when return value is unknown

C0ns0l3

New member
Joined
Dec 11, 2014
Messages
2
Programming Experience
1-3
Hi there,


I'm relatively new to the .NET development and web services in general.
However, I am currently involved in a project where I need to invoke Java web services from a third party application to get some data which i want to use in my application.


The call to the web service works. Therefore i have integrated the WSDL as an Web Reference and generated the proxy class. So I am able to address the service and call its methods.


There are still a few issues which i dont understand.


I address the Web Service methods as follows:
-I Instantiate the proxy class (example code):

VB.NET:
Dim webservice As TestNamespace.EmployeeWS = new TestNamespace.EmployeeWS()





Now i am abble to address the Web Service method via the "webservice" object. This works well if the return value of the webservice-methods consists of some primitive datatypes (String, long,...)


However, I do not know how can I call the methods that include a return value which is unknown for me. For example, there exists a method "GetEmployee" whose return value is an object "Employee":


VB.NET:
Public Function GetEmployee (arg0 As Long) As Employee ()



My question is:
I need to access the objects methods. But i havent found a way to do so.
Is there a way to detect the structure of the object and how do i access its methods.


Thanks in advance
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,583
Location
Norway
Programming Experience
10+
Dim value = webservice.GetEmployee(arg)

With option infer turned on the variable will get the correct type based on expression return type, otherwise you have to declare it with that type (As TestNamespace.Employee).
 

C0ns0l3

New member
Joined
Dec 11, 2014
Messages
2
Programming Experience
1-3
Dim value = webservice.GetEmployee(arg)

With option infer turned on the variable will get the correct type based on expression return type, otherwise you have to declare it with that type (As TestNamespace.Employee).

Thank you, thats what i was looking for.
 
Top Bottom