Configuring a Process Flow

How to:

A process flow contains all the business logic and performs the required processing. It parses the received event document to retrieve the parameter for the requested file name. It validates that the requested file exists. If the file exists, the process flow retrieves the content of the file. If the file is not available, the process flow returns a default error message.


Top of page

x
Procedure: How to Configure a Process Flow

To configure a process flow:

  1. Using iWay Designer, create a new iWay Registry based project called Get File.

  2. Create a new process flow called GetFile.pFlow under the Get File project.

  3. Add a Service object to the process flow.

  4. Enter XDSREGAgent for the Class Name.

    The service is based on the Class Name XDSREGAgent, which allows for the setting of special registers.

  5. Do not change the default options on the configuration screen.

  6. On the User Defined Properties screen add a new register with the following settings:

    • Name: file
    • Type: string
    • Value: _after(_xpath(/http/parms/parm[contains(@name,'action')]),'=')

    The IFL statement for the value will perform an XPATH into the event document which is received from the nHTTP listener. It will extract the parameter value from the document which holds the URL part provided by the user. Then it will parse it and get the file title value after the '=' sign. Below is a sample of the event signal document returned by nHTTP with a marked "action" parameter. So in this example, the file SREG will be set to myfile.txt.

    Sample URL provided by user:

    http://localhost:2222/file=myfile.txt

    Sample Event document from nHTTP:

    <http user="unknown" type="GET">
    <parms>
    <parm name="ibse-port">9000</parm>
    <parm name="Host">localhost:2222</parm>
    <parm name="Connection">keep-alive</parm>
    <parm name="pdm">0</parm>
    <parm name="version">1.1</parm>
    <parm name="Accept-Language">en-us,en;q=0.5</parm><parm name="action">file=myfile.txt</parm><parm name="Keep-Alive">300</parm>
    <parm name="Accept"> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    </parm>
    <parm name="User-Agent">
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
    rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 (.NET CLR
    3.5.30729)
    </parm>
    <parm name="url">/file=myfile.txt</parm>
    <parm name="ip">127.0.0.1</parm>
    <parm name="source">hostname unknown</parm>
    <parm name="Accept-Charset">ISO-8859-1,utf-8;q=0.7,*;q=0.7</parm>
    <parm name="Accept-Encoding">gzip,deflate</parm>
    <parm name="reqType">GET</parm>
    </parms>
    <body/>
    <url secure="false">
    <host>localhost</host>
    <port>2222</port>
    <path>/file=myfile.txt</path>
    <query/>
    </url>
    <version>1.1</version>
    </http>
  7. Relate the Start and Set Title Register objects using the On Completion relation.
  8. Add a File object to check if the file with the given title exists.

  9. Select File Operations from the drop- down list.

  10. Provide the following configuration to check for the file. The files are located in the c:\temp\ directory, but you can configure it to any directory.

    • Operation: exist
    • File: c:\temp\sreg(file)
    • Out Doc: result
    • Action on Failure: input

  11. Relate the Set Title Register and Check if File Exists objects using the On Completion relation.
  12. Add another File object, which will read the requested file if it exists.

  13. From the Type drop-down list select File Read to indicate that the file is located in the directory.

  14. Configure the file to be read from the c:\temp\sreg(file) location which will attempt to read the requested file from that directory. Configure the response type to flat.

  15. Relate the If File Exists and Read File objects using the On Success relation.
  16. Create another service object to set a default error message if the file requested is not found in the location.

  17. Configure this object using the XDConstantAgent class name, which sets the current content of the document.

  18. In the Value column for the Constant Output To Emit parameter, type, ERROR: Requested file not found! The output format is flat. This will indicate to the user that the file does not exist.

  19. Relate the If File Exists and Default MSG if no file objects using the On Custom (notfound) relation.
  20. Add an End object to the process flow.
  21. Relate the Read File object to the End object using the On Completion relation.
  22. Relate the Default MSG if no file object to the End object using the On Completion relation.

  23. Save and deploy the process flow to the iWay Registry.


iWay Software