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 :
Finance | Project Operations, Human Resources, ...
Answered

Outbound http request blocking

(0) ShareShare
ReportReport
Posted on by 3,542

Hi folks

I have an integration which entails data being sent from D365 to an external party.

The process works on multiple VMs, except the customer's UAT environment. Is it possible that D365 could be blocking outbound requests? From a code point of view I am 100% sure that it is the actual request that is failing and not something else.

Thanks for your attention

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    The system could indeed block it - did you try to use https?

    How does your code look like?

  • Pete Alberts Profile Picture
    3,542 on at

    Hi Nikolaos

    Is there some way to tell the system to stop blocking it?

    void sendRequestSimplified()
    {
        System.Net.WebRequest webRequest;
    
        webRequest = System.Net.WebRequest::Create('https://avalidurl.com');
        webRequest.ContentType = 'application/json';
        webRequest.Method = 'POST';
    
        str jsonString = FormJsonSerializer::serializeClass(this.buildBodyContract());
    
        System.Byte[] requestBody = System.Text.Encoding::UTF8.GetBytes(jsonString);
        webRequest.ContentLength = requestBody.Length;
    
        System.IO.Stream bodyStream = webRequest.GetRequestStream();
        bodyStream.Write(requestBody,0,requestBody.Length);
            
        MyRequestCatcher requestCatcher;
        requestCatcher.Request = jsonString;
        requestCatcher.insert();
    
        try
        {
            webRequest.GetResponse();
        }
        catch
        {
            //tell the user that the external site did not accept the request
        }
    }

    With the code above the catch-block get's hit every time in UAT (I know because of the warning message). This does not happen in any other environment - it executes successfully.

    Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Do you get any details about the exception? Are you sure that D365 blocks it, and not the site that you're calling?

    I'm sure you can make https requests from D365.

    There are things that work in dev systems but not UAT/Prod, that's why it's important to test in UAT (like you're doing).

  • Pete Alberts Profile Picture
    3,542 on at

    I don't have any details of the exception - if you could help with that it will be much appreciated. I don't know how to check the http error response with x . My "error handling" looks like this:

    try
    {
        webRequest.GetResponse();
    }
    catch
    {
        LabelString errorMessage = infolog.text(infologLine());
        warning(errorMessage ? errorMessage : "Generic message")
    }

    It always shows the "Generic message", which means webRequest.GetResponse() does not write to the infolog if it throws an error (unlike other errors).

    The external party does not have any form of auth, they only whitelist IP addresses. So there is a long email thread where I am telling them that the problem is on their side. The only possible explanation to me is that they are failing to process my request. Either because the IP address of UAT is not whitelisted or because their code is throwing some sort of error if the request originates from UAT.

    Further details - the requests used to work in UAT. It is only recently that they stopped working. Which is why I thought that maybe someone set some sort of setting that prevents outbound requests.

  • Verified answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Having access control based purely on IP addresses might not be such a good solution when you're having connections from SaaS cloud services. I don't think there's a guarantee that the IP that your connections have now might not be used by someone else later. And the IP address can also change, so they would need to whitelist big address spaces.

    Could you please ask the other party to remove the firewall temporarily so that you can test if it explains the issue.

    The public IP address of connections originating from the UAT system can change - that would explain why it stopped working.

    If you haven't changed your code, the issue can't be in your code.

    And since we know that D365 can make web service calls, it's not very likely that the issue is in D365.

    If you're going to base the access control on IP addresses, the minimum requirement is that you can somehow automate updating the firewall rules whenever the D365 system IP address changes (which could happen during system restart, update, code deployment...).

  • Pete Alberts Profile Picture
    3,542 on at

    Thanks Nikolaos, this is invaluable.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans