How to create web service (server & Client) in Visual Studio 2012?

后端 未结 4 552
南旧
南旧 2021-02-02 08:16

How to create web service (server & Client) in Visual Studio 2012? like being done before 2012 as http://www.tutorialspoint.com/asp.net/asp.net_web_services.htm

相关标签:
4条回答
  • 2021-02-02 08:30

    When creating a New Project, under the language of your choice, select Web and then change to .NET Framework 3.5 and you will get the option of creating an ASP.NET WEB Service Application.

    enter image description here

    0 讨论(0)
  • 2021-02-02 08:31

    WCF is a newer technology that is a viable alternative in many instances. ASP is great and works well, but I personally prefer WCF. And you can do it in .Net 4.5.

    WCF Project

    enter image description here

    Create a new project. enter image description here Right-Click on the project in solution explorer, select "Add Service Reference" enter image description here

    Create a textbox and button in the new application. Below is my click event for the button:

    private void btnGo_Click(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client testClient = new ServiceReference1.Service1Client();
            //Add error handling, null checks, etc...
            int iValue = int.Parse(txtInput.Text);
            string sResult = testClient.GetData(iValue).ToString();
            MessageBox.Show(sResult);
        }
    

    And you're done. enter image description here

    0 讨论(0)
  • 2021-02-02 08:41

    --- create a ws server vs2012 upd 3

    1. new project

    2. choose .net framework 3.5

    3. asp.net web service application

    4. right click on the project root

    5. choose add service reference

    6. choose wsdl

    --- how can I create a ws client from a wsdl file?

    I´ve a ws server Axis2 under tomcat 7 and I want to test the compatibility

    0 讨论(0)
  • 2021-02-02 08:45
    1. Create a new empty Asp.NET Web Application.
    2. Solution Explorer right click on the project root.
    3. Choose the menu item Add-> Web Service
    0 讨论(0)
提交回复
热议问题