OS Call using javascript

Sort:
You are not authorized to post a reply.
Author
Messages
mondrar
Advanced Member
Posts: 35
Advanced Member
    In a unix environment, is it possible to make on OS call using javascript in Design studio?
    John Henley
    Senior Member
    Posts: 3348
    Senior Member
      Yes you can do that.
      One way to do it is to make an HTTP request, like this:

      function FORM_OnInit()
      {
      var sURL = window.location.protocol + "//" + window.location.host + "/cgi-lawson/test-cgi";

      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      xmlhttp.open('GET', sURL, false);
      xmlhttp.send(null);
      alert(xmlhttp.responseText)
      }

      Here's my 'test-cgi' script in /cgi-lawson:

      #!/bin/sh

      # disable filename globbing
      set -f

      echo Content-type: text/plain
      echo

      echo CGI/1.0 test script report:
      echo

      echo SERVER_SOFTWARE = $SERVER_SOFTWARE
      echo SERVER_NAME = $SERVER_NAME
      echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
      echo SERVER_PROTOCOL = $SERVER_PROTOCOL
      echo SERVER_PORT = $SERVER_PORT
      echo REQUEST_METHOD = $REQUEST_METHOD
      echo HTTP_ACCEPT = "$HTTP_ACCEPT"
      echo PATH_INFO = "$PATH_INFO"
      echo PATH_TRANSLATED = "$PATH_TRANSLATED"
      echo SCRIPT_NAME = "$SCRIPT_NAME"
      echo QUERY_STRING = "$QUERY_STRING"
      echo REMOTE_HOST = $REMOTE_HOST
      echo REMOTE_ADDR = $REMOTE_ADDR
      echo REMOTE_USER = $REMOTE_USER
      echo AUTH_TYPE = $AUTH_TYPE
      echo CONTENT_TYPE = $CONTENT_TYPE
      echo CONTENT_LENGTH = $CONTENT_LENGTH


      Thanks for using the LawsonGuru.com forums!
      John
      mondrar
      Advanced Member
      Posts: 35
      Advanced Member
        Thanks John,

        This is good info. How about if we are using Websphere.

        I want to get a Perl CGI script I threw together like the one attached working in design studion. I also understand WebSphere Portal uses IBM HTTP Server that has a cgi-bin in its directory. Is this true? I assume that it's possible to run Perl CGI scripts with this server.

        Note: I'm new to Lawson, so forgive me if I sound like a newbie. Ninja status is a few years away...

        Here is my envoronment info:
        Portal: 9.0.0.0.29
        IOS: 9.0.0.1.157
        SP: 1
        Environment: 9.0.0.1.157
        Oracle: 10g
        AIX: 5.2.ML6
        WebSphere: 6.0.2.1
        MicroFocus: 4.0 SP2






        Attachments
        John Henley
        Senior Member
        Posts: 3348
        Senior Member
          Thanks for mentioning Websphere. I should mentioned in my previous post that it is specific for 8.0.x environment; LSF9 is indeed different because of the way Lawson maps the cgi-lawson directory to $GENDIR/cgi-bin via Websphere. Which makes things a little different. I don't have the details handy right now, but I'll try and provide them later.
          Thanks for using the LawsonGuru.com forums!
          John
          Jenna
          Posts: 5
            John,

            Do you have any additional details on using Perl for Design Studio in LSF9? My developer is also asking if Perl can still be used (documentation says Javascript), and your response to mondrar's question is the closest I've found to an answer.

            Thanks! Jenna

            moving to LSF9 environment & apps, Websphere, Windows & SQL Server 2005
            from 8.0.3 on Unix & Oracle
            mondrar
            Advanced Member
            Posts: 35
            Advanced Member

              I have been able to pass OS commands to call shell scripts using a custom COBOL form, not design studio. It would be no problem to execute perl scripts as well, although, I have been unable to figure out how to pass parameters from these forms to shell scripts.

              ./Richard

              John Henley
              Senior Member
              Posts: 3348
              Senior Member
                Can't you just code the parameters as part of the URL (i.e. ?param1=value1) and then examine them within the script?
                Thanks for using the LawsonGuru.com forums!
                John
                You are not authorized to post a reply.