Idea ID: 1679788

Invoke Method 2 - Allow empty elements inside XML template

Status : Waiting for Votes
over 2 years ago

Hi, thanks for reading this.

I made a support ticket and the representative suggested to make an ER for this issue/feature.

Long story:
I used the Operations_Orchestration\studio\tools\ws-wizard.bat to build some new operations from a WSDL.
This built the custom operations and defined the XML template according to the WSDL.
Some methods require an empty element, but when the element is sent empty, OO deletes the element on the API call.
It is important to be able to send the element empty because the structure is defined on the level of the WSDL and you cannot escape that. WSDL message validation is done before data consummation.

As an example:
I used Postman to send the following XML template and it worked without issues:

<soapenv:Envelope xmlns:soapenv="" xmlns:sky="">

Now, when using the same template with the Invoke Method 2, the API call failed because, if the element <sky:findAllUsers> is left empty, it gets removed on the call.
This results in sending:

<soapenv:Envelope xmlns:soapenv="" xmlns:sky="">
<soapenv:Header />
<soapenv:Body />

As an additional test, if the element is filled with something, the API call falls because the server is expecting an empty element, but OO this time sends the <sky:findAllUsers> element filled instead of removing it. I'm using MICROFOCUS on my example.

<soapenv:Envelope xmlns:soapenv="" xmlns:sky="">
<soapenv:Header />

I managed to make it work using, instead of Invoke Method 2, a combination of other operations:
/Base [1.11.0]/Library/Utility Operations/Flow Variable Manipulation/Set Flow Variables
/Base [1.11.0]/Library/Utility Operations/Flow Variable Manipulation/Flow Variable Resolver
/Base [1.11.0]/Library/Operations/HTTP Client/v2.0/Http Client Post Raw

I use "Set Flow Variables" with two lists: one with all variable names and the other with the values for each of that variables.
After that, "Flow Variable Resolver" replaces the variables on the template and removes the vars that were left empty
Finally, "Http Client Post Raw" makes the API call, without removing the empty element.

I attached some files: contains the "old" project, using Invoke Method 2 and failing contains some screenshots of the old method contains the new version, using together the three operations mentioned above

You could modify the wizard to, instead of using Invoke Method 2, to use the trio of operations.
Or, you could fix the Invoke Method 2 to allow an empty element.

Thank you!

Kind regards and happy holidays  !!!!