I'm working my way thru the tutorial in O'rileys programming C# book
The calculatorWS for those that know it...
Now i've done the first part:
using
System;using
System.Collections;using
System.ComponentModel;using
System.Data;using
System.Diagnostics;using
System.Web;using
System.Web.Services;namespace
Calculator{
///{
public Service1(){
//CODEGEN: This call is required by the ASP.NET Web Services DesignerInitializeComponent();
}
#region
Component Designer generated code //Required by the Web Services Designer private IContainer components = null; ///{
}
///{
if(disposing && components != null){
components.Dispose();
}
base.Dispose(disposing);}
#endregion
// WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following lines then save and build the project // To test this web service, press F5[WebMethod]
public double add(double x, double y){
return x+y;}
[WebMethod]
public double Sub(double x, double y){
return x-y;}
[WebMethod]
public double Mult(double x, double y){
return x*y;}
[WebMethod]
public double Div(double x, double y){
return x/y;}
[WebMethod]
public double Pow(double x, double y){
double retVal =x; for (int i=0; i{
retVal *=x;
}
}
}
}
and ran under debug and i get the pretty site where i can view and invoke etc etc... So now i want to create a client application... i run the vs command prompt to output a service1.cs file and then the tutorial goes i shud create a new command line application and add that file to the project and visual studio will do the rest adding a theWebSvc proxy.. now i've added it and its come up in a solution tree on the left hand side, that was by going to add file when right clicking on the project of the new console application.#region
Using directivesusing
System;using
System.Collections;using
System.Text;#endregion
namespace
ConsoleApplication1{
///{
///{
Tester t =
new Tester();t.Run();
}
public void Run(){
int var1 =5; int var2 =6;Service theWebSvc =
new Service1();}
}
}
Well it throws an error on "theWebSvc" and "Service"...Where am i going wrong, and its there any idiots tutorials out there where i cant go wrong?
thanks folks.
tim dinhPosted Oct 27, 2005, 3:10 AM
Service1 theService = new Service1();