Is it possible to iterate over an array (result of a fn:tokenize in my case) ?
I just want to enrich my payload depending on my array content. Of course, my array size is unknown ;)
WSO2 ESB 4.9.0
Thanks for your help
Related
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.
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.
I'm making a GET call to a ring backend using cljs-ajax.
The problem is that I need to pass an array too.
cljs-ajax encodes array like this:
?array[0]=one&array[1]=two
ring expects arrays to be encoded like this:
?array=one&array=two
So using the wrap-params middleware I don't get an array, but just different key-value pairs ({array[0] "one" array[1] "two}).
Is there a way to solve this, or do I have to manually parse the params on the server side?
Thank you
The limitation isn't with ring or cljs-ajax. It is a limitation in the http protocol. In a GET request, the params are just ?name=val&name=val, there is no mechanism for telling the server at the other end that the params represent an array of data - that is, distinguish between norm name/value pairs and name value pairs which should be interpreted as an array.
Therefore, you need to manually convert the map generated by your ring middleware into an array yourself in your handler. You could use a heuristic to implement middleware which looks for get params with a specific 'pattern' in the param names, such as #"array[\d+\]" and have it extract them into an array and insert into your params map. However, I think this is a bit of a kludge and unless you need to do this in many of your handlers, it would likely introduce more issues than it solves.
The easiest thing to do would be to convert your call to a post rather than a get and use json.
i am using postages Db for my services.When Null defined for any fields DSS giving Some object so my front end also getting same object .But they are expecting "NULL" instead of this they are getting {#nil":"true"}
How can i get NULL value As NULL only and its creating its own name space also for this row
http://www.w3.org/2001/XMLSchema-instance"
username password
=========== ============
NULL NULL
kk a123
for above i am getting like this fro WSO2dss side
<Datalist>
<username xmlns="http:sps.in" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<password xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</Datalist>
from my wso2esb side i am getting JSON like this
{"Body":{"Datalist":{"username":{"#nil":"true"},"password":{"#nil":"true"}}}}
But my front end service expecting in this below format where can modify for above this
{"Body":{"Datalist":{"username":"NULL","password":"NULL"}}}
In XML, the standard/recommended way to indicate that the value of a particular XML node is NULL, is via the notation [xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]. If any standard XML parser comes across this particular notation, the element which contains the aforesaid notation is treated as an element with NULL as its value. This is particularly useful, when there are values such as "NULL" (not the actual NULL but a string containing the characters, "N","U","L","L") as there's no way to distinguish the real NULL values and "NULL" character streams.
Therefore, the best way to handle this scenario would be to check for #nil attribute at client side while parsing the JSON content that returns as the response of the web service invocation. Alternatively, you can add an XSLT transformation at the data service query level to transform the response (in XML format which gets processed internally within DSS before returning JSON content) the way you want so that you'll be able to add any custom rules and transform the response before it is returned to the client side. You can refer to the sample data service named "ExcelSampleService.dbs" located in "DSS_HOME/samples/dbs/excel/" directory in the product package for an example on how this is done.
Hope this helps!
Regards,
Prabath
It worked for me. I just put that two atributtes (xsi:nil, xmlns:xsi) into my XML by changing my AS (Application Server) like this:
public static OMElement addAttributeNull(OMElement parametro){
parametro.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance", null);
parametro.addAttribute("xsi:nil", "true", null);
return parametro;
}
I was in a situation to pass the table row as the parameter to Web Service.
Anyone can explain me how can i achieve it?
When you say "table row", I'm assuming a row in a table? If that's the case it is probably easiest to put that into an array and pass that to the web service. (Given that a table is essentially a two dimensional array and you're just plucking a single array out of it.)