cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CPI exception: getStatusCode() is applicable for argument types: () values: []

prabhu_s2
Active Contributor
0 Likes
5,225

Dear All

I am trying to get the http status code when an exception is called. I think i have the right groovy in place but getting the below error:

java.lang.NoSuchMethodException: No signature of method: com.sap.it.rt.adapter.openconnectors.exceptions.OpenConnectorsException.getStatusCode() is applicable for argument types: () values: []

The message properties:


CamelExceptionCaughtcom.sap.it.rt.adapter.openconnectors.exceptions.OpenConnectorsException: HTTP operation failed : {"requestId":"5e8c93f9e4b02c84ec1e41f4","message":"Service Unavailable","providerMessage":"error - {code=503, message=The service is currently unavailable., status=UNAVAILABLE}"} status code : 503

My code:

    def map = message.getProperties();
    def ex = map.get("CamelExceptionCaught");
    
    if (ex!=null) {
     message.setHeader("HTTP_CODE", ex.getStatusCode());
    }

Any help on this please?

View Entire Topic
Sriprasadsbhat
Active Contributor
0 Likes

Hello Prabhu,

Please refer to below help document which is applicable for HTTP adapter.

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/a443efe1d5d2403fb95ee9def1a...

For open connector adapter you might need to white list all the headers in run time configuration and then check for the corresponding header which returning the error status code.

Regards,

Sriprasad Shivaram Bhat