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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Show xml in Dynamics 365 for Operations Browser tab

(0) ShareShare
ReportReport
Posted on by 1

Hi there,

I have a table in which I store incoming xml strings (from an external source). After processing of the xml, I want the user to be able to view the processed xml, and I want to do that in a new Tab of the browser I'm running Dynamics 365 for Operations in. Yes, I can download the xml file itself, which can be a nice workaround, but I'd really like to show the xml in the user interface.

I have the following code, which did work at some point, but now gives an error message in the browser tab. Here's the error message (in Chrome) and the (simplified) code:

8688.Image1.jpg


void show(str _xml)
{
       System.IO.MemoryStream xmlStream;
       System.Byte[] byteArray;

// convert string to stream
byteArray = System.Text.Encoding::UTF8.GetBytes(_xml);
xmlStream = new System.IO.MemoryStream(byteArray);
FileUploadTemporaryStorageResult result = File::SendFileToTempStore_GetResult(xmlStream, “XMLView.xml”) as FileUploadTemporaryStorageResult;
if (result && result.getUploadStatus())
{
       url = result.getDownloadUrl();
       new Browser().navigate(url,true);

}

}

Any suggestions?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Jos Litjens Profile Picture
    1 on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Hi Adil, I ended up presenting the xml as a download. So not in a new tab in the browser (I don't think that's possible), but by using "File::SendFileToUser()", the user can simply click the download and open it with his preferred viewer.

  • Community Member Profile Picture
    on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Hi Jos, 

    I know this post is pretty old and chances are you won't remember it, nor it's solution. 

    However, I'm facing the exact same issue at the moment, and I was wondering whether you managed to find a workaround? 

    The requirement is to show and XML-file in a new browser window when a button is clicked on a D365Form. 

    I appreciate your help in advance. 

    Adil 

  • Community Member Profile Picture
    on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Hi Jos Litjens,

    I had the same error, found the URL truncated after stored to url variable.

    you can try to change the variable "url" data type from URL (String255) to FreeTxt (Memo)

    best regards,

    Ken

  • Douglas Noel Profile Picture
    3,905 on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Hi,

    I think the problem is related to the setup of the BlobStorageEmulator within the local dev vm. There are a lot of things (related to the usage of BlobStorage) which only work from a browser running on the dev vm itself.

    The BlobStorageEmulator on the dev vms is configured to use the loopback ip and some setup for ax lead to generating the 127.0.0.1 URLs.

    Take a look here

    community.dynamics.com/.../document-handling-and-azure-storage-on-local-development-box

    Maybe, but never checked this, you can use the real local ip of the dev vm within StorageEmualtor setup and find the related entry in the configuration files to generate these URLs.

    This could work from the vm itself and from a browser on another machine.

    regards

    Douglas

  • Martin Dráb Profile Picture
    235,838 Most Valuable Professional on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Are you aware of the fact that 127.0.0.1 is a loopback address, therefore it always refers to the current computer? If you try to open 127.0.0.1:10000, it will work only if you have a web server on the same machine (with an application listening at port 10000). I doubt it's what you're trying to achieve; it rather seems that you're redirecting to a completely wrong address. You must use a real IP address of the server hosting the application (the local development VM in your case) and make sure it's configured to accept connections from other computers.

  • Community Member Profile Picture
    on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Hi Martin,

    Thank you for your quick reply.

    It is not production environment in Azure.

    In local development VM this code is working fine(it is downloading the file as IE page).

    "trying from different machine" mean simply opening the web page from another computer.

    All other changes to my form are reflected and looks good except this download file.

    downloadfile.PNG

    I do not have call stack of the error, this error is on browser and above is the screenshot.

  • Martin Dráb Profile Picture
    235,838 Most Valuable Professional on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Gita, please give us more information - we can't help you if we don't know much about your problem.

    What machine are you using? A local development VM, a production environment in Azure, or what?

    What do you mean by "trying from different machine"? Are you simply opening the web page from another computer, or have you deployed the application elsewhere? Or do you mean something else?

    Also, please give us the call stack of the error.

  • Community Member Profile Picture
    on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Can someone help?

    we used to save XML files in local directory in Ax 2012. but for Ax7 I had to write the below code. I have to call a web service to get the envelope object and using C# XmlSerializer I have converted the envelope object to string and stored that XML string in AxTable.XMLCon (of type FieldContainer).

    Now I was able to view the XML content from this field on a form using a string control. 'DownloadXML' button clicked() has below code. It is working in my local machine.

    System.IO.MemoryStream  xmlStream;
    System.Byte[]                      byteArray;
    DocuPath                           url;

     //AxTable has field called 'XMLCon' of type FieldContainer

    [mDocXml]   =   AxTable.XMLCon;

                    // convert string to stream
                    byteArray = System.Text.Encoding::UTF8.GetBytes(_xml);
                    xmlStream = new System.IO.MemoryStream(byteArray);
                    File::SendFileToUser(xmlStream, AxTable.FileName);

    problem: but when tried from different machine, form displayed in Ax7 browser, everything else worked and when clicked the button, I got the error as below.

    '

    'This site can’t be reached'

    127.0.0.1 refused to connect.

    Try:

    ERR_CONNECTION_REFUSED

  • Martin Dráb Profile Picture
    235,838 Most Valuable Professional on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Deep, you already asked it here, but because your question isn't related to the topic of this thread ("Show xml in browser tab"), I split the thread and moved your question to Unable to connect to Azure storage. You should have received emails about the split and my replies.

    Please continue the discussion in the dedicated thread.

  • Community Member Profile Picture
    on at
    RE: Show xml in Dynamics 365 for Operations Browser tab

    Jos, can you help with final code snippet.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
howalker Profile Picture

howalker 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans