Search file in a folder from Onedrive in Azure logic app - azure

I'm having an issue using the OneDrive for Business - List files in folder action.
I'm setting the path of the action to be a parameter received from a previous step via http request.
The value of the path is for example - /Clients/ER/EDI/ERGL/Source
When I hard code the path by selecting it in the OneDrive action, its value at runtime is
"datasets/default/folders/01RODCPVEAQQCC4IDDRBF3JHJW2GR43CXZ" and at design time it is set to
"path":
/datasets/default/folders/#{encodeURIComponent(encodeURIComponent('01RODCPVEAQQCC4IDDRBF3JHJW2GR43CXZ'))}
However, when I try and set the path via parameter, which at design time looks like this
"path":
/datasets/default/folders/#{encodeURIComponent(encodeURIComponent(triggerBody()?['Source']))}"
and is at run time - /datasets/default/folders/%252FClients%252FER%252FEDI%252FERGL%252FSource
it does not work. I'm obviously missing something here, with encoding the path parameter? Any suggestions?
Thanks,

Actually you get the true path, it's just in a encode format. You could find the example , the encodeUriComponent will return the URI-encoded string with escape characters.
So you could decode what you get with this expression:
decodeUriComponent(decodeUriComponent('%252FClients%252FER%252FEDI%252FERGL%252FSource'))
Then you will get the absolute path.
Hope this could help you, if you still have other questions, please let me know.

Related

XML data format for a query on Nextcloud OCS

The problem is about getting a direct download link to a Netcloud file.
Documentation :
To obtain a direct link:
POST /ocs/v2.php/apps/dav/api/v1/direct
With the fileId in the body (so fileId=42 for example).
I want to POST this URL with Nodes.js. What is the XML (I guess) format to set "fileId=42" in the body of my request ?
Everything I try returns me
"Invalid query, please check the syntax. API specifications are here:http://www.freedesktop.org/wiki/Specifications/open-collaboration-services." but noway there to get the format.
Samething with curl, no syntax is working.
In a more generic way what is the XML (I guess) format when querying the OCS API?
I answer my question:
At last I suceeded in making it work with curl, single/double quotes in Windows was the problem, fixed using "{" escape character.
This told me this was not about OCS data format itself as data is to be sent as it, ie "fieldId=42"
Switching from NojesJs/https lib to Axios fixed the problem. Probably some content-type header, however I tried 'application/x-www-form-urlencoded' which fits with the data to send.

The XML parser detected error code 302

I am using the XML-INTO op-code to parse a web service request. Every now and then I get errors in the logs
(RNX0351 - "The XML parser detected error code 302").
The help for a 302 is
302 The parser does not support the requested CCSID value or
the first character of the XML document was not '<'
To the best of my knowledge, the first character is "<" and the request is generated from a previous web service call so I would be very suprised if the CCSID has changed.
The error is repeatable, for the specific query so it is almost certainly data related, I am just unsure how I would go about identifying the offending item.
Any thoughts on how to determine the issue, or better yet, how to overcome it?
cheers
CCSID is an AS400/iSeries/Power System attribute, and it applies to the whole IFS.It's like a declaration of what inside the file is, or in other words what its internal encoding "should be".
It's supposed that data content encoding in the file and the file one (the envelope) match, and the box uses this attribute to show and handle corresponding characters.
It sounds like you receive data under one encoding, but CCSID file doesn't match.
Try changing CCSID on your file (only the envelope). E.G.: 37 (american), 500 (latin-1), 819 (utf-8), 850 (dos), 1252 (win) and display file after.You can check first using ls -Sla yourfile in QSH or QP2TERM, or EDTF as well. CHGATTR allows you to change CCSID, as well as setccsid in QSH (again).
This way helped me to find related issues. Remember that although data may be visible in the four hundred, they may not be visible through a share folder in Win. It means that CCSID file, an content encoding don't match.
Hope it helps.
Hi I've seen this error with XML data uploaded to AS400/iSeries/IBM i with FTP and the CCSID 819 (ISO 8859-1 ASCII) and it has some binary garbage in first few positions of file. Changed encoding to CCSID 1208 (UTF-8 with IBM PUA) using FTP "quote type c 1208" and the problem cleared and XML-INTO was successful.
So, suggestion about XML parser error 302 received when using XML-INTO is to look at the file (wrklnk ...) and if first character is not "<" but instead some binary garbage then try CCSID 1208 for utf-8.
Statements in this answer about what 819 is and what ccsid represents utf-8 do not agree with previous answer but are correct, according to IBM documentation:
https://www-01.ibm.com/software/globalization/ccsid/ccsid819.html
https://www-01.ibm.com/software/globalization/ccsid/ccsid1208.html
I'm working on this problem a couple hours,
for me the solution was use option ccsid=UCS2 when you use data structure or variable to store xml.
something like that :
XML-INTO customer %XML( xmlSource : 'ccsid=UCS2');
I have the program running on ccsid = 870, every conversion to ccsid on the xmlSource field don't work,
The strange thing that when I use the file with ccsid = 850, every thing work fine
I mention that becouse this is the first page when you looking about this problem.
Maybe this help someone.

Relative path for JMeter XML Schema?

I'm using JMeter 2.6, and have the following setup for my test:
-
|-test.jmx
|-myschema.xsd
I've set up an XML Schema Assertion, and typed "myschema.xsd" in the File Name field. Unfortunately, this doesn't work:
HTTP Request
Output schema : error: line=1 col=114 schema_reference.4:
Failed to read schema document 'myschema.xsd', because
1) could not find the document;
2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
I've tried adding several things to the path, including ${__P(user.dir)} (points to the home dir of the user) and ${__BeanShell(pwd())} (doesn't return anything). I got it working by giving the absolute path, but the script is supposed to be used by others, so that's no good.
I could make it use a property value defined in the command line, but I'd like to avoid it as well, for the same reason.
How can I correctly point the Assertion to the schema under these circumstances?
Looks like you have to in this situation
validate your xml against xsd manually: simply use corresponding java code from e.g. BeanShell Assertion or BeanShell PostProcessor;
here is a pretty nice solution: https://stackoverflow.com/a/16054/993246 (as well you can use any other you want for this);
dig into jmeter's sources, amend XML Schema file obtaining to support variables in path (File Name field) - like CSV Data Set Config does;
but the previous way seems to be much easier;
run your jmeter test-scenario from shell-script or ant-task which will first copy your xsd to jmeter's /bin dir before script execution - at least XML Schema Assertion can be used "as is".
Perhaps if you will find any other/better - please share it.
Hope this helps.
Summary: in the end I've used http://path.to.schema/myschema.xsd as the File Name parameter in the Assertion.
Explanation: following Alies Belik's advice, I've found that the code for setting up the schema looks something like this:
DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance();
...
parserFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdFileName);
where xsdFileName is a string (the attribute string is actually a constant, I inlined it for readability).
According to e.g. this page, the attribute, when in the form a String, is interpreted as an URI - which includes HTTP URLs. Since I already have the schema accessible through HTTP, I've opted for this solution.
Add the 'myschema.xsd' to the \bin directory of your apache-jmeter next to the 'ApacheJMeter.jar' or set the 'File Name' from the 'XML Schema Assertion' to your 'myschema.xsd' from this starting point.
E.g.
JMeter: C:\Users\username\programs\apache-jmeter-2.13\bin\ApacheJMeter.jar
Schema: C:\Users\username\workspace\yourTest\schema\myschema.xsd
File Name: ..\\..\\..\workspace\yourTest\schema\myschema.xsd

Relative path to physical path

<rant>
firstly, I've searched a lot and every single question / blog asks/tells about how to convert physical path to relative, never the other way around. If I've missed that question here, I am sorry.
<rant />
So, I have a directory structure very similar to this:
Root
|....Components
|....Classes
|....Utils
|....FileUtils
|....Assets //this is a folder
|....FileAccess.cs
So, in my FileAccess.cs I just want to read the content of a text file and display it on a page.
in my webpage.aspx.cs I am calling the getFileContent() which is in utils.
so the relative path from FileAccess.cs is Assets\spec.txt
So, how on earth can I access that with code?
this is what I am trying / tried:
//function getFileContent() content..
private const string QuestionnairePath = #"Assets\";
return Server.MapPath(QuestionnairePath + "spec.html");
it ALWAYS throws file not found exception and upon debugging it's not selecting the right folder.
I have even tried this:
private const string QuestionnairePath = #"~Utils\FileUtils\Assets\";
that doesn't work either.
This must be very easy. Just can't figure it out, for the life of me. I hate being a newbie sometimes.
Help please,
Thanks.
ps: Ideally, I would just want to use relative path: Assets\ - wonder if that is possible.

serve_file for any file object

In cherrypy.lib.static.py there is a method:
serve_file(path, content_type=None, disposition=None, name=None)
where the argument "path" must be a real file (absolute path). Is there something similar to serve any Python file object?
From studying http://www.cherrypy.org/browser/trunk/cherrypy/lib/static.py I'd have to say, no: the serve_file function is "monolithic", and does its own bodyfile = open(path, 'rb'), nor does there seem to be any alternative way. Pity, as it would be easy to refactor the function and add another e.g. serve_open_file to cover your case, having both delegate to an internal function for the "hard" logic such as multipart/byteranges serving. May be worth your while to open a feature request ("enhancement ticket") on cherrypy.org -- may not be a killer feature but I can see use cases, and implementing it wouldn't be hard for the cherrypy people (visit their site and follow the instructions on the page to "log in" to it).
As long as your file or file-like object is iterable, just return it from your handler function instead of a string.
Update:
To serve it as a download, set the Content-Type and Content-Disposition headers like so:
cherrypy.response.headers["Content-Type"] = "application/x-download"
cd = 'attachment; filename="%s"' % name
cherrypy.response.headers["Content-Disposition"] = cd
Or, use the serve_fileobj function in recent versions of cherrypy/lib/static.py, which does this for you and more.
Taking a new look at http://www.cherrypy.org/browser/trunk/cherrypy/lib/static.py, it looks like serve_fileobj does exactly what you want.
Edit: I've tried this now, and it only renders the file contents to the screen, rather than allowing the file to be downloaded.

Resources