Invoke Method 2 - Allow empty elements inside XML template

Idea ID 1679788

Invoke Method 2 - Allow empty elements inside XML template

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sky="http://skyboxsecurity.com">
<soapenv:Header/>
<soapenv:Body>
<sky:findAllUsers></sky:findAllUsers>
</soapenv:Body>
</soapenv:Envelope>


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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sky="http://skyboxsecurity.com">
<soapenv:Header />
<soapenv:Body />
</soapenv:Envelope>

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sky="http://skyboxsecurity.com">
<soapenv:Header />
<soapenv:Body>
<sky:findAllUsers>MICROFOCUS</sky:findAllUsers>
</soapenv:Body>
</soapenv:Envelope>


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:
01_Workspace.zip contains the "old" project, using Invoke Method 2 and failing
02_microfocus.zip contains some screenshots of the old method
03_API_new_version.zip 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  !!!!

 

1 Comment
Outstanding Contributor.
Outstanding Contributor.
Status changed to: Waiting for Votes
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.