I am trying to get through the XML Web Services Walkthrough at this location:
http://msdn.microsoft.com/library/de...anagedcode.asp
Everything seems to work fine. Here’s the code from Service1.asmx.cs :
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
namespace TempConvert1
{
/// <summary>
/// Summary description for Service1.
/// </summary>
[System.Web.Services.WebService(Namespace="http://Walkthrough/XmlWebServices/",
Description="A temperature conversion service.")]
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(Description="This method converts a temperature in " +
"degrees Fahrenheit to a temperature in degrees Celsius.")]
public double ConvertTemperature(double dFahrenheit)
{
return ((dFahrenheit - 32) * 5) / 9;
}
}
}
It’s a simple application that allows you to enter a value in degrees
Fahrenheit and it converts the value to Celsius.
Well, when I run it, it opens an IE window with the function
“ConvertTemperature” as a link. I click on the link and it goes to another
page where it gives me a box with an “Invoke” button that allows me to enter
a value for the dFahrenheit value. But when I press “Invoke”, another IE
Window pops up and it gives me the HTTP “Page not found” error. The http
address this window uses looks like this:
http://amrit/TempConvert1/Service1.a...ertTemperature
where “amrit” is the server name, TempConvert1 is the name of the solution,
and Service1.asmx is the code file. There is no file “ConvertTemperature”
under Service1.asmx, which is probably why it’s giving me a Page Not Found
error. I assume that it should be calling the ConvertTemperature function
instead of trying to display the page itself, but I could be wrong.
Do you have any idea why this is happening?
Thanks so much if you can help me. I appreciate it.
Amrit
----
Amrit Kohli
am***@wayne.edu