Talend Populating Web Service Parameter that is an Array of Strings - web-services

I am using the tESBConsumer component (using Talend Data Integration 6.4.1) to talk to a SOAP Web Service. We need to use a Web Service method that requires one of its parameters to be an array of strings, such that the payload needs to become something like:
"... <simpleParam>Simple Param Value</simpleParam><arrayOfStringsParam>
<string>Array
Item 1</string><string>Array Item
2</string><string>Array Item
3</string></arrayOfStringsParam> ..."
I cannot determine how to pass the array into the control to get it in the correct format. There is no type for Schema fields of String[].
I tried a type List but it got written out in the payload as something like:
"... <arrayOfStringsParam>[Array Item 1, Array Item 2,Array Item
3]</arrayOfStringsParam> ..."
.
I tried a type of String and formatted the data in previous steps as
"<string>Array Item 1</string><string>Array Item
2</string><string>Array Item 3</string>"
but in the resulting payload the less-than (<) signs got encoded to "<" so they weren't recognised as proper tags.
Can someone please let me know how to get this data in the appropriate format.
Thanks.

Related

set `exclude_from_indexes` for Array datatype

I'm storing a list of strings using Array datatype in Datastore(e.g. ["name1", "name2", ...]). As the list grows, I find myself unable to upsert the entry.
INVALID_ARGUMENT: Too many indexed properties
According to https://cloud.google.com/datastore/docs/concepts/entities#array, even if I set the property to be exclude_from_indexes, it gets ignored. The datastore web UI also doesn't have an Index checkmark for me to uncheck.
So the only option I came up with is to convert the Array into a String type and parse to a JSON Object every time I read from DB, and write back stringified.
Was wondering if this is the right approach or if there are better ways to do this I'm not aware of.
Thanks
You should set the exclude_from_indexes on each value of the array. That is what "For a property to be unindexed, the exclude_from_indexes field of Value must be set to true." means.

Unmarshal set of strings in Amazon DynamoDB

I am using golang and want to store some data in Amazon DynamoDB in set of strings format SS. It is possible to store data but when I want to pull it back on unmarshaling stage it unmarshal every property except of prop that contain set of strings. Structure that I use to unmarshal in has []string type of that property. I saw that dynamodbattribute have some specific methods for unmarshaling like UnmarshalMap and so one but I didn't find specific method for SS. Can someone give me an advise?
Currently I have created custom unmarshaler following that example:
https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/#UnixTime.UnmarshalDynamoDBAttributeValue
but I still think that I am doin smth wrong because it should be easier way to parse set of strings...

How to send values selected in ListBox to java webservice parameter in BIRT?

I have a java webservice which takes values of Locations and performs action.
In my BIRT report, I have a ListBox which contains names of all the locations.
When tried to link values from ListBox to webservice parameter, BIRT developer give warning message as :
If a user selects multiple values from report parameter, the data set
parameter uses only the first value
.
I tried creating a hidden report parameter [RP_Hidden_Locations] in BIRT which is of string type and copied values from ListBox report parameter [RP_All_Locations] as [RP_Hidden_Locations].value = params["RP_All_Locations"].value.join("','");
This didn't work and null values were received in webservice method.
Please help!
PS:
Data source for Data Set in BIRT is Webserivce Data Source
and sending report parameter values as shown below
<locations>?&RP_Hidden_Locations&?</locations>
First Create the hidden variable.
In the script tab of the dataset, select before open.Here join all the values sent by the listbox report parameter. Use this:
params[RP_Hidden_Locations]= "'"+params["RP_All_Locations"].value.join("','")+"'";
Now set the SOAP Request to send this hidden parameter.

How to pass hash query params to AWS API Gateway?

I'm looking for the hash equivalent of this question: How to pass array query params to AWS API Gateway?
Basically, I want to set up query parameters that look like this:
example.com?color[background]=yellow&color[foreground]=black
When I try to create a query parameter called color[background] in the API Gateway console, I get the following error message:
Invalid mapping expression specified: Validation Result: warnings : [], errors : [Parameter name should be a non-empty alphanumeric string]
I've also tried setting up a color query param and then passing various "hashes" to it. Here's what I've tried passing into this parameter:
{"background" => 123, "foreground" => "abc"} and removing the spaces
{"background" : 123, "foreground" : "abc"} and removing the spaces
{background:123,foreground:abc}
They all result in a request that is some form of example.com?color=%7Bbackground:123,foreground:abc%7D with the hash that I pass coming after the =.
Any ideas? Is this bad practice for query string parameters anyways, and should I stick with simple params?
Since there isn't a standard defined to pass in complex data structures like arrays or maps via the query string, API Gateway does not attempt to to interpret or parse the query string as anything other than simple key-value string pairs.
If you want to pass in and transform complex types it's best to do so in the body of a POST or PUT request where you can leverage JSON and API Gateway's powerful body mapping templates feature.
Alternatively, if you must stick with query string parameters, then you must either:
Collapse your data structure to be simple key value pairs as suggested by Michael -sqlbot above, or
Passthrough the raw query string to your backend lambda or http integration where it can parsed as you please. See this post for more details on how to do that.

BIRT - using multiple webservices to get the data

I am trying to generate a report using Eclipse BIRT report designer.
The scenario is this:
There are 2 web service data sources. There are 2 datasets for webservices 'WS1' and 'WS2' respectively.
The output element 'COUNTRYID' of one webservice 'WS1' would go as input for another webservice 'WS2'.
What I did:
Created a parameter COUNTRYID.
Created a dummy Computed Column in the dataset of the web service 'WS1' with the expression:
params["COUNTRYID"].value=row["COUNTRYID"]
Now the input parameters for the 'WS2' dataset is related to the global paramter 'COUNTRYID'.
When I run the report, I see that the global parameter contains the value from the 'WS1' output.
But the report does not display the values from the response of the web service 'WS2'
My questions:
How can I see, if the webservice got fired or not?
How can I see, if the webservice got fired with correct values ?
WS1 is not fired unless it is explicitely bound to a report element. Typically, to achieve this we apply following steps:
insert a data element at the beginning of the report body
turn the property visibility of this new element to false (or let it visible during testing)
bind it to the first dataset WS1
It will force a silent execution of WS1, and therefore this will populate your parameter COUNTRYID before WS2 runs.
However this approach would not work if:
WS2 dataset has to be used to populate selection items of a report parameter (which does not seem to be the case here)
If COUNTRYID parameter is used at render time. This point is much more annoying, if you need this parameter in chart expressions for example. If so, i would recommend to store WS1 in a report variable instead of (or why not in addition to) a report parameter. See this topic to see how to create a report variable.
You can initialize it at the same place you did for the report parameter with:
vars["COUNTRYID"]=row["COUNTRYID"];
and use it anywhere with
vars["COUNTRYID"];
Report variables are available from the palette of expressions editor :