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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer Service forum

Accessing data from web service and use the data in Dynamics 365

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have a web service which I need to consume the data for use in Dynamics 365, but due to cross-domain policies in web browsers, I was  not able to consume the data in Dynamics 365 plugin. I had come across the JSONP which can help to bypass the cross-domain policies. However, my intention is to consume the data from the web service, and these data will be used to create/update attribute of an entity in Dynamics 365 using plugin. Due to  cross-domain policies, the code in the plugin to consume data from web service will not work.

Does anyone have any clues of how to resolve the limitation as Dynamics 365 (online) is a sandbox environment.

Thanks guys!

Categories:
I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    What issues do you have calling webservices from plugins?

  • Community Member Profile Picture
    on at

    I was using the Newtonsoft.Json to parse the response from the web service in the CRM plugin and got the following:

    {"Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, .....

    In fact, I had written a console program using the same codes and I was able to get the response from the web service. However, when I did the same in the plugin, I got the error.

    Please advise, thanks.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello Kentan,

    You will have to use merging of assemblies because you used Newtonsoft.JSon assembly - nicknow.net/dynamics-crm-ilmerge-dll-plugin

  • Community Member Profile Picture
    on at

    Hi,

    Tried the ILMerge, but got the following when registering the plugin:

    Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly  ......

    ......

    Do you have any clue? Seem like I couldn't merge the  Newtonsoft.JSon, my understanding might be wrong, hope you can advise.

    Thanks.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I use Newton.Json assemply in my plugins/custom workflow activities and I merge it without any issues. Please provide screenshots/scripts that you use to merge assemblies.

  • Community Member Profile Picture
    on at

    I have tried another way, in the Post-build Event Command line:

    "C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe" /target:library /keyfile:"$(ProjectDir)\Dynamics.pfx" /targetplatform:v4 /out:"$(SolutionDir)\GetUCEMWebService2\bin\Debug\GetUCEMWebService2.dll" ""$(SolutionDir)\GetUCEMWebService2\Newtonsoft.Json.dll"

    and got the exited with code 1 error.

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Before using Post-Build Event try to make it work just in cmd. Once you've done that - you can refactor script to be used in VS. Good luck.

  • Suggested answer
    Community Member Profile Picture
    on at

    Thanks. Finally mergeg the DLL.

    However, I was trying to access a web service as well which due to cross domain policy I was not able to do so in Dynamics 365 sandbox.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans