【问题标题】:SSIS 2008 - Connecting to CRM 2011 Web Service using the script componentSSIS 2008 - 使用脚本组件连接到 CRM 2011 Web 服务
【发布时间】:2011-07-27 18:32:43
【问题描述】:

我正在尝试从无法使用 .Net 4 程序集的 SSIS 2008 脚本组件连接到 CRM 2011 Web 服务端点。这排除了 .Net 4 SDK,所以我一直在尝试创建一个代理类来直接针对 2011 WS 工作。我已经通过将该代理类放入它自己的程序集中来使代码工作,但它依赖于从 SSIS 包无法使用的 app.config(方法 1)中读取 WS 地址(这些用户可配置属性需要存储在 SSIS 变量中,以便客户可以修改它们以在他们的环境中工作)。

我想弄清楚如何从 SSIS 包中读取 app.config 数据...

或者我需要让方法 2 之类的东西正常工作,但不确定服务器为什么会抛出它所做的错误。凭据是正确的。 OrganizationServiceClient 方法有几个我尝试过的重载,但都没有奏效。这是我最接近让它工作的地方。谁能告诉我我做错了什么?

            //Method 1:  This code works but relies on pulling the endpoint address from the app.config  (SSIS can’t use this method)
        //OrganizationServiceClient serviceClient = new OrganizationServiceClient("CustomBinding_IOrganizationService");
        //serviceClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential() { Domain="MyDomain", UserName="administrator", Password="*****" };

//Method 2:  This method throws this error:
//Could not connect to https:// MYSERVER/XrmServices/2011/Organization.svc. TCP error code 10061: No connection could be made because the target machine actively refused it.
        string url = "https:// MYSERVER/XrmServices/2011/Organization.svc";
        BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
        binding.MaxReceivedMessageSize = 2147483647;
        OrganizationServiceClient serviceClient = new OrganizationServiceClient(binding, new EndpointAddress(url));
        serviceClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential() { Domain=" MyDomain ", UserName="administrator", Password="******" };

            //this code is common between the two techniques above
        KeyValuePairOfstringanyType[] attributes = new KeyValuePairOfstringanyType[1];
        attributes[0] = new KeyValuePairOfstringanyType();
        attributes[0].key = "name";
        attributes[0].value = "MyTestAccount";

        Entity newAccount = new Entity();
        newAccount.LogicalName = "account";
        newAccount.Attributes = attributes;
        serviceClient.Create(newAccount);

下面app.config的一部分(上面的方法1使用):

    <client>
        <endpoint address="http://MYSERVER/XRMServices/2011/Organization.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_IOrganizationService"
            contract="IOrganizationService" name="CustomBinding_IOrganizationService">
            <identity>
                <userPrincipalName value="*******" />
            </identity>
        </endpoint>
    </client>

【问题讨论】:

    标签: crm ssis dynamics-crm-2011


    【解决方案1】:

    您是否考虑过在 SSIS 中使用类似这种方法来读取 App.config 文件并解析 XML 文档以在 SSIS 包中设置变量?

    http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/69550/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-11
      • 1970-01-01
      • 2010-11-10
      • 2013-03-02
      相关资源
      最近更新 更多