This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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 "">SERVER:PORT/.../FLOWUUID

 

Anybody knows? Thanks.

 

Parents
  • 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.

     

     

     

     

Reply
  • 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.

     

     

     

     

Children
  • Yes I did try it. Still the same error...
  • Have you tried like slash after 3 backslashes( \\\/ ) ? 

  • 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("\\\\", "\\\\\\\\");

     

     

  • 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 "SERVER:8443/.../e03ab740-fb34-4257-8d9b-fdc4ca9d8a7e
    =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"

     

  • 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.

  • 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.
  • 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 :) 

  • 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...
  • 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?
  • 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.