Absent Member.. AlexGg Absent Member..
Absent Member..
7129 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.

 

Labels (1)
0 Likes
15 Replies
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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

Re: How to escape slashes in JRSFlowInvoke command construction?

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

0 Likes
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

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
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

I am sorry was not specific. I used the REST to call flow.
Flow was running about 8 minuts. So the REST was exited earlier, by internal timeout. I am looking to find how to set it for the longer execution? Hope it's better.

 

just added :

the JRSFlowInvoke.jar which was called a flow returns

socket error of Connection reset:

java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(Unknown Source)

        at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)

        at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)

        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)

        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)

        at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)

        at java.io.BufferedInputStream.fill(Unknown Source)

0 Likes
Absent Member.. ntt00015 Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

JRSFlowInvoke command returns the flowId within xml format. Is it your first trial with JRSFlowInvoke? First of all try to telnet from host(where you are running the JRSFlowInvoke command) to OO server.
"telnet SERVER PORT" server : OO server IP , PORT : OO server port (443 or 8443)
If you cannot connect with telnet there might be firewall settings between machines.

If you are calling JRSFlowInvoke try to use "-async" parameter, it starts the flow, but returns without waiting for the run to complete. "java -jar JRSFlowInvoke.jar" command on command line helps you about parameters. I think you are getting the return code 5.

If you want to wait the result of the flow, try the "RSFlowInvoke.exe" instead of jar file. It has "-t [timeout]" parameter(default value is 100 seconds). There is a slight differences between jar and exe commands.

I am not sure if JRSFlowInvoke.jar has "-t [timeout]" parameter but you can try with this parameter.

Hope it helps.

 

I tried JRSFlowInvoke.jar with and without "-async " parameter. There is an interesting thing. Firstly in my flow, I set the start step "sleep 120 seconds". And JRSFlowInvoke.jar waits 120 seconds for response. And after that  I set the start step "sleep 1 seconds" and JRSFlowInvoke.jar waits 1 seconds for response. The start step of the flow might effects for the response. Check your start step. 

 

0 Likes
Absent Member.. AlexGg Absent Member..
Absent Member..

Re: How to escape slashes in JRSFlowInvoke command construction?

Thank you very much!
Yes, it working with flows the run time of which is less then 5 minutes. I test exe with -t and git the error pretty much the same. But I guess it all related to Central is force to close SSL connection. See error:
The underlying connection was closed: Could not establish secure channel for SSL
/TLS.
System.Net.WebException: The underlying connection was closed: Could not establi
sh secure channel for SSL/TLS. ---> System.IO.IOException: Unable to read data f
rom the transport connection. ---> System.IO.IOException: Unable to read data fr
om the transport connection. ---> System.Net.Sockets.SocketException: An existin
g connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
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.