zoukankan      html  css  js  c++  java
  • WebApi,不引用WebApi.Client.dll调用WebApi接口

    1、打开VS,新建项目控制台应用程序 

    2、添加引用和使用

    Newtonsoft.Json.dll
    using Newtonsoft.Json.Linq;

    3、修改组织机构代码 和 客户代码、名字

    4、添加类 InvokeHelper

    5、添加使用

    using Newtonsoft.Json;

    6、添加 public

        public class InvokeHelper
        {
        
        }

    7、星空地址

            //星空 业务站点地址
            private static string CloudUrl = "http://127.0.1/K3Cloud/";

    8、登录

            //登录
            public static string Login()
            {
                HttpClient httpClient = new HttpClient();
                
                httpClient.Url = string.Concat(CloudUrl, 
                "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc");
                
                List<object> Parameters = new List<object>();
                
                Parameters.Add("5e5b91e99193fb");//账套
                Parameters.Add("administrator");//用户名
                Parameters.Add("888888");//密码
                Parameters.Add(2502);//2052代表中文
                httpClient.Content = JsonConvert.SerializeObject(Parameters);
                return httpClient.SysncRequest();
            }

    9、保存

            //保存
            public static string Save(string formId, string content)
            {
                HttpClient httpClient = new HttpClient();
                
                httpClient.Url = string.Concat(CloudUrl, 
                "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc");
                
                List<object> Parameters = new List<object>();
                
                Parameters.Add(formId);//业务对象Id 
                Parameters.Add(content);//Json字串
                httpClient.Content = JsonConvert.SerializeObject(Parameters);
                return httpClient.SysncRequest();
            }

     10、添加类 HttpClient

     11、修改Json 客户代码、名字,点启动,自动生成客户

     

     

  • 相关阅读:
    webclassify 用于网页分类的python工具包
    基于Web 开发模式的信息抽取
    携梦远行 » curl 抓取跳转内容
    CharField cannot have a "max_length" greater than 255 when using "unique=True" Google Groups
    并发编程利器Eventlet
    ANSI colored Python logging — Gist
    Fabulous — fabulous v0.1.5 documentation
    让你的博客支持MetaWeblog离线发布_维护记录 站点功能_DangJian's Blog
    Plumber Jack: Colourising logging output in terminals
    ajax客户端与服务端传输字符串
  • 原文地址:https://www.cnblogs.com/zfangfang/p/13952106.html
Copyright © 2011-2022 走看看