on 2021 Jun 30 9:03 PM
Hello People
I have a 3rd party tool accessing CPI iflow via HTTPS sender adapter. They trigger the iflow via a request and receive some response back. Their requirement is to get the Https status code back in case of any error. For a successful processing, they are getting a proper HTTPS status code in the response.
Now i used exception handling for getting the erroneous HTTPS status code, however i am not geting any.
Can anyone please help me with this requirement, if it is possible
Request clarification before answering.
Hello Aniket,
Below should work for you.
Add exception Subprocess follow below screenshot that would help you to tweak HTTP response code and error response.You can use this as reference and build your error handling as required.
Step 2:
Add groovy script like below to set desired HTTP response code and response.
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
def map = message.getHeaders();
map.put("Content-Type", "application/json");
map.put("CamelHttpResponseCode", 900);
def props = message.getProperties();
message.setBody("{\"status\": \"ScriptError\"}");
return message;
}
Regards,
Sriprasad Shivaram Bhat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sri,
It only works if you set End Message instead of Error end in exception sub-process but that marks the message completed in CPI. if you set Error end, then sender gets the generic 500 error with MPL ID. Is there a way to send this custom response while making message status failed in CPI.
Thanks,
Hemant
User | Count |
---|---|
49 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.