How to get proper https server response in apache camel DSL? - apache

I am trying to hit https server using https4 component I want to get whatever response the server throwing it maybe success or failed here is my route.
from("direct:start")
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=__"))
.to("https4://someAddress.com/api/controls/uploadAndImportFileFromCSV")
.to("stream:out");
Output I'm getting:
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-rajat-Lenovo-G50-70-1513247400372-0-1]
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1847)
.........
Caused by: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking https4://someAddress.com/api/controls/uploadAndImportFileFromCSV?USERNAME=__&PASSWORD=__ with statusCode: 599
But whenever I hit this URL on web browser I am getting the accurate response what server throws
like {"sessionId":"2985416A1F1122694031261B55F0277F.jvm1","_ERROR_MESSAGE_LIST_":[" The following required parameter is missing: [IN]uploadAndImportFile.configId]","The following required parameter is missing: [IN][uploadAndImportFile.fileTypeEnumId]"],"removePathAlias":false,"loggedIn":true,"USERNAME":"admin","_LOGIN_PASSED_":"TRUE","webSiteId":"API"}
This is what I want to get from camel

After a brief browsing about camel exception randomly I got my solution is already clearly mention on org.apache.camel.http4.
If throwExceptionOnFailure=false the HttpOperationFailedException will not be thrown for failed response codes. This allows you to get any response from the remote server.
from("direct:start")....to("https4://.......?throwExceptionOnFailure=false")

Related

A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration)

main.556f577fa36f161b.js:1 Unable to get permission to notify. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('https://website/firebase-cloud-messaging-push-scope') with the script ('https://website/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration).
I am getting this error. it's working fine locally. but after deployment, my address is https://website/project_name so it is unable to find firebase-messaging-sw.js I have tried many ways.
I have followed this tutorial-
https://medium.com/mighty-ghost-hack/angular-8-firebase-cloud-messaging-push-notifications-cc80d9b36f82
I register these files in angular.json
"src/project_name/firebase-messaging-sw.js",
"src/project_name/manifest.json",
like this and deploy locally it works for me but when I deploy it on the main server it doesn't work

Mule 3.9 logs HTTP response sending task failed with error: Locally closed

I use ApiKit to receive queries. Occasionally I get the following line in a log file:
WARN org.mule.module.http.internal.listener.grizzly.ResponseCompletionHandler - HTTP response sending task failed with error: Locally closed
It seems that in this case the integration has not sent a response to the party that called the integration. I thought that there might be a sort of timeout before ApiKit closes the connection to caller but based on timestamps that might not be the case as everything happens within a second.
In this case the payload is sent to Artemis queue before this warning and despite the warning the message is read from Artemis normally and the whole flow works otherwise just fine besides this warning and not sending the response.
So, am I correct when I think that this warning is an indication why the response is not sent? In addition to that what can be done to prevent this situation?

The CGI application did not return a valid set of HTTP errors. 502.3 - Bad Gateway: Forwarder Connection Error (ARR) on Azure ASP.NET Core App

All of a sudden we are seeing this random error / exception in our web application.
Failed to load resource: the server responded with a status of 502 (Bad Gateway).
In the Log Stream, we are seeing the following details, with specific error code as 502.3 - Bad Gateway: Forwarder Connection Error (ARR).
Also, sometimes in the browser itself we see "The CGI application did not return a valid set of HTTP errors." getting displayed.
Most of the searches for these error codes refer to "IIS / Proxy Server" configuration. But, we haven't changed any such settings.
The error happens very randomly and not specific to any user action/function. Same functionality works first and on second execution immediately after first one throws this error.
How to figure out what is causing this and how to fix?
I google this question, because the program was normal at the beginning, and the subsequent 502.3 error. After I checked the information on the Internet, I feel that it can only give us an inspiration, and it cannot solve your problem immediately.
So my suggestion is that first you browse post1 and post2 I provided.
Next, proceed to Troubleshoot according to the steps of the official documentation. Specific errors require specific analysis.

My jmeter Script is executing successfully even after the server is down. It is not throwing any errors and giving the response code as 200

i am doing a load test on one of our website.
My jmeter Script is executing successfully even after the server is down. It is not throwing any errors and also giving the response code as 200.
I have tried all other solutions like Response assertions but that is not helping me.
Can you guys help me with this? I am not sure of what i am missing here.
Server status
jmeter response
JMeter automatically treats HTTP Status Codes below 400 as successful, it doesn't do any extra checks of content so if your server responds with an OOM error but having non-error HTTP Status code - JMeter will consider it as OK.
Ideally in case of error your server should respond with HTTP Status Code 5xx so I would recommend raising an issue to correct the behaviour.
In the meantime consider adding a Response Assertion to explicitly check whether the response contains what it is supposed to be containing (or alternatively that it does not contain error word)
What is the response you get when you hit API from POSTMAN tool?
If you are getting 200 then please consult your developer to handle error code properly.
If you are getting 400 or 500, then there is something missing from your Response Assertion.

PHP PrestaShop Webservice language resource error

I am using platform webservice (1.6) and I don't have problems accessing to categories, products resources but when I try to access languages resource I got error.
Also with a direct request about schema/synopsis I got error.
Example:
aut_key#127.0.0.1/presta/api/products?schema=synopsis I got extended schema information
aut_key#127.0.0.1/presta/api/languages?schema=synopsis I got following
"Internal error. To see this error please display the PHP errors."
Setting debug mode I got:
Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services failed and returned an HTTP status of 401. That means: Unauthorized.' in C:\Ampps\www\test\PSWebServiceLibrary.php:92 Stack trace: #0 C:\Ampps\www\test\PSWebServiceLibrary.php(296): PrestaShopWebservice->checkStatusCode(401) #1 C:\Ampps\www\test\presta.php(93): PrestaShopWebservice->get(Array) #2 {main} thrown in C:\Ampps\www\test\PSWebServiceLibrary.php on line 92
Status 401. Unauthorize doesn't make any sense since if I try to get orders schema with same settings no errors.
Any idea?
I am using following official PSWebServiceLibrary
https://raw.github.c...viceLibrary.php
Thank you