Getting bearer token in blob format how to get in a actual format in logical tree? - ibm-integration-bus

How to configure oauth bearer token to http request node in esq in iib
while getting token in a blob format in logical tree
I tried to convert in character but it is throwing exception like unsupported charector format in iib

Related

Getting java.util.regex.PatternSyntaxException: Illegal repetition whenever I am trying to pass nested json string in my request header - Feign Client

I am trying to call an existing REST API through Feign Client and need to pass a Nested JSON in the Request Header. A simple JSON is working fine however the REST API expects nested JSON and whenever I pass nested JSON in Feign Client it comes with the following exception ::
java.util.regex.PatternSyntaxException: Illegal repetition
{"myDate"
at java.base/java.util.regex.Pattern.error(Pattern.java:2027)
at java.base/java.util.regex.Pattern.closure(Pattern.java:3320)
at java.base/java.util.regex.Pattern.sequence(Pattern.java:2213)
at java.base/java.util.regex.Pattern.expr(Pattern.java:2068)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1782)
at java.base/java.util.regex.Pattern.<init>(Pattern.java:1428)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1068)
at feign.template.Expression.lambda$new$0(Expression.java:35)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at feign.template.Expression.<init>(Expression.java:35)
at feign.template.Expressions$SimpleExpression.<init>(Expressions.java:106)
at feign.template.Expressions.create(Expressions.java:86)
at feign.template.Template.parseFragment(Template.java:218)
at feign.template.Template.parseTemplate(Template.java:202)
at feign.template.Template.<init>(Template.java:61)
at feign.template.HeaderTemplate.<init>(HeaderTemplate.java:110)
at feign.template.HeaderTemplate.create(HeaderTemplate.java:72)
at feign.RequestTemplate.lambda$appendHeader$3(RequestTemplate.java:766)
at java.base/java.util.Map.compute(Map.java:1171)
at feign.RequestTemplate.appendHeader(RequestTemplate.java:764)
at feign.RequestTemplate.header(RequestTemplate.java:726)
at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.addHeaderMapHeaders(ReflectiveFeign.java:294)
at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:243)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:84)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)
at com.sun.proxy.$Proxy130.getImpsSummary(Unknown Source)
How do I resolve this?
I tried #RequestHeader in Feign Client and I am expecting a proper response like I get from the Postman.

How to pass xsft token through cookie

The recorded request only have xsrf token in response header and while executing the script the xsrf token not come from database
Extract it from the response header using i.e. Regular Expression Extractor, just make sure to set "Field to check" to Response Headers
textual representation of the regular expression just in case:
YOUR_HEADER_NAME_HERE\s*:\s*(.*)
Once done you can add it to the next request using HTTP Cookie Manager

How to use JSON response from InvokeHTTP to create a header for another InvokeHTTP?

The following flow takes a username/password combination and authenticates against an API via InvokeHTTP:
The result of InvokeHTTP is an authentication token:
I want to use this token in any preceding API calls. What flow do I need to provide the auth token as an authorization header for InvokeHTTP? The header has to look like this:
Authorization: Token ...
You can use an EvaluateJsonPath processor to extract a JSON value using the JsonPath expression $.token and Destination flowfile-attribute, which will place it in an attribute. So using a dynamic property named Authorization with the value $.token will result in InvokeHTTP sending a header with the value Authorization: abcdef..... In order to format the header correctly, you'll want to use an UpdateAttribute processor between EvaluateJsonPath and InvokeHTTP to update the attribute value using the Expression Language expression Token ${Authorization} to prepend the literal string.

Hapijs avoid json validation when Content-type: application/json is present

I'm trying to receive a json payload on a hapijs server, that json may not be valid, since is some custom format that i need to manually proxy the request to an elasticsearch cluster, cannot use the proxy option for hapijs because i need to do multiple requests to different clusters, for that i use nodejs http library.
Elasticsearch doesn't receive a valid json when doing bulk actions, it receives new lines instead of commas, to separate json objects:
{"index":[".kibana-devnull"],"ignore_unavailable":true}
{"size":500,"sort":[]}
Hapijs tries to validate the json payload when it gets application/json header in the request and it responds "Invalid request payload JSON format", as i cannot remove that header i need to look for another method to allow that invalid json in the route, even if the header is present.
I would look at the docs, in particular http://hapijs.com/api#route-configuration. If you set payload.output.parse to false you will receive the raw buffer inside handler which can then be parsed by yourself as opposed to by the framework.

variables post in koa framework

hi where is the data in post call in koa without co-body or bodyparse or why this error
Error: invalid JSON, only supports object and array
at parse (d:\Proyectos\koaJsTest\node_modules\co-body\lib\json.js:56:13)
co-body performs this regex unless the "strict" option is set to false:
/^[\x20\x09\x0a\x0d]*(\[|\{)/
Perhaps your json is making it to co-body as a URL-encoded string?
Its either going to be the format of the JSON that you are uploading if you are setting the Content-Type to application/json.
Otherwise, may be using the wrong Content-Type. For example if you were uploading files where the Content-Type should be multipart/form-data but you accidentally set the Content-Type to application/json when it should you would see this error.
This has tripped me up in the past.

Resources