eMapper

No Code XML Saving / Posting to URL

Sometimes, you will want to save an XML file output from an eform that you're working on. You might use this to import into another application or to populate a data warehouse to power your own analytics etc.

There are two parts to saving an XML to disk.

1) you first need to have mapped the format of the XML file that is to be output using the 'Mapping Designer' function

2) you need to tell the form what to do with the file by adding an 'Action'

This article has been written to tell you how to do this.

 

Before you start

In order to do this, you need to ensure that the Data Mapping function (shown below) is enabled. If you can't see this it is not enabled and you should raise a ticket through the helpdesk to get it enabled.

Screenshot_2020-08-17_at_16.43.09.png

 

Mapping the XML file format

The first thing you need to do if you want your form to output an XML file, is tell it the format of the file. To do this you need to click on the 'Data Mapping' link as shown in the screenshot above. 

When you do, you will see this:

Screenshot_2020-08-17_at_16.46.25.png

Here you need to click on 'Create'. The following is an example XML mapping template:

Screenshot_2020-08-17_at_16.51.59.png

You can see the XML file contains FirstName, Surname, MobileNo, Email, ServiceRequestType, HighPriority, Details as pieces of data. 

Notice that you basically need to add an empty tag for anything that should be mapped from data the customer will provide in the form. Where the value is always the same for the form i.e. the Service Request Type the actual value is populated. This is simply to illustrate you might need to pass a value to the back office which the customer may not know but that the back office needs.

Last, you can see the name of the mapping is 'GraffitiFile'. This is important later when you're creating the action to save it somewhere.


Linking the form data to your XML format

Once the XML mapping template is added, open design mode in eDesigner for your form. Select Mapping Designer:

Screenshot_2020-08-17_at_17.02.05.png

Then click on the name of the file template. The reason this screen appears is that it is technically possible to have multiple mapping files output:

Screenshot_2020-08-17_at_17.03.14.png 

You'll then be presented with a UI with three columns.

  • The first column contains any pages in your form.
  • The second column is populated when you click on a page as it is the ID for each of the questions that are present on the page you selected
  • The third column is the XML template converted into a bulleted list to remove the technical look of XML 

The task you now have is to click on each question you want in your XML and then click on the relevant XML element you want to map it to. When you do this you'll see a button that says 'Add Mapping':

mceclip0.png

Because the question IDs are what are shown in here, it is a good idea to ensure the ids are obvious as to which question they relate to.

Once you've mapped content to all it will look like this. 

mceclip1.png

Remember ServiceRequestType doesn't need a mapping as it is a fixed value. 

Now, you've done this when a form is submitted an XML file will also get created. 

Masking XML requirements 

Sometimes an XML file needs the answer the customer provides to be converted into something the back office understands. For example if the customer was being asked whether they thought some graffiti was offensive they might be given a Yes/No option. But the back office expects the value for priority to be a 1 or a 2. Where 1 means high priority and 2 means not.

To cater for this, the 'value' that your enter in the 'Value' field when creating your list is what will be passed in the XML. I.e. if they selected yes with the list set up as below, the XML would be populated with 1:

Screenshot_2020-08-17_at_17.11.47.png

 

 

Viewing the XML

When you have completed your mapping above, you can check the file is being created as expected by going into the Forms Portal and clicking on the Documents tab as shown below:

 

Screenshot_2020-08-17_at_17.24.12.png

The XML file is created as we mapped before. One can see the details the customer entered are mapped and that a) the Service Request Type is populated and b) the High Priority value is 1 not Yes:

<Issue>
<FirstName>John</FirstName>
<Surname>Mc</Surname>
<MobileNo>07713491749</MobileNo>
<Email>john.mcmahon@ieg4.com</Email>
<ServiceRequestType>GRAFFITI</ServiceRequestType>
<HighPriority>1</HighPriority>
<Details>It's really bad. It's just outside the window of 10 Downing Street.</Details>
</Issue>

Adding an action

Now you're happy you've got the XML how you like it, you can now set up an action to:

  • Save it to a file location
  • Send it to an API 

To add an action you need to click on the 'Actions' link found here:

 

Screenshot_2020-08-17_at_17.26.31.png

Note - because an action can be different from one environment to another, you need to do this for EACH environment. 

You will then need to click on the 'Advanced Create' button. This will then present you with three options as shown below*:

Screenshot_2020-08-17_at_17.29.44.png

 

*If this option is not available please log a ticket through help.ieg4.com and they can enable this. When this is selected you then simply need to complete all of the different settings, which are documented below. 

Saving it to a file location

In order to save an XML file to a file location, you need to select the action called SaveDataDocument from the list. This then has the following options, which should be populated in line with the table below:

 

Name 

SaveDataDocument

Description 

Any name you like

Location Switch XPath 

N/A

XPath Location 

N/A

Back Office Reference Fallback 

N/A

Filename XPath 

N/A

Name XPath Fallback 

N/A

Location XPath Fallback 

N/A

Prefix Reference 

N/A

Modular Filenames 

N/A

Static Reference 

N/A

Folder 

The server location you want to save the XML files to*

Limit Back Office Ref to successful search responses 

N/A

Document Type 

The name of your XML data mapping file that you mapped the XML for. I.e. GraffitiFile is the name of the one we created in the example.

Back Office Proxy 

true   (note this must be lower case)

Back Office Proxy Namespace **

This can be found in the list of Settings in your eGovHub 

Back Office Proxy Issuer Name **

This can be found in the list of Settings in your eGovHub

Back Office Proxy Issuer Secret **

This can be found in the list of Settings in your eGovHub

 

* The location you want it to be saved to will be in the standard format for server locations. To find out what you need to enter here speak to your council's ICT team/service desk who can set up a suitable location (E.g. //internalservername/digital/IEG4xmloutput/counciltax/ if it related to Council Tax. Clearly you can a different folder for every XML output/form)

** To find the settings in your eGovHub, other forms which also have these proxy settings include eChanges (Benefits CiC) and eClaim (Benefits New Claim). Alternatively you can log a support call and the support team will provide the settings or update them as required. 

Your ICT will need to ensure the proxy has permission to write to the folder which the action to save files directs them to 

The Settings that are mentioned above are found here:

Screenshot_2020-08-17_at_17.32.21.png

 

Viewing the outcome of the action

If you have done this correctly, you can view the action within the Form's Portal. This time click on the Integration tab.  

Screenshot_2020-08-17_at_17.38.06.png

 

 

Posting the XML to an API's URL

This is very similar to saving an XML to a file location. The difference is you need to choose the Post Data to URL action when you click on Advanced Create. 

This then has the following settings:

Name 

PostDataToUrl

Description 

Any name you like - this is what shows in the forms portal

Back Office URL 

The URL of the API you want to post content to

Credential Type

Set this to: Specify

Username

N/A

Password

N/A

Domain

N/A

Back Office Proxy 

TRUE

Back Office Proxy Namespace 

This can be found in the list of Settings in your eGovHub 

Back Office Proxy Issuer Name 

This can be found in the list of Settings in your eGovHub

Back Office Proxy Issuer Secret 

This can be found in the list of Settings in your eGovHub

Data Document Type

The name of your XML data mapping file that you mapped the XML for. I.e. GraffitiFile is the name of the one we created in the example.

Content Type

Set this to: xml

Data Encode Type

Can be set to blank.

Viewing the outcome of the action

If you have done this correctly, you can view the action within the Form's Portal. This time click on the Integration tab.  

 

Screenshot_2020-08-17_at_17.42.10.png