Reputation: 6080
Not sure if anyone will be able to understand this but here is the code:
case 1:
double[] myArrai1 = new double[3];
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.DarkGray;
Console.WriteLine("*-------------------------------------------------------* ");
Console.WriteLine("* Enter an array of numbers to get the sum total * ");
Console.WriteLine("*-------------------------------------------------------* ");
Console.WriteLine("Insert a number");
myArrai1[0] = double.Parse(Console.ReadLine());
Console.WriteLine("Insert a number");
myArrai1[1] = double.Parse(Console.ReadLine());
Console.WriteLine("Insert a number");
myArrai1[2] = double.Parse(Console.ReadLine());
DrawStarLine();
foreach (double d in myArrai1)
Console.WriteLine( d );
Webservices09004961.ServiceReference1.CalculateSumRequest array = new ServiceReference1.CalculateSumRequest();
//ServiceReference1.CalculateSumRequest array = new ServiceReference1.CalculateSumRequest();
Webservices09004961.ServiceReference1.ArrayOfDouble arrayOfDoubles = new Webservices09004961.ServiceReference1.ArrayOfDouble();
//CalculateSumOfList.ServiceReference1.Service1SoapClient client = new CalculateSumOfList.ServiceReference1.Service1SoapClient();
//CalculateSumOfList.ServiceReference1.ArrayOfDouble arrayOfDoubles = new CalculateSumOfList.ServiceReference1.ArrayOfDouble();
arrayOfDoubles.AddRange(myArrai1);
double e = array.CalculateSum(arrayOfDoubles); //error on this line CalculateSum?
Console.WriteLine("=" + e);
Console.ReadLine();
break;
I store 3 user input numbers in myArrai1 which I would like to "sum" to sum I have made a webreference CalculateSumOfList.
But It says my webreference does not contain CalculateSum in my webservice, yet it does and im using it in windows forms within the same build/project?
Thanks.
Upvotes: 0
Views: 549
Reputation: 6080
So with some trial and error I had realised I was calling client the first time round which was already used for another webservice.
case 1:
double[] myArrai1 = new double[3];
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.DarkGray;
Console.WriteLine("*-------------------------------------------------------* ");
Console.WriteLine("* Enter an array of numbers to get the sum total * ");
Console.WriteLine("*-------------------------------------------------------* ");
Console.WriteLine("Insert a number");
myArrai1[0] = double.Parse(Console.ReadLine());
Console.WriteLine("Insert a number");
myArrai1[1] = double.Parse(Console.ReadLine());
Console.WriteLine("Insert a number");
myArrai1[2] = double.Parse(Console.ReadLine());
DrawStarLine();
foreach (double d in myArrai1)
Console.WriteLine( d );
Webservices09004961.ServiceReference1.Service1SoapClient client2 = new ServiceReference1.Service1SoapClient();
Webservices09004961.ServiceReference1.ArrayOfDouble arrayOfDoubles = new Webservices09004961.ServiceReference1.ArrayOfDouble();
arrayOfDoubles.AddRange(myArrai1);
string e = client2.CalculateSum(arrayOfDoubles);
Console.WriteLine("=" + e);
Console.ReadLine();
break;
So to sum it up (no pun intended) I could have spent 5 hours watching and reading tutorials or just used abit of trial and error with the help of SO!
Upvotes: 1