Seth Duda

Web Service to Export Components & Find Differences

Discussion created by Seth Duda on Nov 30, 2016
Latest reply on Jun 19, 2018 by rsritharan245462

Until we have a better way to see differences between processes (e.g.View XML level component diffs in UI ), here's a solution folks might find useful. This solution will let you export the configuration of any component and will automatically include the configuration of dependent components.


1. Create a new process. Set the start shape to Web Services Server. Configure the Web Services Server operation as shown in the screenshot below.




2. In the data process shape, add a Custom Scripting step:




Here's the groovy script to use:


import com.boomi.execution.ExecutionUtil;

def getComponentXml(rootComponentId, componentId) {
     def processComponentFile = new File("processes/"+rootComponentId+"/"+componentId+".xml")
     if( processComponentFile.exists() ) {
          return processComponentFile.text;
     def componentFile = new File("component/"+componentId+".xml")
     if( componentFile.exists() ) {
          return componentFile.text;
     return "";

def findAllRelatedComponentIds(componentId) {
     return findAllRelatedComponentIds(componentId, componentId, [componentId]);

def findAllRelatedComponentIds(rootComponentId, componentId, seenComponentIds) {
     def fileContents = getComponentXml(rootComponentId, componentId);
     if(fileContents != "") {
          def component = new XmlSlurper().parseText(fileContents)
          def refList = []
          for( ref in component.References.Ref ) {
               def refComponentId = ref.@compId
               if(!(refComponentId in seenComponentIds)) {
                    seenComponentIds << refComponentId;
                    findAllRelatedComponentIds(rootComponentId, refComponentId, seenComponentIds);
     return seenComponentIds;

def componentIdParam = ExecutionUtil.getDynamicProcessProperty("query_component_id");
def componentIds = findAllRelatedComponentIds(componentIdParam);
def output = "<?xml version='1.0' encoding='UTF-8'?>\n<Components>";
for( componentId in componentIds ) {
     def fileContents = getComponentXml(componentIdParam, componentId);
     fileContents = fileContents - ~/^<\?xml.+?>/;
     fileContents = fileContents.replaceAll( /<linesegment.+?>/, "" );
     fileContents = fileContents.replaceAll( / x=".+?"/, "" );
     fileContents = fileContents.replaceAll( / y=".+?"/, "" );
     output += fileContents;
output += "</Components>";

def is = new ByteArrayInputStream(output.toString().getBytes("UTF-8"));    
dataContext.storeStream(is, new Properties());


3. Deploy the process to two different environments (e.g. production and test). Setup the web server atom settings if needed.


4. Once deployed, you can now easily export the full configuration for any component. If that component references any other components, all referenced component configurations will automatically be included in the response. For example, if you want to see the configuration of the process you just deployed:


    a. Find the process's component id (found in the revision history tab on the process):


    b. Call the web service you just created, specifying the component id as a url parameter (e.g. http://[hostname]:9090/ws/simple/getExport?component_id=8abbe209-4af7-402a-938d-5552ee4d9b6a )


 Here's the output from the example web service call:





5. To find differences between environments, execute the web service against the two environments, save their output, and then use your favorite diff tool to find differences between the XML documents!