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 :
Service | Customer Service, Contact Center, Fie...
Answered

How do I call a external web service from Dynamics Crm sandbox plugin

(0) ShareShare
ReportReport
Posted on by

Hi

I have a post create plugin for Task entity that should call webservice(hosted on-premise with dns name eg. mycrm.mycompany.org:9000/GenerateLetter.asmx

The webservice has web method (GetSecurityGroupID) that takes input parameter from plugin and executes a stored procedure and returns back the result as integer value. It is working fine when tested from a console app. But when I execute from plugin by creating a task entity data, it doesn't work and couldn't get the error message also.

In plugin, I have added a service reference of the web service and tried to call in a normal way but couldn't get the output. Following is the code in the plugin

OneToOneWebService.GenerateOneToOneLetterSoapClient wb = new OneToOneWebService.GenerateOneToOneLetterSoapClient();

int securityGroupId = wb.GetSecurityGroupID(task.compass_workflowattribute1);

Any help would be greatly appreciated.

Thank you

Gandhi

I have the same question (0)
  • Suggested answer
    prt33k Profile Picture
    6,907 on at

    In plugin, the config is not there so binding information goes missing.

    You need to do custom binding - something like this :

    msdynamicscrmblog.wordpress.com/.../

    Thanks,

    Prateek

  • Community Member Profile Picture
    on at

    Thank you so much for the reply Prateek.

    I did the custom binding like you suggested and that part seems to be working.

    The issue I am getting now is below:

    Exception Message: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute):  System.Exception: Unable to connect to the remote server

    My web service is hosted on-prem :  mycrm.mycompany.org:9000/GenerateLetter.asmx. DNS and everything setup with claim based and ADFS enabled.

    Do the web service really need to be hosted in internet to be able to consumed by plugin?

    Thanks in advance.

    Gandhi

  • prt33k Profile Picture
    6,907 on at

    Are you using CRM online or on-prem? If on-prem then what is the isolation mode for plugin?

  • Community Member Profile Picture
    on at

    The CRM is online and the isolation mode is Sandbox. The plugins are running in the context of calling user.

    The webservice is hosted on-premise and it executes sql command against the database which resides on-premise.

  • Verified answer
    prt33k Profile Picture
    6,907 on at

    Hi,

    If it is CRM online then your webservice should be accessible from internet. The plugin will run on CRM data center and it will not have access to your webservice so don't think you can proceed this way.

    I believe you should move your web service to azure web service and then it will be easer to consume.

    Thanks,

    Prateek

  • Suggested answer
    Community Member Profile Picture
    on at

    Thank you so much Prateek for the knowledge.

    Since the web services execute sql commands on on-prem sql server database, I don't think I can move to Azure web service.

    I will work my Web administrator team member to find out if we can expose the webservice to the internet.

    I'll keep posted.

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 45 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans