zoukankan      html  css  js  c++  java
  • 外部系统调用AX服务

    1 外部系统调用AX Customer Service,默认是已当前域用户访问AX。

    2 如果要模拟其他用户,可以使用CallContext 对象。

    3 模拟其他用户,必须使用Business Connector的用户来执行程序,否则会报错"Unable to logon On Microsoft Dynamics"

    4 可以在AX中创建"声明用户",并用Business Connector账号模拟登陆

    实例代码:

    void callCustomerService()
    {
    string response;
    JAY_GreetingsClient client = new JAY_GreetingsClient();
    try
    {
    CallContext context = new CallContext();
    context.Company = "TPS";
    context.LogonAsUser = "outcompany.com\OutUser001";
    //context.LogonAsUser = "tpsax.com\houzejing";
    context.Language = "en-us";
    response = client.helloName(context, "xiangliqi");
    Console.WriteLine(response);
    Console.Read();
    }
    catch (Exception e)
    {
    Console.WriteLine(e.Message);
    Console.Read();
    client.Abort();
    }
    client.Close();
    }

    void callUserSessionService()
    {
    AX.UserSession.UserSessionInfo userSessionInfo;
    AX.UserSession.UserSessionServiceClient client = new AX.UserSession.UserSessionServiceClient();
    try
    {
    AX.UserSession.CallContext context = new AX.UserSession.CallContext();
    context.Company = "TPS";
    context.LogonAsUser = "tpsax.com\houzejing";
    context.LogonAsUser = "outcompany.com\OutUser001";
    context.Language = "en-us";

    userSessionInfo = client.GetUserSessionInfo(context);
    Console.WriteLine(userSessionInfo.UserId);
    Console.WriteLine(userSessionInfo.Company);
    Console.Read();
    }
    catch (Exception e)
    {
    Console.WriteLine(e.Message);
    Console.Read();
    client.Abort();
    }
    client.Close();
    }

  • 相关阅读:
    awk常用命令
    Linux 指令篇:使用者管理--sudo
    sax解析xml案例一
    DefaultHandler类
    Linux上vi(vim)编辑器使用教程
    SecureCRT上传下载数据的方法
    K近邻的决策边界以及K的影响
    KNN交叉验证,找出合适的K值
    KNN(K邻近值算法)手动版与库函数调用版
    linear_model.LinearRegression()线性回归之身高预测体重
  • 原文地址:https://www.cnblogs.com/xiangliqi/p/5089489.html
Copyright © 2011-2022 走看看