Saturday 30 December 2017

Convert xsd:anyType data into XML Data

Recently I encountered this requirement to Accept AnyType Data and convert it into a valid xml data.

Few important things to consider is: The AnyType data payload should be a valid one with the namespaces defined.The type to be converted to should be declared in an xsd.

In my process I had to get this anyType data and convert it to a format with which I had to invoke a service.
Though it sounds very simple I felt its better to document it in a very easily accessible way. I followed the following steps for the same in SOA 11.1.1.4:

  1. Create 2 variables to which you want to convert the anytype Data to.
  2. Use the following function to Parse the value:oraext:parseXML(bpws:getVariableData('inputVariable','request','/ns2:Request/ns2:Details/ns2:xmlData')) where xmlData is of datatype Any.Please note that when you are selecting the anyType data, in Assign activity this will not get copied in the expression builder, hence you need to manually add this data.
  3. Once this Assign activity is completed, use Assign or Transform activity to transform the values within the xml generated in the above mentioned step to another variable which is used to invoke the service.
I hope this helps for people looking for usage of oraext:parseXML.

No comments:

Post a Comment