zoukankan      html  css  js  c++  java
  • webService

    WEB服务器端
    using System;
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols;

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Service : System.Web.Services.WebService
    {
        public People user;
        public Service () {

            //如果使用设计的组件,请取消注释以下行
            //InitializeComponent();
        }

        [WebMethod]
        [SoapHeader("user")]
        public string HelloWorld() {
            if (user.name == "seven")
            {
                return "hello";
            }
            else
            {
                return "wrong";
            }
        }
       
    }
    public class People : SoapHeader
    {
        public string name;
    }

    客户端
    添加WEB引用后
    class Program
        {
            static void Main(string[] args)
            {
                localhost.Service ws = new ConsoleApplication1.localhost.Service();
                ws.PeopleValue = new ConsoleApplication1.localhost.People();
                ws.PeopleValue.name = "seven";           
                Console.WriteLine(ws.HelloWorld());
            }
        }

  • 相关阅读:
    memory addresses
    ddt ddl dml
    PHP Architecture
    disk_free_space
    SAPI
    Simple Mail Transfer Protocol
    AllowOverride None
    function &w(){}
    The History of Operating Systems
    are not called implicitly
  • 原文地址:https://www.cnblogs.com/hblxwaz/p/1762886.html
Copyright © 2011-2022 走看看