Acumen’s Dynamics NAV/365BC development team continue to identify challenges that you may be facing as you use Dynamics NAV or 365 Business Central and are eager to show the way with smart fixes and workarounds – In this case Robert Bulugea, recently encountered some obstacles Sending an XML message through webservice. If you’ve come up against similar challenges, read on to see how Robert recommends you proceed.
“I needed to send orders in XML format over webservice calls and I soon realised that although there were some resources on how you can do that with JSON text structures, there weren’t many containing XML structures.
Let’s have a look how I achieved this in a few simple steps below:
In this instance I am logging the XML message that I need to send into a blob field of an integration log table.
Step 1 – I created the relevant fields here:
Step 2 – I also created a very simple XMLPort, feel free to create one suitable to your needs:
Step 3 – Now what we need is to have two functions that would:
3.1 Stream the contents of a message into our blob field, which is exactly what the function below does
3.2 Stream the contents of our blob field into a text variable, exemplified in the ReadXML2Text procedure below
Step4 – Sending the XML message to our destination with Http Post.
We then send the xml text variable to a codeunit were we are using the HTTPContent.writefrom function
Robert Bulugea, Dynamics365 Drive – Dec 11, 2019
Robert Bulugea is part of Acumen’s team of expert programmers and regularly generates helpful content for our customers.
Robert’s blog content is showcased on his blog “Dynamics365 Drive – A Business Central Drive Blog” Click here to see more useful content, tips and advice: https://abcdrive.blog/author/navdriven/