HTTP status code for failed serialization - rest

I have a GET /v2/developer/jhUxad8 endpoint which get developer from database and serialize it to json.
What http status code should I return when serialization fail?

https://www.codetinkerer.com/2015/12/04/choosing-an-http-status-code.html
What http status code should I return when serialization fail?
If I'm understanding you correctly, the server understands the request, and is trying to fulfill it, but because of a data problem is unable to do so.
500 Internal Server Error
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

Related

Flutter - what causes XMLHttpRequest error

I would like to know if the 'XMLHttpRequest Error' thrown by http package is always due to missing CORS policy header?
The expection thrown in this instance is of Type ClientException - the only things that I can read is the message (XMLHttpRequest Error) and uri. So how would I know it is because of the above.
I get intermittent(and infrequent) errors in the logs, and the CORS policy header is correctly set on the server.
I want to rule out any other causes of XMLHttpRequest Error. Any ideas?

"Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get nodes)"

When I use this command: "kubectl get nodes" I get the below errors:
Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get nodes)
Can anyone help to solve this issue?
As OP #Sam.Yang informed in comment section problem is resolved.
Problem was in the wrong configuration of KUBE_ETCD_VERSION in apiserver.sh.

How to prevent BizTalk 2013/R2 WCF-WebHttp Rest SendPort from Suspending on Http Status=400

I'm calling a vendor's REST service from a BizTalk orchestration using a WCF-WebHttp SendPort.
Even though I capture this System.Exception in an orchestration with a scope.exception, the SendPort remains suspended. Is there anyway to prevent the Susepend (WCF-CustomBehavior or Binding?) How do most BizTalk consumers of external REST services deal with this?
There are many different errors, some for security, some for data/configuration that might be returned with a 400 status, here is one example:
A message sent to adapter "WCF-WebHttp" on send port "spP44WebHttp"
with URI "https://test.abc.com/api/v3" is suspended. Error details:
System.Net.WebException: The remote server returned an unexpected
response: (400) Bad Request. {"httpStatusCode":400,"httpMessage":"Bad
Request","errorMessage":"Unable to handle shipment
request","errors":[{"severity":"ERROR","message":"Customer-X does not
support these accessorials:
AIRPU","source":"SYSTEM"}],"supportReferenceId":"e0117674-9f83-4b42-b861-2e9b9f636323"}
When you have a Scope/Exception around any other two-way WCF send, such as WCF-SQL, it doesn't leave the SendPort suspended when you catch the error, does it?
Related: BizTalk Catch Http Response Code
Update 1: I found this TechNet Post which seems to be on target:
https://social.technet.microsoft.com/wiki/contents/articles/33238.biztalk-server-2013-r2-handle-exceptions-from-rest-services-in-orchestration.aspx
However, it states they could not catch the errors. I can catch the 400 errors, but what I don't like is the Suspended SendPort.
Update 2: I'm trying a custom behavior, where I was going to reset the status code in the BeforeSendReply. But using the debugger, I see the following methods run: Validate(), AddBindingParameters(), ApplyClientBehaviors(), BeforeSendRequest(), BUT - I never see the BeforeSendReply() run. So if BizTalk adapter doesn't like the 400 status, does that stop it from getting back into the Custom Behavior?

WSO2 REST request box not working

I get the following error when I send a REST request with a request_box payload to WSO2 using WSO2 Tryit tool:
<axis2ns539:DataServiceFault xmlns:axis2ns539="http://ws.wso2.org/dataservice">
<axis2ns539:ds_code>UNKNOWN_ERROR</axis2ns539:ds_code>
This is what is echoed on the console:
[2017-12-08 20:01:22,939] [] ERROR - ServerWorker Error processing POST request for : /services/TestICM.HTTPEndpoint/request_box
org.apache.axis2.AxisFault: DS Fault Message: Input Message and request_box Axis Operation didn't match.
I tried also with Postman and got the same error.
Thank you very much

calling rest api after dataweaver component of mule

I have an api which accepts a json payload.
I am calling this api just after the data weaver component of mule where I am building this json payload.
this just means that the API you are calling is answering with a 500 Internal Server error and the exception is throw becouse the http requester is configured to do so. If you don't want to throw the exception and just continue with the execution even when a 500 error is returned you can add the code 500 the the property "Success Status Code Validator":
<http:request config-ref="HTTP_Request_Configuration" path="/" method="GET">
<http:success-status-code-validator values="200, 201, 500"/>
</http:request>