Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to consume a WCF Web service in MSCRM Online using Plugin???

Posted on by 2,715

Hello All,

I have created a simple Azure Cloud Service and i have hosted the same.I am able to consume/call the hosted service in a console application but i am succeeded calling the same web service from MSCRM Online Plugin.Below is my code which is working fine in my Console application but not in my plugin

BasicHttpBinding myBinding = new BasicHttpBinding();

myBinding.Name = "BasicHttpBinding_IService1";

myBinding.Security.Mode = BasicHttpSecurityMode.None;

myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;

myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;

myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

EndpointAddress endPointAddress = new EndpointAddress("testwcfcloudservice.cloudapp.net/Service1.svc");
CloudServiceReference.Service1Client myClient = new CloudServiceReference.Service1Client(myBinding, endPointAddress);
var a = myClient.GetData(9789);

*This post is locked for comments

  • Ramakanta Profile Picture
    Ramakanta 2,715 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hello All,

               Actually the Code was running fine without any modification.But i don't understand why  my plugin registration tool stop working/Crashing when it hit the line                               var a = myClient.GetData(9789);..I am using Plugin Profiler debuging method on CRM 2016 online trial.

  • Hemant Kumar Sahu Profile Picture
    Hemant Kumar Sahu 1,825 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi Ramakanta,

    Can please share the error log details?

    Thanks

    Hemant Sahu

  • Suggested answer
    Abhishek_Sinha Profile Picture
    Abhishek_Sinha 665 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi,

    Also check for authentication as given in below blog.

    mscrmmindfire.wordpress.com/.../crm-2011-exception-the-http-request-is-unauthorized-with-client-authentication-scheme-anonymous-the-authentication-header-received-from-the-server-was-ntlm

  • Suggested answer
    Abhishek_Sinha Profile Picture
    Abhishek_Sinha 665 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi,

    Check below code also from Microsoft.

    https://code.msdn.microsoft.com/How-to-call-External-WCF-42c4490d/sourcecode?fileId=75257&pathId=1696740476

  • Ramakanta Profile Picture
    Ramakanta 2,715 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi Scott ,

              Will try your approach and let you update the same.

  • Ramakanta Profile Picture
    Ramakanta 2,715 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    i am getting Business Process error... while debugging my plugin registration tool stop working when ii hit the line                               var a = myClient.GetData(9789);

  • ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi

    You need to stick with no client credentials so remove myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

    Hope this helps

  • Verified answer
    Hemant Kumar Sahu Profile Picture
    Hemant Kumar Sahu 1,825 on at
    RE: How to consume a WCF Web service in MSCRM Online using Plugin???

    Hi Ramakanta,

    Are you getting any error? Nothing else you need to do it should work make sure you have added reference properly.

    Thanks

    Hemant

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans