locked
How to use Http Proxy with CRM 2011 sdk? RRS feed

  • Question

  • I want to use Http Proxy with each web service call using CRM 2011 SDK?

     

     


    Ronak Patel
    Monday, October 17, 2011 3:44 PM

Answers

All replies

  • I would suggest downloading the SDK: http://www.microsoft.com/download/en/details.aspx?id=24004

    Look at the Soap Logger solution and also the plugin registration tool to see how they are connecting to CRM.  Once you understand that you can create a proxy that lives in IIS that acts the same way.  Then you can define whatever interface you want on the other side of the proxy and let the proxy handle the CRM communications using a known set of user credentials or a set that is passed through the proxy.

     


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, October 17, 2011 8:14 PM
    Moderator
  • Hi Jamie,

    All I want to do is something like this..

     

     using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri,
                                                                      serverConfig.HomeRealmUri,
                                                                      serverConfig.Credentials,
                                                                      serverConfig.DeviceCredentials))
      {

               // Http Proxy
                    WebProxy httpProxy = new WebProxy(proxy.Server, proxy.Port);
                    if (!string.IsNullOrEmpty(proxy.Username) &&
                        !string.IsNullOrEmpty(proxy.Password))
                    {
                        httpProxy.Credentials = new NetworkCredential(proxy.Username, proxy.Password);
                    }
                    serviceProxy .Proxy = httpProxy;

          

      }


    Ronak Patel
    Tuesday, October 18, 2011 3:26 PM
  • Yup, it's wired up differently to get the service depending on whether it's in a plugin or another type of app though.  I would look at how the SDK and SOAP logger are hooking up.  There is a helpers common code file they are using that you could also use in your code also.
    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, October 18, 2011 3:46 PM
    Moderator
  • Hi Jamie,

    The Soap Logger sample you cite may help if your goal is to simply log the requests going through. But what if the requirement is that your client must access the server through an HTTP proxy, which itself may require credentials? Ronak's example is how you would handle that scenario with the legacy API. We need a way to do this with the 2011 API.

    Any ideas?

    Richard

    Thursday, February 28, 2013 11:46 PM