An example of WebService service and Ajax use tutorial

Source: Internet
Author: User

This article sample source code or material download

Digression:. WebService technology has several years of history, about the theoretical knowledge of the foundation, omitted here, does not say. The Ajax technology that has been fired recently has also been abused very seriously, as far as details are concerned, I am not talking about the point.

The introduction of AJAX technology is relatively low, JavaScript and XML a little use, the individual thought that there is no content, can not fundamentally solve the enterprise's needs or problems, security, transmission of low-level and other aspects have fatal problems.

Why put WebService and Ajax together, for the simple reason that the similarities between the two are XML, and, more accurately, often--------XML according to the same data protocol.

This article neither explains the weakness of Ajax, nor does it webservice powerful, but illustrates how to use WebService technology and AJAX technology in an example.

I show how by example "User Login".

Create a virtual directory Userapp locally.

First create a WebService:

namespaceCjjer{
usingSystem;
usingSystem.Web.Services;
[WebService(Name="WebsCjjer",Description="一个验证用户登陆的web服务",Namespace="http://www.cjjer.com/webs/")]
publicclassUserService{
  [WebMethod(Description="输入用户名和密,返回权限Int值,0表示失败",MessageName="Login")]
  publicintLogin(stringUserName,stringUserPassword){
    returnUser.Check(UserName,UserPassword);
  }
};
}

We do not look at the details for the moment, note that this class has a header webservice, marking this is a Web service.

The CSC compiles, puts it into the bin directory, and then login.asmx the file:

<% @WebServiceClass = "Cjjer.userservice"%>

I will not say the details of the verification first, let's assume that User.check () returns the user level, and 0 indicates that the validation failed.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.