Solved

Reading XML file output and extracting elements

  • 24 November 2017
  • 4 replies
  • 135 views

Badge

Hi,

Using FME desktop 17 I have a series of HTTPCallers containing GET and POST SOAP requests, however I cannot find either the suitable transformer or parameters to extract the fields required.

Attached sample XML file and parameter I need to extract and store are -

<report_id>

form_name

<report_date_time>

<report_uprn>

<report_usrn>

<report_status>

<questionnaires> (all que_key & que_ans fields)

 

Failed attempts using XMLFlattener & XMLFragmenter.

 

Cheers

icon

Best answer by markatsafe 24 November 2017, 20:23

View original

4 replies

Badge +2

There's a tutorial on working with SOAP and FME here: Working with SOAP Services

You've already succeeded in using the HTTPCaller to get the SOAP response. The data you want is in the iData tag, which is an XML document imbedded in the SOAP response. So I think two XMLFlattener's should get you to the data you need. The first XMLFlattener to expose the contents of iData , the second XMLFlattener to flatten the attributes in the iData XML.

I've also attached the workspace: xmlflattener.fmwt

How to determine the Elements to Match parameter? The trick here is to use the XML reader. Open your XML document with the XML reader and use the tree view in Elements to Match to explore the XML and get the correct query. Copy that into the XMLFlattener Elements to Match parameter and the remove the XML reader.

Badge

Hi Mark,

Many thanks for your detail response and workspace.

As a novice this is invaluable, I'll be digesting your example today but thanks again.

Much appreciated.

Badge

Hi Mark,

Your solution has now enabled me to expose the XML elements required and being put to good use (thank you).

My next query with the same workspace is how to handle the same XML document should it contain multiple records (sample file attached) and process them in turn (the attributes will be used in additional sequential SOAP HTTPCallers)

Cheers

get-multiple-sbc-mcs-missed-bin-green-180.xml

Userlevel 2
Badge +17

Hi Mark,

Your solution has now enabled me to expose the XML elements required and being put to good use (thank you).

My next query with the same workspace is how to handle the same XML document should it contain multiple records (sample file attached) and process them in turn (the attributes will be used in additional sequential SOAP HTTPCallers)

Cheers

get-multiple-sbc-mcs-missed-bin-green-180.xml

Try replacing the second XMLFlattener in Mark's workflow with an XMLFragmenter (Flatten Options: Enable Flattening).

Reply