Passing an argument to a web service from a client
Hi Guys,
I am working with visual studio 2005 and I have created a website
project. In that I have created and added a new web service and C# is the language I am using to code. I then created a reference to the webservice (add a web reference) called 'localhost'. There are no build errors in the web service and I am able to run it by itself.
My web service takes an array of type double[][] and returns an array of a custom type, Student, which I have defined as a separate class.
Here is some of the relevant code from the default.aspx page:
-------------------------------------------------------------------
localhost.WebService ws = new localhost.WebService(); //get reference
to web service
double [][] myArray = new double[3][]; //declare an array to pass to web service method
myArray[0] = new double[3] {2.9, 1200, 0};
myArray[1] = new double[3] {3.7, 1400, 1};
myArray[2] = new double[3] {3.5, 1250, 0};
studentArray = ws.StudentResults(myArray); //call a method on the webservice
-----------------------------------------------------------------------
I get an error when I try to run this code.
I noticed that if I defined the myArray within the web service then it ran fine. But in this case I need to collect the data from the front-end (aspx page) and pass it as a parameter to the web service.
Can any one please provide any information that would help resolve this.
Thanks in advance.
|