Thursday, August 6, 2009

Write a WebService using your notepad

 

An iMIS Tips and Tricks by Venketesh Subramony

Consultant, BroadPoint Technologies

 

You can write a webservice using a notepad editor. Also you can test this using your browser.

You can even test the webservice by browsing the asmx page in the browser.

<%@ WebService Language="C#" class="MyWebService" %>

using System;

using System.Web.Services;

using System.Web;

using System.Web.MySecureInfo;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

public struct MyInfo

{

public string variables;

}

[WebService(Namespace="http://microsoft.com/webservices/")]

public class MyWebService : WebService

{

private MyInfo MySecureInfo;

public MyWebService()

{

MySecureInfo.variables = "";

}

private void AssignValues(string variables)

{

try

{

// your code

}

catch

{

MySecureInfo.variables= variables;

}

}

[WebMethod(Description="This method call will get the company name and the price for a given MySecureInfo pID.",EnableSession=true)]

public MyInfo GetMyInfo(string pUserid,string pPassword)

{

AssignValues(pUserid,pPassword);

MyInfo MySecureInfoDetails = new MyInfo();

MySecureInfoDetails.variables = MySecureInfo. variables;

return MySecureInfoDetails;

}

}

No comments:

Post a Comment

Add this

Bookmark and Share