Response code 411 mapped as failure - response

when Im trying to run my flow, getting this
error Response code 411 mapped as failure Response code 411 mapped as failure.
Payload : org.glassfish.grizzly.utils.BufferInputStream#16e8c87
Element : /post_sampleFlow/processors/1 # post_sample:post_sample.xml:70 (HTTP_Post).
please tell me what is the problem.

So problem is how to use mule to auth user.
From this doc:
<set-property propertyName="Authorization" doc:name="Set Authentication Header" value="#["Basic " + Base64.encodeBase64String("username:password")]"/>
So, that way all properties can be filled.
BTW now I see need for that flows.

Related

AADSTS900144: The request body must contain the following parameter: 'grant_type'

I am trying to generate the Access_Token after generating the Authorization code using MS Graph API.
I am getting the following error (Screen shot below)
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.",
I see that grant_type is present. I checked the rest of the values to be without any spaces. Any ideas on what could be wrong here? I appreciate your support.
Thanks,
Could you please try once in graph explorer .

Why I am getting different status code from ocelot?

I have a microservice project with ocelot API Gateway. In one service I have retuned 204(No Content) response. When I run that service directly then I am getting a proper response but when I run that service using ocelot then I am getting 500(Internal Server).
I have verified routing and it's fine because the same API return 200 or 201 then it called from ocelot successfully. But when 204 returns then it returns 500 but it should return 204.
I have checked logs it shows this information:
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HM4G9THO6LV0", Request id "0HM4G9THO6LV0:00000006": An unhandled exception was thrown by the application.
System.InvalidOperationException: Response Content-Length mismatch: too few bytes written (0 of 72).
Can anyone please help me?
Is there any configuration to handle the 204 status code in the ocelot API gateway?
I had the same problem. I checked my controllers and one of them return 204 with a response body. If you have the same issue you need to return 204 only.

Event Sync Token (412 response status )

I'm using RestTemplate to make the GET call to asana's REST Api.
By using postmen when i'm calling:
https://app.asana.com/api/1.0/events?resource=PROJECT_ID
I'm getting a message and a sync token ( this is the same case when the sync token is too old and needs to be renewed ).
By using the RestTemplate, when the sync token is too old \ its the first call i'm making and I need a sync token, I'm getting a 412 response "Prediction Faild".
This happens also in postman, but i'm getting along with the "error" message the new sync token.
With the RestTemplate all i'm getting is this error:
Aug 06, 2015 3:56:55 PM org.springframework.web.client.RestTemplate handleResponseError
WARNING: GET request foPROJECT_ID21650756795165" resulted in 412 (Precondition Failed); invoking error handler
Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 412 Precondition Failed
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:90)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:494)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:451)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:385)
at availo.worker.asana.MainTask.getEvents(MainTask.java:86)
at availo.worker.asana.MainTask.getProjects(MainTask.java:76)
at availo.worker.asana.MainTask.main(MainTask.java:115)
Any suggestions?
Thanks!
This worked for me. It lets you read the message that comes with the error:
restTemplate.setErrorHandler(new DefaultResponseErrorHandler(){
protected boolean hasError(HttpStatus statusCode) {
return false;
}});
When first subscribing to Events on a resource you will receive a 412 Precondition Failed response code due to the fact that there is no sync token established yet. You should extract that sync token and use it in your next request to begin receiving events.
It looks like RestTemplate is invoking an error handler due to the 412 response code, which is understandable as a 412 is an error code.
If you can override DefaultResponseErrorHandler.handleError(), check that the response is a 412, then extract the sync token you could pass that in your next request to get events on the resource.
Another option is to use our Java client library, which should handle all of this for you.
This is what it might look like using our client:
System.out.println("Watching for events on project: " + project.name);
for (Event event : client.events.get(project.id)) {
System.out.println("User: " + event.user.name + "\nAction: " + event.action + "\nResource: " + event.resource);
}

SOAPUI REST url having + in JSON issue

I am using SOAPUI v4.6.4.
I am testing REST SOAPUI test. I have the media type set to application/json.
I am trying to pass this value as part of JSON string and I get 404 server error.
{"enteredTime":"2001-12-17T09:30:47+05:00"}
It is having issues with + sign.
I tried encoding it as 2001-12-17T09%3A30%3A47%2B05%3A00. The 404 server is gone but the application code is NOT expecting the encoded value.
Any solutions are highly appreciated.

Youtube Data API-debugging authentication errors

Getting authentication errors when I try and obtain my upload authorization token
https://developers.google.com/youtube/2.0/developers_guide_protocol_error_responses
Using a packet sniffer, my first error message is>
401 Token invalid - Invalid token: Cannot parse AuthSub token:
In addition to perhaps improperly formatted Auth key value, I'm wondering exactly what headers I should be including for my upload auth request.
I am using the following though think clientId has been deprecated
"Authorization", "GoogleLogin auth=\"" + authToken + "\""
"X-GData-Client", clientId
"X-GData-Key", "key=" + devKey
After changing
"Authorization", "AuthSub token="+authToken
to
Authorization", "GoogleLogin auth="+authToken
in my request I no longer get 'Cannot parse AuthSub token' error message but
I still get
Error #2032: Stream Error. URL: http://gdata.youtube.com/action/GetUploadToken
<errors>
<error>
<domain>yt:authentication</domain>
<code>Unknown</code>
</error>
</errors>
Stumped. Would really appreciate any feedback as I'm not even certain now where my error(s) exist!
ok working but not really sure how:)
Am using these 2 headers in my POST request to
'http://gdata.youtube.com/action/GetUploadToken'
"Authorization", "GoogleLogin auth="+authToken
"X-GData-Key", "key=" + devKey
And also needed to associate my youtube user developer credentials with a channel
https://groups.google.com/forum/#!msg/youtube-api-gdata/76x8vaADJWM/36O05FD7mC0J
A packet sniffer or at least adding support to read the XMl error responses is essential!
I resolved this problem by providing the correct developer key

Resources