Skip to main content
Solved

XML Updater and then SYNC using Web Services


Forum|alt.badge.img+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!

Best answer by takashi

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
View original
Did this help you find an answer to your question?

2 replies

takashi
Influencer
  • Best Answer
  • March 20, 2019

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

Forum|alt.badge.img+1
  • Author
  • April 4, 2019
takashi wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings