Highlighted
Absent Member.. Absent Member..
Absent Member..
7230 views

How to escape slashes in JRSFlowInvoke command construction?

Anybody is aware, how to avoid call REST errors, when passed value contains slash? E.g. in below line, the call will fail with an error: "path not found" . Note: I replaced all vars by fake values :).

 

java -jar "C:\Program Files\Hewlett-Packard\Operations Orchestration\Studio\tools\JRSFlowInvoke.jar " -u USER -ep ENCRPTPASS "https://SERVER:PORT/PAS/services/rest/run/FLOWUUID?host=blah42&dirPath=/mnt/alex&timeout=3600" 

 

Anybody knows? Thanks.

 

0 Likes
15 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi Alex,

 

Have you tried to send "dirPath" parameter like "\/mnt\/alex" ? Slash(/) and backslash(\) characters are special characters in java and javascript so while using special characters its a little bit tricky.

If you haven't, try to send special characters with backslash(\). It should solve your problem.

 

 

 

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Yes I did try it. Still the same error...
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Have you tried like slash after 3 backslashes( \\\/ ) ? 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Here is our sample java code that calls JRSFlowInvoke.jar

 

//sending a parameter that contains url info

URL = "/folder/attachments/filename.txt";

sURL = sURL.replaceAll("/folder/attachments", "http://url_path/attachments");
sURL = sURL.replaceAll("\\", "\\\\");

 

//sending a parameter

fieldvalue = "\\parameter_value";

fieldvalue = fieldvalue.replaceAll("\\\\", "\\\\\\\\");

 

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

It does not matter how many backslashes I put in - result is the same...
Below is what I do:

(note: I use just cmd to simplify)


H:\>java -jar "C:\Program Files\Hewlett-Packard\Operations Orchestration\Studio\
tools\JRSFlowInvoke.jar " -u UID -ep PASS "https://SERVER:8443/PAS/services/rest/run/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host
=lab001&command=df -k \\\\\/mnt"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 request=/PAS/services/rest/run/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host
=lab001&command=df -k \\\\\/mnt, error=path not found: '/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host=
lab001&command=df -k \\\\\/mnt', host=xxx.xxx.xxx.xxx</title>
</head>
<body><h2>HTTP ERROR: 404</h2><pre>request=/PAS/services/rest/run/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host
=lab001&command=df -k \\\\\/mnt, error=path not found: '/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host=
lab001&command=df -k \\\\\/mnt', host=xxx.xxx.xxx.xxx</pre>
<p>RequestURI=/PAS/services/rest/run/e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e?host
=lab001&command=df -k \\\\\/mnt</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/></body>
</html>

 

I did play with \, \\, \\\, \\\\, \\\\\, etc. the same result "path not found"

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi Alex,

 

The error is related with your flow path. Are you sure about the uuid of the flow? Check the flow UUID. Change the parameters of the below command with your info and try like this:

 

C:> java -jar "C:\Program Files\Hewlett-Packard\Operations Orchestration\Studio\tools\JRSFlowInvoke.jar " -host SERVER:PORT -flow "/Library/My Ops Flows/Test Flow" -inputs "host=lab001&command=df -k /mnt" -u username -p password -async 

 

You can use flow path or UUID for -flow parameter.

 

I ve tried the sample on my system and it works perfectly.

 

Best Regards.

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

WOW!
ntt00015, you are genius!

By this format you provided - it's all working now... and even this format I love much more b/c UUID is we need to put!
Where you got this? I did not see it in SDK docs.

Once again - thank you!

BTW - UUID was correct, when took off "/" it runs. But no worries about that - YOU solve my problem! Thanks.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Not at all! 🙂

 

It is already written in SDK Guide. Check out the pages 67-73. You can find some samples of JRSFlowInvoke(jar/exe)  with UUID or flow_path.

 

If you've sent the response error earlier, we didn't have deal with special characters.

 

While calling the jar/exe file from command prompt directly you don't have to add escape characters to parameters but, calling from java or shell might still be a little tricky. You might have to add escape characters. Just use trial and error method 🙂 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Sure Man! Thanks a lot.

BTW FYI: I have another subject opened here (filling variables) I got some result (quite strange but result). If fill the FailureMessage var, then Result will filled automatically by the same content...
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi ntt00015,
is there any trick to avoid an error:
"java.net.SocketException: Connection reset" It by default set as 6 minutes I guess, but I was not able to find how to set it longer.
Any idea on that?
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi,

This is a general error. Where are you getting this error? After or before the connection? Or when trying to connect?
It might be cause of firewall or port settings. Have you checked the connections with telnet? Check it manually from the host machine, and vice versa.
Check your username and password too.

One more thing: Check the JVM that you are using.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.