Azure Logic App - Get Response Body with 500 Internal Server Error - httpresponse

Is there any way to get the response body in Azure Logic App even when we get 500 Internal Server Error?
I have made the Logic App in a way that I'm setting the response code to 500 on an issue, and I'm adding some error related information in the response body. I tried returning 504 Gateway timeout as well, in case of a timeout issue I could face, but I'm always receiving a null response body in case of non-200 response codes.
If we are not able to see the response body in case of an error by design, is there a better way to set and fetch error related information from the response object?

Yes you can get the response body in Azure Logic App by adding the response action. According to this Add a Response action section of the Microsoft document.
When you use the Request trigger to handle inbound requests, you can model the response and send the payload results back to the caller by using the built-in Response action.
Following steps would help you to get the response body.
In the Logic App Designer, under the step where you want to add a Response action, select New step.
The under Choose an action, in the search box, enter response as your filter, and select the Response action.
Now add any values that are required for the response message. For the Body, you can select the trigger body output from the dynamic content list.
I would suggest to read the Receive and respond to inbound HTTPS requests in Azure Logic Apps document for more information.
Alternatively you can also create alerts whenever HTTP 500 errors occur in your App and use Application Insights to view it using Azure Monitor. I would also suggest to read this Handle errors and exceptions in Azure Logic Apps Microsoft document for more information.

Related

TrustPilot Create Invitation API always returns 415 response code

I'm trying to send a TrustPilot invitation using the Create Invitations API but no matter what I try, I get a response code of 415 and with no data returned, so it's virtually impossible for me to debug.
The URL I'm using is correct: https://invitations-api.trustpilot.com/v1/private/business-units/{businessUnitId}/email-invitations (where {businessUnitId} is my business ID)
I am sending a valid (and current) oAuth token in my header.
I am sending a POST request.
I have tested my details with other "Business user OAuth Token" APIs and everything works, so my details are definitely correct. It's just this create invitation API that's not working.
I've tried everything. I've submitted minimal details, a full request, somewhere in between, the example request in the API, and so on. Always a response code of 415.
I've set my "Invitation Settings" in the TrustPilot Business portal, and have even tried submitting those details with the request (ie. sender e-mail "noreply.invitations#trustpilotmail.com" and a valid reply-to e-mail that's been configured).
I've tried contacting the "Integration Engineers" at TrustPilot who after a few back and forth e-mails, also have no idea, which is VERY unsettling. So time for Stack Overflow.
I need to get this figured out, so any help would be great! Perhaps someone can provide a sample request that works in their application that I can try to duplicate in mine?
Http status code 415 (Unsupported Media Type) is returned when Content-Type: application/json is not passed. You need to make sure that this header is added and that the content you are passing in the post body is valid json.
If you are already doing this then I would need an example of a request you are sending to help you further.

Jmeter Response 500 internal server error for request

HI everyone I need a help regarding to fix the 500 internal server error
Please check my below attached requests and correlation and response image
Please tell me if I was wrong in anywhere I keep trying to do the scripts to run and the result was 500 error.
Redirect request:
Https request1:
Data correlation:
Passing parameters:
Sending request details:
Response message:
Looking into Content-Type header of your request it appears that you should be sending a JSON while you're sending parameters in form of name-value pairs
I think you should switch to Body Data tab in the HTTP Request sampler and put your parameters there like:
Also double check your API contract, it might be the case you need to change the method to POST
More information: REST API Testing - How to Do it Right

JMeter & Salesforce : Facing an error as 'Error occurred while loading a Visualforce page. Attempt to de-reference a null object'

I am creating script in JMeter for a Salesforce application but I am Facing an error as
Error occurred while loading a Visualforce page. Attempt to de-reference a null object' for one of my POST request.
Response code received is 500 with message 'Server Error'
HTTP Status 500 stands for Internal Server Error, you should look into your server logs in order to get to the bottom of the issue.
If you don't have access to your application logs - you can perform some client-side troubleshooting, the common way is to capture the request which is being sent by JMeter and the real browser using a sniffer tool like Wireshark or Fiddler and compare them. The requests should look exactly the same (apart from dynamic values which need to be correlated)
You should pay attention not only to the request body, but also HTTP Headers (including Cookies) as everything matters.
You might also want to check out JMeter – Logging Into Salesforce for Automated Testing article

no SOAPAction header! in Oracle service bus

I am facing below error in respose,
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
i am trying to fixing in pipeline ,
selected pass all headers through pipeline but didn’t helpedenter image description here
Do you really need a SoapAction?
One of the options available in a proxy is to decide which operation a SOAP message is, by inspecting the message body.
If someone sends a message (perhaps through a biz ref) and doesn't include a SOAP action header, a proxy will still recover if it uses this method.

How to add the unhandled exceptions accross the applications in response body in WEB API

How to add the unhandled exceptions accross the applications in response body in WEB API. If there is no exceptions a success message needs to be sent to the response body for all the responses....Need help on achieving this.
You need two things. For handling the exceptions, you need to set the IncludeDetailErrorPolicy in the HttpConfiguration object,
You can configure the error policy preferences as part of the configuration object (HttpConfiguration) in the IncludeErrorDetailPolicy property. This is just an enum that instructs Web API about how to deal with exceptions.
The possible values for this enum are,
Default: It’s uses the customErrors configuration settings if you are using ASP.NET as host or LocalOnly for self-host.
LocalOnly: Only includes error details for local requests
Always: Always includes error details
Never: Never includes error details
When an exception happens, Web API will check the value on this setting for including details about the exception in the response message or not. For example, if Always is enabled, Web API will serialize the exception details as part of the message that you get as response.
The success message does not make much sense as you already have the response status code. A status code equals to OK means that everything went ok. If you still want to add an additional message, use a HttpMessageHandler that checks for the response status code. If the status code is OK, add the message. However, the response body has been set already at that point so you will not able to modify it. You might able to add a message as a header.

Resources