xmlrpc傻瓜版入门

困扰我多天的问题终于解决了,刚开始对于xml-rpc摸不着头脑,在不断尝试下终于解决了,

首先创建一个xml-rpc服务

1,创建一个类库名字为Test

在类库下建一格接口

interface ITest

{

   [XmlRpcMethod("user.addUser", Description = "添加新员工")]
        bool AddUser(contactInfo contactinfo);

        [XmlRpcMethod("user.deleteUser", Description = "通过用户名删除用户")]
        bool DeleteUser(string user_id);

}

类库要引用CookComputing.XmlRpcV2.dll

2,创建接口的实现类,也就是创建服务

public class TestService

{

  public bool AddUser(contactInfo contactinfo)

  {

  }

  public bool DeleteUser(string user_id)

  {

  }

}

这样服务端就算创建好了,接下来是客户端的事了

Client

1,把类库引用到项目中,将类库生成的dll和CookComputing.XmlRpcV2.dll添加到项目的bin目录下

2,配置webconfig

 <httpHandlers>
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="test.rem" type="TestService.TestService,TestService"/>//红色部分为服务,也就是TestService命名空间下的TestService,紫色部分为类库的dll
    </httpHandlers>

然后运行网站http://localhost:8316/test.rem 即可

原文地址:https://www.cnblogs.com/zlzly/p/1922236.html