locked
Web Service References - Can you use for distributable program? RRS feed

  • Question

  • Hello,

    My question refers to CRM 4.0 and the CrmService and CrmDiscoveryService web services. I have a program that I would like to distribute, but I can't do so because the web references need to be updated every time it is deployed to a new environment. Is there any way to do this using the WSDL web service references, or do you have to use the dlls (Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy)? I thought that by downloading the WSDL references and putting adding them to your project from the local source, they would be compiled with the project and be valid enough to access the API endpoints of whatever environment the program was deployed to, but I keep getting 401 unauthorized errors in relation to my web service calls.

    Thanks,
    Andy
    Andy
    Thursday, June 18, 2009 9:52 PM

Answers

  • Nope, You have to use Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy.

    You can create the distributed application only by using Dynamic Entities which nothing but Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy

    If you are using web references and typed entities, you have to update the web references whenever you change the environment.


    Thanks,
    Amol Gholap
    http://mscrmkb.blogspot.com
    • Marked as answer by AndySc Thursday, June 18, 2009 10:04 PM
    Thursday, June 18, 2009 10:00 PM
  • Depending on where your program is to be run, you could gather the information from the registry.  On computers with the Outlook client, the url is in hkcu\software\microsoft\mscrmclient\DisvoeryUrl and the Organizationid is in the same hive in OrgId.  From these two values you should be able to connect to the CRM web service.

    On the CRM Server, the value is in hklm\software\microsoft\MSCRM.  I don't have a server installation to test with right now, so I don't know the exact key name.

    For the times we have distributed programs like this and they must be run on a computer with no client, we added a text box to the form for the url of the server.
    • Marked as answer by AndySc Thursday, June 18, 2009 10:04 PM
    Thursday, June 18, 2009 10:02 PM
  • Hi,

    Perhaps you can consider using config files to store the URL for the WSDL web references.  That way you just need one config file for each environment, and if you need to recompile your code, just make sure you leave the config file on each environment unchanged since they would already be pointing to the correct instance of the WSDL web service reference.

    Hope that helps.
    • Proposed as answer by SL. _ Thursday, June 18, 2009 10:08 PM
    • Marked as answer by AndySc Thursday, June 18, 2009 10:09 PM
    Thursday, June 18, 2009 10:07 PM

All replies

  • Nope, You have to use Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy.

    You can create the distributed application only by using Dynamic Entities which nothing but Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy

    If you are using web references and typed entities, you have to update the web references whenever you change the environment.


    Thanks,
    Amol Gholap
    http://mscrmkb.blogspot.com
    • Marked as answer by AndySc Thursday, June 18, 2009 10:04 PM
    Thursday, June 18, 2009 10:00 PM
  • Depending on where your program is to be run, you could gather the information from the registry.  On computers with the Outlook client, the url is in hkcu\software\microsoft\mscrmclient\DisvoeryUrl and the Organizationid is in the same hive in OrgId.  From these two values you should be able to connect to the CRM web service.

    On the CRM Server, the value is in hklm\software\microsoft\MSCRM.  I don't have a server installation to test with right now, so I don't know the exact key name.

    For the times we have distributed programs like this and they must be run on a computer with no client, we added a text box to the form for the url of the server.
    • Marked as answer by AndySc Thursday, June 18, 2009 10:04 PM
    Thursday, June 18, 2009 10:02 PM
  • Hi,

    Perhaps you can consider using config files to store the URL for the WSDL web references.  That way you just need one config file for each environment, and if you need to recompile your code, just make sure you leave the config file on each environment unchanged since they would already be pointing to the correct instance of the WSDL web service reference.

    Hope that helps.
    • Proposed as answer by SL. _ Thursday, June 18, 2009 10:08 PM
    • Marked as answer by AndySc Thursday, June 18, 2009 10:09 PM
    Thursday, June 18, 2009 10:07 PM