I have tried using while loop in BPEL process designer.I'm assigning the response to a variable and concatenating that in an output string. It shows in the console that response is received on invoking the service(which returns muliple items) but Gives SelectionAxis Failure in the final response.
OutputString concatenates each time a response is recieved and displays final result as a string
Related
I'm new to elixir/ecto and I don't understand why my error_data field (defined as :binary in schema) gets inserted slash-escaped in my postgresql column:
params = %{error_data: "eyJtZXNzYWdlIjoiSW52YWxpZCB0b2tlbiIsImNhdXNlIjpbXSwiZXJyb3IiOiJub3RfZm91bmQiLCJzdGF0dXMiOjQwMX0="}
cast(%{}, params, [:error_data])
|> change(%{error_data: Base.decode64!(params.error_data)})
|> Ecto.Repo.insert()
Following #smathy insight, I've put an IO.puts(get_change(changeset, :error_data) between change and insert calls. It shows the data has beed decoded and is not slash escaped before insertion. But the next line showing Ecto query is escaped... Check my app's output:
[info] Creating error for 1 on channel 1
{"message":"Invalid token","cause":[],"error":"not_found","status":401}
[debug] QUERY OK db=0.5ms
INSERT INTO "errors" ("code","error","error_message","http_status","id","channel_id","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING "id" ["error-03", "{\"message\":\"Invalid token\",\"cause\":[],\"error\":\"not_found\",\"status\":401}", "Invalid token", 401, 1, 1, ~N[2021-02-16 12:24:58], ~N[2021-02-16 12:24:58]]
Then check these DB queries out: the first is for the code inserted error. The last is from a manually inserted not-escaped error:
dev=# SELECT error FROM errors ORDER BY updated_at DESC limit 1;
error
---------------------------------------------------------------------------------------
"{\"message\":\"Invalid token\",\"cause\":[],\"error\":\"not_found\",\"status\":401}"
(1 row)
dev=# SELECT error FROM errors ORDER BY updated_at ASC limit 1;
error
---------------------
{"eita": "deu pau"}
(1 row)
How can I avoid that escape and insert the plain decoded ({"message":"Invalid token","cause":[],"error":"not_found","status":401}) content?
If I could use ecto fragments in insertion, I'd have told the DB to decode the base64 string... I didn't find how to do that either... any help?
I wonder it there is any environment configuration that affects ECTO in order to log it's queries and ends up string casting/escaping the error_data binary...
They're not really there, they're just being displayed by whatever tool you're using to print out that value because that tool uses "s as the string delimiter, and therefore escapes them to avoid ambiguity.
Same thing happens in an iex session, if you actually print out the value then it comes out as you're expecting because when you output a string it won't include the delimiters:
iex(6)> Base.decode64! "eyJtZXNzYWdlIjoiSW52YWxpZCB0b2tlbiIsImNhdXNlIjpbXSwiZXJyb3IiOiJub3RfZm91bmQiLCJzdGF0dXMiOjQwMX0="
"{\"message\":\"Invalid token\",\"cause\":[],\"error\":\"not_found\",\"status\":401}"
iex(7)> IO.puts v
{"message":"Invalid token","cause":[],"error":"not_found","status":401}
:ok
Update
This is me running a psql query after running precisely the code you've shown above on a string (varchar) field:
testdb=# select error_data from tt;
error_data
-------------------------------------------------------------------------
{"message":"Invalid token","cause":[],"error":"not_found","status":401}
(1 row)
I'm using Angular 4 and a Spring service that I throws an exception with the message being the toString of a List of messages. The problem is that when I receive the exception response and extract the message, instead of being treated like an Array of strings, it's treated as a single string in the format of: "[message 1, message 2]"
Is there a way in typescript to easily convert this String into an array of strings? I tried instantiating a new Array with the string like: new Array(errorResponse.error.message); but that didn't really work.
It should working for you:
var messages = message.substring(1, message.length-1).split(", ");
Fiddle with a function, which doing this is available here.
It works with JSON.Parse("[message 1, message 2]");
I am trying to iterate through a JSON array which has been encoded to a string for the purpose of storing on a queue. However, I receive the following error message:
{"code":"ExpressionEvaluationFailed","message":"The execution of
template action 'For_each' failed: The result '[{\"Foo\":\"Bar\"}]' of
the evaluation of 'foreach' action expression
'#{json(decodeBase64(triggerBody()['ContentData']))}' is not a valid
array."}
The following is the string being parsed:
[{"Foo":"Bar"}]
I have no problems parsing a JSON string when it is not in an array, for example:
{"Foo":"Bar"}
This parses just fine when I am not using a For_each.
How do I get the logic app to read this as an array?
The issue here is that you are using string interpolation (where expressions are wrapped in #{ ... }) that evaluates to a string representation of the array. Hence evaluation of the 'foreach' expression fails.
You want the expression to be
#json(decodeBase64(triggerBody()['ContentData']))
json(decodeBase64(body('HTTP')?['$Content']))
enter image description here
I am doing 2player game and when I get informations from server, it's in format "topic;arg1;arg2" so if I am sending positions it's "PlayerPos;x;y".
I then use split method with character ";".
But then... I even tried to write it on screen "PlayerPos" was written right, but it cannot be gained through if.
This is how I send info on server:
server.write("PlayerPos;"+player1.x+";"+player1.y);
And how I accept it on client:
String Get=client.readString();
String [] Getted = split(Get, ';');
fill(0);
text(Get,20,20);
text(Getted[0],20,40);
if(Getted[0]=="PlayerPos"){
text("HERE",20,100);
player1.x=parseInt(Getted[1]);
player1.x=parseInt(Getted[2]);
}
It writes me "PlayerPos;200;200" on screen, even "PlayerPos" under it. But it never writes "HERE" and it never makes it into the if.
Where is my mistake?
Don't use == when comparing String values. Use the equals() function instead:
if(Getted[0].equals("PlayerPos")){
From the Processing reference:
To compare the contents of two Strings, use the equals() method, as in if (a.equals(b)), instead of if (a == b). A String is an Object, so comparing them with the == operator only compares whether both Strings are stored in the same memory location. Using the equals() method will ensure that the actual contents are compared. (The troubleshooting reference has a longer explanation.)
Im trying to debug a null dereference in my program. The program receives data from a web form submitted by the user. It seems that the problem is related with empty fields. When user submit the form the table data is finally retrieved in a char *tabledata variable.
tabledata handle the data of the table using this format:
"row1column1value/row1column2value/row1column3value|row2column1value/row2column2value/row2column3value|\0"
For debugging purpose im printing tabledata content using:
printf("\n tabledata is = %s \n\n", tabledata);
But when i submit the table if i leave the first column of the second row empty im getting this output:
tabledata is = 11/22/33/44/55/22/33|(null)/1/44/55/88/33/44|
How is it possible that printf does not stop printing when it reaches a null character? How can i check that this (null) value is really a \0 null character?
%s along with printf will not do it.
You have to use puts(tabledata);
Hope this answers your question.