Webmethods io newbie - How to force a specific response on an http interface

Hi !
I’m working with flowservices in webMethods and I have this client i have to send responses to. Obviously the response is changing in function of if it works or not and i need to force a specific response into my client (for example an object if the call works or a string or another object if it doesn’t).

The problem i have is that with webMethods the only way i know to have only one thing in return is to drop the variables i don’t want but i may need them in some cases. I tried to drop variables into an if / else statement but that doesn’t work.

For exemple if i’m in an error case, i only want the error to show in postman and not the rest of the response (other response of previous flowservice that are called before for example). But if i don’t drop everything else in webMethods, I have them all in postman.

Anyone with a tips on it ?

Thanks

@kassandra.aubin

It’s good keep only necessary variables at each steps . And frame a error and success document signature framework . In case of error kindly refer pub.flow:getLastError extract lastError/error and pass to your [ response String ] to pub.flow:setResponse2 and in case of success case set response String of pub.flow:setResponse2 - to set the response to client

Note : Its necessary to drop the variable which should not be sent to client

2 Likes

Thanks for your answer ! :smiling_face:
I forgot to precise that it was on webmethods.io and not webMethods. But that’s ok we found another way to do it.
Thanks again sir !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.