Hi,
A client has a requirement whereby they need to submit a copy of a customers Sales Order, after it's entered in BC (v21.5), to the customer itself, via an POST HTTP API Request to a server hosted by the customer.
The POST Request needs to be made in Xml format.
The details required within the Xml are fairly basic, eg:
- Sales Order No., Shipment Date, Location Code from the Sales Header, and
- Item No. and Quantity from the Sales Line
There are a couple more, but for the sake of simplicity I'll leave it at that.
I have built a fairly basic procedure against the Sales Header table to handle which is ok BUT... It's somewhat hard-coded and I'm sure there's a tidier and more flexible way I could have done. Must be able to use XMLPorts in some way to set-up the XML, rather than hard coding XMLElements and XMLAttributes etc.
I looked at Data Exchange Definitions also, but wasn't quite sure how to feed those into an POST HTTP API Request.
Keen to hear if anyone has some simple examples of setting up a POST HTTP API Request, using existing functionality (XMLPort, Data Exchange Definition, etc.) to build the Xml body, rather than coding as I have done. And maybe calling from a codeunit that could be set-up via Job Queue (currently I'm triggering mine from the Sales Order List page)
Also, does anyone know how to add a prefix to an XmlElement. Need to add "nsO" to the NameSpace element/node (e.g.