Step by Step to create a Web Service, stepservice

Source: Internet
Author: User

Step by Step to create a Web Service, stepservice

 

Address: http://www.cnblogs.com/jfzhu/p/4022139.html

Reprinted please indicate the source

(1) create a Web Service

Create the first project and select ASP. NET Empty Web Application as the type.

 

[Serializable] public class Contact {private string name; public string Name {get {return name;} set {name = value ;}} private int age; public int Age {get {return age;} set {age = value ;}}}

 

HelloWebService. asmx. cs:

 

    /// <summary>    /// Summary description for HelloWebService    /// </summary>    [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    [System.ComponentModel.ToolboxItem(false)]    // 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 HelloWebService : System.Web.Services.WebService    {        [WebMethod]        public string GetMessage(string name)        {            return "Hello " + name;        }        [WebMethod]        public Guid CreateContact(Contact c)        {            return Guid.NewGuid();        }    }

 

 

(2) create a client

Create a client to call the Web Service and check whether it is correct. Create an ASP. NET Empty Web Application

 

Protected void button#click (object sender, EventArgs e) {HelloWebService. helloWebServiceSoapClient client = new HelloWebService. helloWebServiceSoapClient (); Label1.Text = client. getMessage (TextBox1.Text);} protected void Button2_Click (object sender, EventArgs e) {HelloWebService. helloWebServiceSoapClient client = new HelloWebService. helloWebServiceSoapClient (); Label2.Text = client. createContact (new HelloWebService. contact ()). toString ();}

 

Finally, run the client and click the button to get the demo effect.

 


How many full sets of step by step books? What are them?

An excellent set of English Listening teaching materials is published by East China Normal University in the old version. There are 4 books in total, which are used as the introductory books for English Listening in colleges and universities. There are two editions. (Step by step 2000, step by step 3000)

Who sang a song step by step?

Yesstep by step

It's not a new guy.
But it's a Japanese single.

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.