Hi, i'm confused -
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
{
/// <summary>
/// Summary description for Service1.
/// </summary>
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region
Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
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<y -1; i++)
{
retVal *=x;
}
return retVal;
}
}
}
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 directives
using
System;
using
System.Collections;
using
System.Text;
#endregion
namespace
ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Tester
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
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.