ARTICLE

Returning an Array Listing using Remote Procedure Call

Posted by Abrar Hussain Articles | C# Language December 26, 2001
In this article we will create a Web Service that will return an ArrayList of students.
Reader Level:

In this article we will create, launch and consume a web service without using VS.NET. We will create a Web  Service that will return an ArrayList of students. The code for this web service is attached at the end of the document. The file containing the method to be used as web service is saved with the extension  .asmx. 

The web service is thus successfully launched. In order to consume the web service we have to call it from another method residing on the same machine itself or any other machine the supports DOTNET.

We will write a simple program to test and consume this web service. This method will call the web service remote method and will accept an ArrayList of students from it and eventually display them on the console of the clients machine.

To access the remote method a local stub file is generated. The stub file is then compiled into a .dll file so that local classes and methods can refer it. Once this .dll file is ready the remote method can be accessed as if we are accessing a local method. The client method is totally unaware that it is calling a remote method. The client method is essentially given an illusion that a local method is being invoked.

The following figure shows the steps involved in generating the stub file and compiling it into a .dll file.

ReturnArrayList22.jpg

Figure 1: Generating the stub file and compiling it into a .dll file

The following figure shows that the local file TestWebService is compiled by referring to the stub dll file. It also displays the ArrayList of students received from the remote method. 

ReturnArrayList23.jpg

Figure 2: Students Array List received and displayed

COMMENT USING

Trending up