Not getting response and API is not triggering when using the executeAsync()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 09:40 PM
Hello
we have created one function for triggering the rest message API .
when we are using the executeAsync() the api is not triggering and also in response getting the error "Error invoking http request: Error executing REST request: attachment does not exist with sys_id: undefined"
But same function we are using with execute() only, then the API is triggering and getting the response as well .
We checked with testing it direct clicking Test related link in Rest message its working fine.
Any reason why its not working with Async call .
Below is the function :
refuseActivation: function(correlation_id, token) {
gs.log("RefuseActivation BODY0: " + correlation_id + " :TOKEN: " + token);
var restMessageRefuseActivation = new sn_ws.RESTMessageV2('Oceane REST', 'Refuse activation');
restMessageRefuseActivation.setStringParameterNoEscape('base_url', gs.getProperty('mycsm.oceane.api.base.url.OD'));
restMessageRefuseActivation.setStringParameterNoEscape('ticketNumber', correlation_id);
//restMessageRefuseActivation.setMIDServer(gs.getProperty('mycsm.oceane.mid.server'));
restMessageRefuseActivation.setRequestHeader('Authorization', 'Bearer ' + token);
restMessageRefuseActivation.setHttpMethod("POST");
var responseMessageRefuseAction = restMessageRefuseActivation.executeAsync();
gs.log("RefuseActivation BODY1: " + responseMessageRefuseAction.getBody());
gs.log("Status code of the API2 " + responseMessageRefuseAction.getStatusCode());
gs.log("Error Message of the API3: " + responseMessageRefuseAction.getErrorMessage());
responseMessageRefuseAction.waitForResponse(60);
gs.log("RefuseActivation BODY3: " + responseMessageRefuseAction.getBody());
return JSON.parse(responseMessageRefuseAction.getBody());
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 02:25 PM
Hi, your post indicates that the API is not triggered via executeAsync() but then you state that you are getting an error response, and I can't understand how something that is not triggered can generate a response\error?
Is the API message triggered when using executeAsync()?
Assuming yes, or you would not have an error response.
Have you reviewed the outbound payload in ecc_queue table for errors\incompleteness?
Have you logged the variables passed into the function to confirm that they are correct\valid IE (correlation_id, token) ?
Do these variables appear correctly in the outbound payload?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 12:15 AM
Hello @Tony Chatfield1 ,
below are the inline response :
Is the API message triggered when using executeAsync()? : no , its not triggered when using the executeAsync()
Assuming yes, or you would not have an error response. : We are getting the error from BR "Rest Client"
Have you reviewed the outbound payload in ecc_queue table for errors\incompleteness? : We checked the ecc queue table and find out that output queue was processed and input is having error with same method .
adding the screenshot for the same
Have you logged the variables passed into the function to confirm that they are correct\valid IE (correlation_id, token) ? : Yes , these were correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 01:09 PM
Hi, not sure if I have understood your response correctly, but if you are seeing an output entry in ecc_queue, then you REST post is being triggered\sent and the issue is with the response to this message which is showing 'error' ? and this may be a result of the outbound message having incorrect, header/parameter, payload, or may be an issue with the target API.
Unfortunately, with no details of your configuration, comparisons of your outbound messages from execute and executeAsync, details of your target API or it's response, there is not a lot of information that enables further diagnostics.