Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Web service output conditional on schema definition

I'm working with a web service which has the potential to provide a response in two different formats. I have the two XSDs that describe each of the formats and I've created them as metadata, but I'm trying to find a way to fire a conditional depending on the format that comes back. 

Right now, I have a tWebServiceInput component that returns a row containing a single schema column "data". That data is raw XML. It is my understanding that tFileInputXML needs a file. Would it make sense to write the raw XML to a temp file, attempt to read it with a tFileInputXML using one of the schema definitions and if that fails, try the other? Or is there a better way to pipe the initial raw XML into another type of component? Thoughts?

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hi 
You can read the return string and check if it contains some special words that is able to distinguish different format, and use use runIf to fire different business process based on the result. For example:
tWebserviceInput--main--tJavaRow--runIf--tFixdeFlowInput1--main--tExtractXMLField2
                                                      runIf--tFixdeFlowInput2--main--tExtractXMLField2

tJavaRow:

globalMap.put("currentResult",input_row.result);

if(input_row.result.contains("format1"){
globalMap.put("isFormat1",true);
}else{
globalMap.put("isFormat1",false);
}

if(input_row.result.contains("format2"){
globalMap.put("isFormat2",true);
}else{
globalMap.put("isFormat2",false);
}


Define the condition of runIf like:
(Boolean)globalMap.get("isFormat1")


tFixedFlowInput: get the current result, define one column and set its value as: (String)globalMap.get("currentResult")

tExtractXMLField: extract fields from a XML string.