Azure Logic Apps string.format() equivalent function - azure-logic-apps

I have a string as below
"{tenant}/{version}/lotTracking/lots?siteId={siteId}&itemId={itemId}"
In c# i can replace the place holders with string.format function. But in logic apps am unable to find the equivalent function/Expression.
I found only concat function which does appending. But i am looking to replace relative path parameters in a string

There is no string format function directly available in logic apps. What you can do is three options shown below
1) Use concat to create the strings, works absolutely fine
2) Use Azure function to create string utility function which does the job for you (Honestly this would just be an overhead for simple string concat)
3) Use transformations (requires integration account or azure function port of it)

Related

LogicApps scenario log on, download, zip

I access a 3rd party website using forms authentication (username and password).
Once logged on I make a call to a HTTP endpoint and receive XML in the body. The XML contains 1000 XML elements. Within each element there is a text value, a code.
For each of these codes I make a further call to a different HTTP endpoint. The response is more XML.
When all 1000 responses have been received I would like to add all the XML responses as files to a zip container and make it available for download.
I would like to see how LogicApps could do this as quickly as possible.
Make the call to the first HTTP endpoint (auth set to basic auth with user/pass inputted)
Use the xpath(xml(<body var here>), '//elementNameHere') expression on the Body of the result from the call to get all the elements of the return value that have the code in it
Foreach over this return value and
make the HTTP call
append the result to an array variable, or concat on to a string variable.
Submit this value to blob storage
Because you're messing w/ vars in the foreach loop, though, you'll have to do it sequentially (set concurrency control on the Foreach Loop to 'on' and '1') else you could end up with a bad result.
I don't know of a way to "zip contents" here so you may have to send the result to an Azure Function that uses a .Net zip lib to do the work (or js zip lib, whatever your flavor) and does the put to blob storage for you.
This would also all be much easier in Durable Functions land, I encourage you to look in to that if you're so inclined.
One mild alternative you might consider is for step 3.2, instead upload that result to a blob storage container, then make the entire container available for download via an Azure Function call which gets the container & zips up the contents (or does the Blob Storage URL for a container do this for you already? not sure)

google oauth and variables for ClientId and Secret

I am surprised that when I submit a variable with an identical string value it is rejected when the string is accepted in google oauth
For example
$client->setClientSecret('xDDDDDDD-Tcdfgtrrfftr');
is accepted where with the same string value stored in the variable as follows
$client->setClientSecret('{$domain->GooglePlusSecret}');
is rejected.
Anyway to write this to get around it? I serve multiple domains through the same root folder and software and want to set up for individual oauths as well ???
I'm assuming you're using PHP here, since that's what your code looks like.
Single quoted strings do not have variables interpreted. The reason your OAuth token doesn't work is because you are using the literal string {$domain->GooglePlusSecret}.
You should change your code to either $client->setClientSecret($domain->GooglePlusSecret); or $client->setClientSecret("{$domain->GooglePlusSecret}");.

Pass parameters to #Cucumber.Options dynamically

I am using cucmber+selenium. Is there a way i can pass options to #Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature" // i want to take this feature file names from excel & put here...
One way of setting it is through the System.setProperties() method.
Say, if my resources/features folder has all the necessary features, I can simply instruct Cucumber to scan for all the features in the folder like,
String features = "/src/main/resources/features";
System.setProperty("cucumber.options", features);
Also, you can instantiate your RuntimeOptions dynamically like
new RuntimeOptions(features);
You could code something simple by passing command line parameters and retrieving them using ENV['xxx'].
Please see this post
Instead of using Junit, use TestNG to invoke feature files. The flow goes like, Read from Excel and with the data generate testng XML suite dynamically to invoke each feature file. Please find the reference below,
https://github.com/sahajamit/cucumber-jvm-testng-integration

camel cxf convert comma separated string to one parameter - how to escape comma

I want to send a comma separated string to simple web service (cxf based). Without comma all works fine. Camel's type converters and magic take the string and find the only method that takes a string in wsdl and generate the xml (the wsdl has only one method at all).
If i send a comma separated string i get an error because the type converter or something else interprets the string as multiple parameters and no method matches.
Is there a way to supress or escape the ',' to let camel use it as single parameter?
maybe this is a duplicate of how to pass String including comma in CXF service method or CXF & Camel : IllegalArgumentException: Get the wrong parameter size to invoke the out service.
But if not, have you tried to encode/escape the comma in your request with a "\" before?
kind regards,
soilworker
how to pass String including comma in CXF service method is indeed a duplicate but with no accepted answer.
But answer number one is working, but badly explained. So we use this ugly(the list will always only have one entry) code:
Arrays.asList("my, parameter, with, commas").

Change NamespaceManager on Full Text Search GAE

We have an application in GAE, and we are reenginering this to use Full Text. We have to index all data already in the GAE and our application also use namespaces.
We are trying to create a java procedure to be runned by administrator, who has not namespace. In other services, we have created similar java procedures, applying namespace by code, so the idea is to index all data in each namespace. (We use NamespaceFilter to control user domain.)
This is part of code:
private static final Index INDEX = SearchServiceFactory.getSearchService()
.getIndex(IndexSpec.newBuilder().setName("Actividad"));
NamespaceManager.set("userdomain1");
INDEX.add(doc);
Setting namespace is ignored.
Is this the expected behaviour? Is there an alternative way to index all the information in every namespace?
With similar code on datastore it's work fine.
A SearchService object is bound to a namespace, so you need to call NamespaceManager.set() before calling SearchServiceFactory.getSearchService(). Alternatively, call the version of getSearchService() that has a namespace parameter. See:
https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/search/SearchServiceFactory#getSearchService(java.lang.String)

Resources