Export data with custom request add-in

The Export data with custom request add-in is used to export data to a remote system, with a modified plugin on the receiving end reacting to the custom request.

To use this add-in:

  • Create a data integration job which exports the data you want to push to the remote system
  • Extend the remote system plugin-unit to be able to receive that data when a specific command is being sent to it
  • Create a batch integration scheduled task using this add-in to push the data to the remote system wrapped in the custom request

So, really, once you’re reading this you should have no trouble actually configuring the add- in (Figure 1.1).

Figure 1.1 The add-in parameters

You must:

  • Select a preconfigured endpoint or supply a web service URL and security key
  • Specify the request XML
  • Select an export activity – this is the integration activity which generates the data you want to push to the remote system – and any export activity settings which might be relevant, see below

When debugging it can be useful to check the log all requests and responses checkbox. You can also set up email notifications to be sent out whenever the job is run – or more likely, when a job fails.

When the activity is run, an XML request is created from the Request XML field and the xml generated by the selected integration activity. By default, the outer <tables> node from the generated XML data will be stripped:

  • Request: <PutEcomUsers></PutEcomUsers>
  • Data XML: <tables><table name="t1">...</table><table name="t2">...</table></tables>
  • Result: <PutEcomUsers><table name="t1">...</table><table name="t2">...</table></PutEcomUsers>

To include a <tables> node – or indeed any other node – you can include it in the request:

  • Request: <PutEcomUsers><tables></table></PutEcomUsers>
  • Data XML: <tables><table name="t1">...</table><table name="t2">...</table></tables>
  • Result: <PutEcomUsers><tables><table name="t1">...</table><table name="t2">...</table><tables></PutEcomUsers>

413: Request Entity Too Large

The default Max Message Size for web service requests in NAV is set to 1024kb. If you are using SmartConnect to process a large amount of data, you may run into a “413: Request Entity Too Large” error. When this happens, you might need to adjust the Max Message Size in Dynamics NAV/BC settings

The export activity settings field is a way for you to insert context-sensitive values into the root request-xml, e.g. the current date or a session variable.

You can use any of the following methods:

  • @Request() – get value from System.Web.HttpContext.Current.Request
  • @Session() – get value from System.Web.HttpContext.Current.Session
  • @Page() – get value from current Page object, if any. (Current page exists if a valid PageID is in the query string).
  • @User() – get value from the current User object.
  • @Code() – evaluate C# code
  • @Paragraph() – get value from current paragraph object, if any. (Current paragraph exists if a valid ParagraphID is in the query string).
  • @ProductID() – get value from current product object, if any

For example, if you use <PutEcomUsers></PutEcomUsers> as the request xml you could do the following:

  • Export activity settings: @Code("time=\"" + System.DateTime.Now.AddDays(1).ToString() + "\" param2=\"test\"")
  • Root node: <PutEcomUsers time="4/1/2020" param2="test"><table tableName="AccessUserGroup"><item…