web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

WCF / Webapi Service Making and Calling

(0) ShareShare
ReportReport
Posted on by

Hi All,

Thanks in advance for your help guys.

I have an assignment in which I have to make a WCF / Webapi based service which will have a method called ‘getStatementBalance’, this method will return a float value let say 252.54 (dont worry about the internal logic of the method) and then I have to display this returned value on a form field, following are my queries:

1. Is WCF or Web api are one and the same thing or different approaches?

2. How I will code this Service? If somebody can suggest the full code, will be really helpful

2. How I will host and call this service? Can I host it locally on local host and use it with online instance of CRM?

I m new to CRM Coding, so no help will be small help :)

Thanks

*This post is locked for comments

I have the same question (0)
  • Justinjose Profile Picture
    2,707 on at

    Hi Imran,

    Do you want to call Third Party Web Api / WCF? or CRM Web Api?

    Thanks

    Justin Jose

  • Community Member Profile Picture
    on at

    Hi Justin,

    Its CRM Webapi mate

    Thanks

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    Hi Imran,

    You can use CRM Restbuilder, which will build Web API script for you. You can test most of Web Api script in real time.

    github.com/.../releases

    Thanks

    Justin Jose

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi,

    I am still confuse with your requirements. If you want to create WebService, then this is tutorial for you https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service. If you want to make WebApi : https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.0.

    This two has different request and response. But actually nowadays, people more prefer WebApi because it will return Json object.

    For hosting part, it depends on your requirements. If this service will be use in CRM Online, it should be host in online too (for example: azure webservice). But if this one will be use internally and call CRM Online for retrieving data, you can host in in your local server but that server must have internet connection.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Imran,

    What I understand that you are consuming WCF service method(getStatementBalance) , following is the answer -

    1. Is WCF or Web api are one and the same thing or different approaches?

    Yes you are right WCF and Web API  are similar concept , you can say WEB API is a subset of WCF service . The main difference is that WEB API uses  URI (REST service) to make a call  to particular action but WCF uses endpoint address to make particular call . However you can also enable WCF service as REST type of service . Let say we need to consume third party application from Dynamics CRM  in that case you can create WEB API as well as WCF rest/SOAP service.  Its depends on the requirement when to use what .

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api

    2. How I will code this Service? If somebody can suggest the full code, will be really helpful

    Create a service and make it rest service , host it IIS , and the call the service using JavaScript.

    https://www.c-sharpcorner.com/UploadFile/e95fe7/creating-a-simple-wcf-service/

    https://www.codeproject.com/Tips/803009/Configure-WCF-Service-to-REST

    2. How I will host and call this service? Can I host it locally on local host and use it with online instance of CRM?

    You should host your service in some web server to make accessible in the web otherwise you cant access from Online dynamics CRM.

    https://yaplex.com/blog/how-to-call-wcf-services-from-javascript-jquery-and-asp-net-ajax

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans