cancel
Showing results for 
Search instead for 
Did you mean: 

Parse the http status code to Dynamic Configuration on a response message

xavisanse
Active Participant
0 Kudos

Hi all,

We have a synchronous scenario Proxy > Rest. How can you handle the http status code and put it for example in Dynamic Configuration?

Thanks

former_member607993
Contributor
0 Kudos

Hi Xavier,

In the server side(RESTful service), Is the response being acknowledged in a json/xml payload?

Accepted Solutions (0)

Answers (4)

Answers (4)

xavisanse
Active Participant
0 Kudos

Sorry Rajesh, but no ones achieve exactly what we want to do exactly

former_member607993
Contributor
0 Kudos

Hi Xavier,

You can also perform a REST API Lookup with parameterized mapping(businessComponent,commChannel) to retrieve the server side(REST) payload.

String output ="";

AbstractTrace trace = container.getTrace();

try

{

String reqXml = inputData;

trace.addWarning(reqXml);

Channel channel = LookupService.getChannel(businessComponent,commChannel); SystemAccessor accessor = null; accessor = LookupService.getSystemAccessor(channel); InputStream inputStream = new ByteArrayInputStream(reqXml.getBytes());

Payload payload = LookupService.getXmlPayload(inputStream);

Payload SOAPOutPayload = null; SOAPOutPayload = accessor.call(payload);

InputStream inp = SOAPOutPayload.getContent();

String inputStreamString = new Scanner(inp, "UTF-8").useDelimiter("\\A").next(); trace.addWarning(inputStreamString);

output =inputStreamString;

}

catch(Exception e)

{

trace.addWarning("Exception Occured"+ e.toString());

throw new RuntimeException( e.toString());

}

return output;

former_member607993
Contributor
0 Kudos

Hi Xavier,

You can also handle this using Error Handling by setting the custom message in case of a run time exception.

You can deliver the exception back to Proxy(ECC) as a synchronous call.

former_member607993
Contributor
0 Kudos

Hi Xavier,

If this is resloved, please select the correct anser apprietly and close the thread.

manoj_khavatkopp
Active Contributor
0 Kudos

Hi,

You can capture HTTP status code via custom error handling from 7.4 SP12 check this blog

Thanks,

Manoj