Hi,
In the main workflow, I am calling a webservice and sending the xml response to a file. How do I parse the xml response in the same workflow?
I am able to open this xml response file in another workflow, parse the data and write the output in an excel file.
I want to make it as a macro and call it from the main workflow. The web service can send the request with one shipper info only. So, I have an input file with many shipper information and I need to call the web service one at a time in the main workflow, then call this macro to parse the response and append the parsed data to the output file.
I have done a similar use case where I output the response from the API to a string. Here, I can call the macro to parse the data etc.
In this case, I am sending the response to a file. If I call the parsing macro after the download tool in the main workflow, it doesn't recognize the input stream. (Tool #3: The field "ENTITIES_OuterXML" is missing. Compare the tool configuration with the input stream.)
Thanks,
Priya.
Able to call this macro from the main workflow.
Passed the file name from the download tool to this macro
Is this the correct approach?
Thanks,
Priya.
Few questions here,
1. Could you send across an example of the file that you are downloading?
2. Could you share the configuration of the input tool and the configuration of the action tool?
3. Have you tried to parse the download directly, instead of downloading the file?
Hi,
I got that working. Half of the response was truncated when I downloaded to a String. That's the reason I downloaded to a file.
Thanks.
Now, my query is on Create/Append File.
My input file has many records. For each record, I call the macro which calls the API, parse the response and write the output to a file. For the first record, I should create the file and from the next records, I should append the data to the existing file. How should I do it?
Please share if there is any resource related to this.
Thanks & Regards,
Priya.
If you send an example maybe we could help you better, but if it's not possible, I will try to explain what I think you can do to solve the issue.
First of all, maybe you could do it in one step without a problem, it's weird that your XML is truncated, I've been doing tests with 100 Mb XML files and there's no problem at all. If your XML is bigger, maybe you could use a blob option in the download tool and then the blob converter. As shown. in the pictures. This solution will make your second step easier than you are expecting because you could manage every single record in one without macros.
if you want to do it in 2 steps, you have to create a batch macro where the input is the file from the last iteration and the output is the file + the result of the parsing in this iteration.
I would recommend you to use yxdb files to do so until the file is done because other formats could be more sophisticated to do this appending.
Another way that you could find it easy is to put the output tool out of the batch macro, so if the header is the same, you will get an automatic "appended file". see the image below as an example.
Let me know if one of those could help.
Best,
Hi,
Thank you for your detailed explanation. I tried the blob option. It's the same as downloading to string. The response data gets truncated.
For the Create/Append, I have used the filter to check if it's first record, create the file else append. But, if there is no output for the first record, it won't create the file.