Hi,
So this is my first time creating a web service and I am a bit stuck. This is the code I have used for my web service:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
[WebMethod]
public string simpleMethod(String str)
{
return "Hello " + str;
}
[WebMethod]
public int anotherSimpleMethod(int firstNum, int secondNum)
{
return firstNum + secondNum;
}
}
Now when I go to the URL that I published my web service at http://servername/_vti_bin/mywebservice.asmx I get a page showing my methods, however, when I click on simpleMethod I don't get any text field to insert the value that the web service method receives...any idea what I am doing wrong? (this works fine when I run the web service from Visual Studio)
I followed this guide to publish my web service on the server http://msdn.microsoft.com/en-us/library/ms464040.aspx
What do you guys think? Also I've noticed when I have used other peoples web services that they have a '?wsdl' after the .asmx of their URL, how come mine doesn't? Did I mess up on one of the steps?
Any ideas would be awesome :). Thank You!