I'm having 2 issues when trying to do the create api requests using the jmeter tool
1). How to handle an array parameter. "Versions": "$[Versions]"
getting the following error message
{"timestamp":"2020-02-14T07:18:33.720+0000","status":400,"error":"Bad
Request","message":"JSON parse error: Cannot deserialize instance of
java.util.ArrayList<java.lang.Object> out of VALUE_STRING token;
nested exception is
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot
deserialize instance of java.util.ArrayList<java.lang.Object> out of
VALUE_STRING token\n at [Source: (PushbackInputStream); line: 15,
column: 22]
2). how to handle dynamically created time stamp parameter createtime: "${createtime}"
getting the following error message
{"timestamp":"2020-02-14T07:17:58.942+0000","status":400,"error":"Bad
Request","message":"JSON parse error: Cannot deserialize value of type
java.time.OffsetDateTime from String \"${factoryCompleteTime}\":
Failed to deserialize java.time.OffsetDateTime:
(java.time.format.DateTimeParseException) Text
'${factoryCompleteTime}' could not be parsed at index 0; nested
exception is
com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot
deserialize value of type java.time.OffsetDateTime from String
\"${factoryCompleteTime}\": Failed to deserialize
java.time.OffsetDateTime: (java.time.format.DateTimeParseException)
Text '${factoryCompleteTime}' could not be parsed at index 0\n at
[Source: (PushbackInputStream); line: 15, column: 24]
My json body looks like this.
"Versions": "$[Versions]",
"createtime": "${createtime}"
I think you should pass this Versions a little bit differently, for example if it should be a JSON Array it should look like:
"Versions": [${Versions}],
or
"Versions": ${Versions},
It appears that your ${factoryCompleteTime} variable doesn't have a value so it has been replaced by the default placeholder. Use Debug Sampler and View Results Tree listener combination in order to check the variable value, it should be in format of the OffsetDateTime to wit something like: 2007-12-03T10:15:30+01:00
Related
I have created a Logic App that converts XML to JSON
LogicAppProcess
This work 'great', no issues in that part of the process - however, this retains some ? and # symbols within some of the column names. This is then not working downstream in an Azure Data Flow as the # symbol is being picked up a parameter..
enter image description here
{"code":"BadRequest","message":"ErrorCode=InvalidTemplate, ErrorMessage=Unable to parse expression 'version'","target":"pipeline/PL_XXXX/runid/XXXX","details":null,"error":null}
Any ideas as to how i can either replace the ? and # symbols at the first point in the process (Logic App) or accommodate for these in the Data Flow?
This is how the Data Flow code sees the error in the Script element - the ?xml is not throwing an error but the first # is, and shows #version as the error
"script": "source(output(\n\t\t{?xml} as ({#version} as string, {#encoding} as string),\n\t\trss as ({#version} as string, {#xmlns:cisAbstract} as string...
You can use the replace() function in your logic app to replace the ? and # with null string "". If your data is not string type(such as json object or array or any other type), you can use string() function to convert them to string first and then do the replace() function. Shown as below expression:
replace(replace(string(<your data>), '#', ''), '?', '')
Does anyone know how to read this file (array of array, i think??) with retrofit. Can't find any examples on the internet. Have tried
1. ArrayList
2. Collection
3. []
4. [][]
5. List
Error:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 3 path $[0]
File:
[[1518173474652,"0.10002000","0.10010300","0.10000100","0.10009300","51.46200000",1518173534651,"5.14685961",86,"27.11500000","2.71207304","0"],[1518173534652,"0.10009300","0.10025000","0.10009300","0.10010800","122.42800000",1518173594651,"12.25782098",123,"20.10800000","2.01471571","0"]]
I think you're parsing it as a JSON, because of the error you received :
Error: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 3 path $[0]
That file, unfortunately, is not a JSON file, it doesn't fulfill the JSON syntax requirement. To check this, copy-paste your file into any JSON formatter online and they can validate it for you.
You could try parsing it with a custom-made converter. Example here.
I am passing a JSON array object in the HTTP POST as
[{"level":"INFO","data": "Test 1"},{"level":"INFO","data": "Test 2"}]
This message is seen as 1 object/log message in SumoLogic. How can I tell SumoLogic to consider each JSON object as an independent object and show 2 log messages instead of one?
I believe this can't be done with the json operator. But, have a look at the docs for the "parse regex" operator. There's an option called "multi" which creates a new message for each match of the regex. In your case, something like this might do the trick:
parse regex "\{?<fieldname>.*?\}" multi
I didn't try this in the product itself, but here is Regex101 link to play with the regex.
I believe the actual answer to this is to not send your logs as an array. Instead include each json object in your body with a '\n' at the end for Sumo to consider these as individual log messages.
{"level":"INFO","data": "Test 1"}\n
{"level":"INFO","data": "Test 2"}\n
I want to transfer a file from a form to a webworker. In chrome i simple can use this code to transfer a FileList-Object:
worker.postMessage(files: array_files);
But with Firefox i get this error:
Transfer file to webworker: DataCloneError: The object could not be cloned.
So i tried to use the Syntax for transferable objects. Something like this?
var post = {files: array_files, file_ids: response.file_ids};
worker.postMessage(post, [post]);
But with that i get this in Chrome
Uncaught DataCloneError: Failed to execute 'postMessage' on 'Worker': Value at index 0 does not have a transferable type.
And still
DataCloneError: The object could not be cloned.
in Firefox.
What is the right way to pass a FileList to a worker?
I don't know how to pass File objects with postMessage, but at the least I can advise that transferable objects do not work in this way. The optional second parameter is an array of the backing ArrayBuffer instances of any typed arrays you wish to pass. So for instance, suppose the message you would like to post is a structured object:
var message = {foo: 'abc', bar: new Uint8Array(...)};
worker.postMessage(message, [message.bar.buffer])
Also notice that passing a typed array to another worker/window as a transferable object makes the transferred array inaccessible from the sending worker/window.
Precondition: service based on CXF receives request/response with data, which violates XSD restriction.
Actual behavior:
In this case CXF returns fault with message like:
cvc-maxLength-valid: Value 'string_length_violated_value' with length = '28' is not facet-valid with respect to maxLength '13' for type 'XSDStringTypeWithLengthRestriction'
Goal:
return fault to consumer with name of field which contains invalid data. F.e. something like this:
Response from provider contains invalid data. Value 'string_length_violated_value' of field 'field_name' is not facet-valid with respect to maxLength '13'.
I'm wondering if it is possible and if so, then how to determine (where to retrieve from) this field name?
I'm not sure if this will completely work, but you can give it a try:
You can create a JAXB ValidationEventHandler and register that on your endpoint.
The ValidationEvent that it gets has the basic string (that you see above) and other information. I would put a breakpoint in there and dig into the event to see if ANY additional and useful information is available.