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, ...
Unanswered

Access request headers in X++ exposed service endpoints

(0) ShareShare
ReportReport
Posted on by 103

Hi,

We have exposed an service endpoint from D365 which is used by a client. The client is passing a custom header which they are expecting us to capture and save. Is there any way we can access this header values on the request made?

I have the same question (0)
  • MadsK Profile Picture
    15 on at

    Did you find a solution for this? I am trying to do something very similar, but I don't see any obvious way to access the http header info for the inbound call.

  • Suhail Ismail Profile Picture
    103 on at

    Yes. I am not a X++ developer, but i had idea that it might be similar to .Net Web APIs. Initially we tried it but where using the wrong namespace and asked the question here. Below is the code to get the request headers.

    System.Web.HttpContext::Current.Request.Headers;

  • MadsK Profile Picture
    15 on at

    You are right. We should still have access to the HttpContext for the request at that point and ought to be able read the headers directly. Thanks for the hint, that should work nicely :)

  • Suhail Ismail Profile Picture
    103 on at

    Hi, we faced an issue with this once we deployed the solution to UAT environment. The HttpContext is null and hence we cannot access the headers.

  • MadsK Profile Picture
    15 on at

    Yes, that was my conclusion as well. It works fine on Tier 1 environments but it does not on Tier 2+ due to the IIS configuration.

    I eventually gave up, and rearchitected the solution to include the header values as part of the contract and then had our Azure layer inject the values into the JSON payload.

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Moved from Dynamics 365 General Forum  to Dynamics 365 Finance Forum, because X++ is used only by F&O.

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 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans