Online Training for MVC Web Designing Development, MS SQL, Digital Marketing

Create Webservice and Deploy

Create yourf first webservice, add .asmx file as given below, as we have added "WTRService.asmx"
create webservice
Now let's look how to create service and webmethod
using System; using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WebTrainingRoom
/// < summary>
/// This is a sample webservice called WTRService, you can name anything
/// < /summary>
[WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [System.Web.Script.Services.ScriptService] public class WTRService : System.Web.Services.WebService { [WebMethod] public string WelcomeMessage() { return "Welcome to WebTrainingRoom.Com"; } [WebMethod] public string GetClientName(int clientId) { // here you write code to fetch client details based on clientId return "WebTrainingRoom.Com"; } } }

Now, let's run the webservice, this is how the newly created service will look like

create webservice
Now, we need to test the webservice, simply click on webmethod, provide the parameter value and click on "invoke"

test webservice

Create Webservice and Deploy

Group Training