Solved

XML Updater and then SYNC using Web Services

  • 19 March 2019
  • 2 replies
  • 2 views

Badge +1

Hello,

I am trying to update a square footage attribute on a room within an Enterprise Asset Management (EAM) System using web services. The new square footage is coming from a revised AutoCAD file.

Here is my workflow so far. I read in the AutoCAD file and use the room values to construct XML to hit a GET web service for each room. I then extract the FLOORAREA attribute using a XML Fragmenter and compare this FLOORAREA value with the AREA attribute in the AutoCAD records to find the differences. When a difference is found I want to take the AREA record from the AutoCAD file and update the FLOORAREA attribute within the XML responseBody. I have looked at several posts and examples on here but I am a complete beginner at Xquery. I am not sure what I am doing wrong.

After the FLOORAREA value is updated, I then have to reformat the XML within the responseBody so I can send it along to the SYNC web service and update EAM.

I have attached a FMW with only the relevant portion of my ETL in hopes someone can help point me in the right direction. It contains a CREATOR for; GET HTTP Caller, AutoCAD file, and SYNC XML example. In this FMW the FLOORAREA value is 999 and I am trying to update it with a value of 123 coming from the AutoCAD Creator.

Any help would be much appreciated!

icon

Best answer by takashi 20 March 2019, 10:27

View original

2 replies

Userlevel 2
Badge +17

In the source XML document, multiple namespace qualifiers are declared for an identical namespace URI. For example,

ns69, ns70 ns71, ns76 are declared as the qualifier for  "http://schemas.datastream.net/MP_fields",

ns72, ns73, ns74, ns75 are declared as the qualifier for "http://www.openapplications.org/oagis_fields".

I don't know why but the XQuery processor used by FME doesn't seem to be able to identify such a namespace qualifier.

A possible workaround is to replace those namespace qualifiers in the XPath with the wildcard (*), as in:

/soapenv:Envelope/soapenv:Body/ns1:MP0312_GetSystemEquipment_001_Result/ns1:ResultData/ns2:SystemEquipment/ns2:FacilityConditionIndex/*:FLOORAREA/*:VALUE

In addition, you can reduce the XPath if the target element can be identified uniquely with its name.

//ns2:FacilityConditionIndex/*:FLOORAREA/*:VALUE
Badge +1

In the source XML document, multiple namespace qualifiers are declared for an identical namespace URI. For example,

ns69, ns70 ns71, ns76 are declared as the qualifier for  "http://schemas.datastream.net/MP_fields",

ns72, ns73, ns74, ns75 are declared as the qualifier for "http://www.openapplications.org/oagis_fields".

I don't know why but the XQuery processor used by FME doesn't seem to be able to identify such a namespace qualifier.

A possible workaround is to replace those namespace qualifiers in the XPath with the wildcard (*), as in:

/soapenv:Envelope/soapenv:Body/ns1:MP0312_GetSystemEquipment_001_Result/ns1:ResultData/ns2:SystemEquipment/ns2:FacilityConditionIndex/*:FLOORAREA/*:VALUE

In addition, you can reduce the XPath if the target element can be identified uniquely with its name.

//ns2:FacilityConditionIndex/*:FLOORAREA/*:VALUE

Thanks Takashi, the wildcards worked and are giving me just what I needed.

Reply