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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Context Variable in tSOAP

I have developed a job to read data from large file and call the webservice, job looks like

tFileInputPositional --> tFlowToIterate --> tSOAP

In tSOAP XML body, context variable is used  "+((String)globalMap.get("row1.CCNo"))+"

Now I want to scale it up i.e. Instead of sending one field at a time through webservice, I want to read 10K records from DB or file and send 10K records in single request, could you please suggest how to read Data in chunks and assign all the fields to context variables.  In this example, lets suppose I want to process 10M records.

Labels (2)
1 Solution

Accepted Solutions
JR1
Creator III
Creator III

How about this as an idea (requires knowledge of the tXMLMap component and how to represent XML structures in there):
[list=1]
  • Get the number of rows in the input file in a first subjob and round the number to the next 10.000 (hint: tFileInputPositional_X.NB_LINE)

  • Design your next subjob (in the same job) like this:
    tLoop --iterate--> iFileInputPositional --main--> tXMLMap --output--> tFlowToIterate --iterate--> tSOAP

  • In tLoop set "To" to the number you get from 1. and "Step" to 10.000

  • In tFileInputPositional set "Header" to tLoop_x.CURRENT_VALUE and "Limit" to 10000.

  • Create the message in tXMLMap and select "As loop element" (right click) on "dataIn"

  • Pass the message through tFlowToIterate to tSOAP.

  • The message should then always hold a maximum of 10.000 "dataIn" elements. Let us know if something like this works for you.

    View solution in original post

    5 Replies
    Anonymous
    Not applicable
    Author

    Hi
    It is impossible to read the data in chunks, the input component always read all data from data source and then iterate one by one. As a workaround, I think you can add a sequence id for each rows, trigger tSOAP to call the web service based on the sequence id. 
    I want to know if the calling works if the message contains multiple fields? if yes, can you please provides an example?

    Regards
    Shong
    Anonymous
    Not applicable
    Author

    Thanks for quick response Shong.
    Adding additional field in SOAP XML will not work as it has predefined format, here is the sample xml message looks like--

       <soapenv:Body>
          <vib 0683p000009MAB6.pngrotectFormattedDataList>
             <dataIn>"+((String)globalMap.get("row1.CCNo"))+"</dataIn>
             <format>CC_PAN13_Partial_Trailing4_FPE</format>
             <identity>UserName</identity>
             <authInfo>Password</authInfo>
          </vib 0683p000009MAB6.pngrotectFormattedDataList>
       </soapenv:Body>

    I am looking for some solution which will look like -- 
     <soapenv:Body>
          <vib 0683p000009MAB6.pngrotectFormattedDataList>
             <dataIn>"+((String)globalMap.get("row1.CCNo1"))+"</dataIn>
             <dataIn>"+((String)globalMap.get("row1.CCNo2"))+"</dataIn>
    -
    -
          <dataIn>"+((String)globalMap.get("row1.CCNo10000"))+"</dataIn>
             <format>CC_PAN13_Partial_Trailing4_FPE</format>
             <identity>UserName</identity>
             <authInfo>Password</authInfo>
          </vib 0683p000009MAB6.pngrotectFormattedDataList>
       </soapenv:Body>

    So Job input will be just one column...I was thinking if somehow I can limit 10K rows, convert rows to columns ...and assign column values to different context variables...
    JR1
    Creator III
    Creator III

    How about this as an idea (requires knowledge of the tXMLMap component and how to represent XML structures in there):
    [list=1]
  • Get the number of rows in the input file in a first subjob and round the number to the next 10.000 (hint: tFileInputPositional_X.NB_LINE)

  • Design your next subjob (in the same job) like this:
    tLoop --iterate--> iFileInputPositional --main--> tXMLMap --output--> tFlowToIterate --iterate--> tSOAP

  • In tLoop set "To" to the number you get from 1. and "Step" to 10.000

  • In tFileInputPositional set "Header" to tLoop_x.CURRENT_VALUE and "Limit" to 10000.

  • Create the message in tXMLMap and select "As loop element" (right click) on "dataIn"

  • Pass the message through tFlowToIterate to tSOAP.

  • The message should then always hold a maximum of 10.000 "dataIn" elements. Let us know if something like this works for you.
    Anonymous
    Not applicable
    Author

    Thanks Joachim, your solution worked.
    Anonymous
    Not applicable
    Author

    Continuing with the same use case, now Data is read in Batches and getting SOAP message response in batches...as input just has one column and response of SOAP message is one column...how can I can write the output value next to input value...I tried through generating a dummy column of Sequence and joining two Hash Outputs based upon dummy column...is there any better way so that extra overhead of generating sequence and join can be avoided?