locked
CRM 2011 Web Service and SSIS Package RRS feed

  • Question

  • Hi Forum,

    Being new to the CRM serve side code development, I have a few questions about how CRM web service works.

    I notice in plenty of web examples that some people use IorganizationService and some use IorganizationServiceproxy.

    What's the difference or Pro/Cons of using either of these ? Currently I am using it without proper understanding.

    Secondly, my first task on CRM platform is to create some records using script component of SSIS tool. We have MS SQL database which has some leads generated from another software. My task is to create the same leads in CRM using SSIS by scheduling package. I researched a bit online and found few blogs to help me out so that part is covered but I still don't know how to generate dynamic server URL in my C# package code. At the moment I am using below code snippet.

    serviceproxy = new OrganizationServiceProxy(
        new Uri("http://OurCRMServer/OurOrgname/XRMServices/2011/Organization.svc"), null, credentials, null)

    How can I get server URL and user credentials dynamically. Like in client side using JavaScript, I can use getClientUrl() function. Is there any equivalent in server side ?

    Hope my questions makes sense? Otherwise pardon my newbie knowledge :)

    Initially I am using this in SSIS script component but later I might have to use in plugin and custom workflows. Unfortunately, app.config which I initially planned to store this information doesn't work. I get null values in my code when I read it from app.config.

    We are on CRM 2011 on premise.

    Regards,

    JB


    • Edited by CRM Thirsty Thursday, September 24, 2015 10:40 PM
    Thursday, September 24, 2015 10:38 PM

All replies

  • Hi,

    You can get it from web context, check this thread: https://social.microsoft.com/Forums/en-US/4d06d3b3-2d3d-4a0a-a705-2c9f882d3ca2/crm-2011-get-page-url-in-plugin-code?forum=crmdevelopment

    or read web config file,like this: https://rajeevpentyala.wordpress.com/2012/06/16/reading-wcf-client-binding-configurations-from-plug-in/


    Mahender 


    Saturday, September 26, 2015 7:00 AM
    Moderator
  • Hi Mahender,

    Thanks for your time to answer my query and showing couple of links. I can certainly use that in Plug-in or workflow scenario but what

    about Script Component of SSIS package. How can I get server URL dynamically?

    Thank you,

    JB

    Monday, September 28, 2015 9:59 PM