Skip to main content
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

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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.

  • Verified answer
    prt33k Profile Picture
    6,907 on at
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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

  • Community Member Profile Picture
    on at
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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.

  • prt33k Profile Picture
    6,907 on at
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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

  • Suggested answer
    prt33k Profile Picture
    6,907 on at
    RE: How do I call a external web service from Dynamics Crm sandbox plugin

    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

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans