MAIN arrow Samples-5.1 arrow Expense Approval using axis2

Expense Approval using axis2

Print E-mail

zip expenseapproval 16/06/2008,23:39 150.25 Kb
 

Description:

The use case explains the process in which a user sends a request for the approval of the expense and gets the response for his request that is whether his expense is approved or not depending on the expense limit.

This use case is implemented by uploading the service in the Axis2. The WSDL file “ExpenseApprovalServiceWS.wsdl” is generated from Axis2. It contains three operations:

  • insertData
  • getForwardPage
  • getSelectedQuery.

In this use case sample, we are implementing a scenario in which user has to login to an application to approve his expense. If user is valid one, then he can submit his expense, otherwise he is considered to be an invalid one. If the user’s request for the expense exceeds the limit then he will get the response as “Expense not Approved-Rejected” else he’ll get the response as “Expense Approved”.

The document describes in detail the dependencies, requirements and step-by-step process of creating this process, deploying it and executing it in the Intalio|BPMS server.

 

Use case dependencies:

  1. Expense.xsd: The schema used is that of complex type and contains other sub-schemas.
  2. SubmitExpense.xsd: The schema used is also of complex type and contains other sub-schemas.

Requirement:

  1. Intalio|BPMS Server-5..1.1

  2. Intalio|BPMS Designer-5.1.1

  3. Client.java

  4. Client.class

  5. JdbcConnection.txt

  6. WSDL File: ExpenseApprovalServiceWS.wsdl

  7. six jsp Files
    1. ExpenseApprovalUser.jsp
    2. ExpenseApprovalUserReceiveData.jsp
    3. SubmitExpense.jsp
    4. SubmitReceiveData.jsp
    5. ExpenseApprovalInsertUser.jsp
    6. ExpenseApprovalInsertedUserReceiveData.jsp

  8. ExpenseApprovalServiceWS.aar

  9. Axis2-1.3

 

Preconditions:

  1. Make sure Intalio|BPMS Server is up and running fine.
  2. Make sure the Process Explorer pane does not contain any Intalio|BPMS Business Process Project with same name.

 

Process Download & Import:

  1. Download "ExpenseApproval.zip".
  2. Go to File > Import...
  3. Select 'Existing Projects into Workspace', in the wizard, click on Next >
  4. Select "Select archive file" radio button.
  5. Browse to select the downloaded archive file, click on Finish.
  6. Update project builders by right click on project; go to BPMS Designer Tools > Update BPMS Builders.

 

expenseapproval.jpg

Working Scenario in the Axis 2-1.1:

  1. To upload the “ExpenseApprovalServiceWS.aar” in the Axis2:
  2. Make sure Intalio-bpms server is already started.
  3. Open a web browser, provide url as: http://localhost:8080/axis2/.
  4. Click on the "Administration" link.
  5. Login with the following credentials:
    username: "admin" (without quotes).
    password: "axis2" (without quotes).
  6. Click on link"Upload Service" to upload.
  7. Browse to location of "ExpenseApprovalServiceWS.aar" to "Upload a AxisService Archive File” page.
  8. Now click on Available Services link and refresh the webpage
    Note: You will see the list of the available services.
  9. Verify that "ExpenseApprovalServiceWS" link is present there.
  10. Click on "ExpenseApprovalServiceWS" link it displays respective wsdl file.
    Note: This wsdl displays users Ip address in place of localhost in soap address location.If you want you can save this wsdl file on your system and use in place of the existing wsdl.

 

Configurations:

  1. Copy and Paste the “JdbcConnection.txt” file in [intalio-bpms-server-5.1.1]\bin folder.

  2. Place all the jsp files in the above folder:
    [intalio-bpms-server-5.1.1]\repository\com\intalio\bpms\axis2-services\1.1.1\axis2-services-1.1.1.war\axis2-web
    The six jsp files are:
    1.ExpenseApprovalUser.jsp
    2. ExpenseApprovalUserReceiveData.jsp
    3. SubmitExpense.jsp
    4. SubmitReceiveData.jsp
    5. ExpenseApprovalInsertUser.jsp
    6. ExpenseApprovalInsertedUserReceiveData.jsp

  3. Go to the folder:[intalio-bpms-server-5.1.1]\repository\com\intalio\bpms\axis2-services\1.1.1\axis2-services-1.1.1.war\WEB-INF\classes
    and create a new folder “wsdl” and place “Client.java” and “Client.class” in it.

  4. Close and restart the server if it’s already started so that all the configurations done can be uploaded.

  5. Copy and Pase"mysql-connector-java-3[1].1.8-bin.jar" in
    1. [Java]\jdk1.5\jre\lib\ext.
    2. [intalio-bpms-server-5.1.1]\repository\com\intalio\bpms\axis2-services\1.1.1\axis2-services-1.1.1.war\WEB-INF\lib.
    3. [intalio-bpms-server-5.1.1]\repository\com\intalio\bpms\pxe\5.1.2\pxe-5.1.2.war\WEB-INF\lib.

  6. All you need to have a table tbl_expense with seven fields (lng_expense_id,str_user,str_username,str_password,str_department,str_designation,dbl_expense) in MySQL-5.

  7. mysql> Create table tbl_expense(lng_Expense_id int,str_user varchar(20),str_username varchar(20),str_password varchar(20),str_department varchar(20),str_designation varchar(20),dbl_expense double);

  8. mysql> insert into tbl_expense values (xx,"xxxx","xxxx","xxxx","xxxx","xxxx",xxx); (please enter at least 1 rows)

  9. Close and restart the server if it’s already started so that all the configurations done can be uploaded.

 

Explanation of process and files used:

  1. Process.bpm:
    This process implements the above mentioned scenario.
    There are total of 5 pools in this process:
    1. Client pool (Non-Executable Pool): Used to start the other pools.
    2. ValidateUser pool (Executable Pool): This pool checks the authentication of the user by invoking the operations: “getSelectedQuery” and “getForwardedPage”.
    3. InsertUser(Executable Pool): This pool is used to insert a new user to the database and uses operation “insertUser”.
    4. SubmitExpense(Executable Pool): This pool is used to verify that the expense entered by user should be approved or rejected.
    5. ExpenseApprovalwsdl (Non-Executable Pool): The pool is used to define all the operations used in the process.

  2. ExpenseApprovalServiceWS.aar: This file is required to be uploaded in the axis2 i.e. in http://localhost:8080/axis2 so that the service can be deployed.

  3. ExpenseApprovalServiceWS.wsdl: This is the wsdl that will be invoked in the process.

  4. Expense.xsd and SubmitExpense.xsd: These are the schemas that define data types required.

  5. JdbcConnection.txt: This is the configuration file where we have defined the url , username, password.

 

Process Deployment & Execution:

  1. Click on Deploy Project to Intalio|BPMS Server button in tool bar.

  2. Make sure you select all runtime files while exporting to Intalio|BPMS Server.

  3. Click on Finish button.

  4. Open the browser and provide URL as:http://localhost:8080/axis2/axis2-web/ExpenseApprovalUser.jsp

  5. A form with below given input will be available:
    End Point Url
    Service Name
    UserName
    Password

  6. Provide the required information; on clicking submit you’ll get the results.

  7. Take the Endpoint Url and Service Name from the wsdl file that is generated on deploying Process.bpm i.e.: “Process-ValidateUser.wsdl” [You can get the wsdl file under build folder of your project]

  8. Give inputs as:

    End Point Url: http://localhost:8080/ode/processes/ExpenseApproval/Process/ValidateUser/Client
    Service Name: CanonicServiceForClient
    UserName: shekhar
    Password: shekhar
  9. Click the submit button. The form will be replaced by “ExpenseApprovalUserReceiveData.jsp” form where message will be displayed as: “User is valid” along with a link to forward you to Submit Expense Page

  10. If UserName or Password is incorrect then it will display as: “User is Invalid” along with link to the Main Page.

  11. Click on “Go to the Submit Expense Page” button.

  12. This will take you to “SubmitExpense.jsp” page.

  13. ‘Submit Expense.jsp’ file will display the following fields that were already entered by user and the fields that are required to be entered:
    Welcome: shekhar
    Note: Above field will display the user’s name that has logged in.
    End Point Url:
    Service Name:
    Expense:
    Note: Above fields are required to be entered by the user.

  14. Provide the required information, on clicking the submit you will get the results.

  15. Take the Endpoint Url and Service Name from the wsdl file that is generated on deploying Process.bpm i.e.: Process-SubmitExpense.wsdl”.

  16. Give input as:
    End Point Url: http://localhost:8080/ode/processes/ExpenseApproval/Process/SubmitExpense/Client
    Expense: 100

  17. Click on the “Submit” button.The form will be replaced by “SubmitReceiveData.jsp” form where the message will be displayed as: “Expense Approved”
    Note: If you give expense as :”300” i.e. value more than that present in the database, then it will display output as “ Expense Not Approved-Rejected”.

  18. If you want to enter a new user to the database, then you can also click on the link on the Main Page: “New User Signup” which will take you to the “ExpenseApprovalInsertUser.jsp” page.
    Note: To enter a new user, you can also directly go to the url:http://localhost:8080/axis2/axis2-web/ExpenseApprovalInsertUser.jsp
    Following fields that are required to be entered by the user.
    End Point Url:
    Service Name:
    User:
    UserName:
    Password:
    Department:
    Designation:
    Expense:
    Note: Above fields are required to be entered by the user. Provide the required information, on clicking the submit you will get the results.

  19. Take the Endpoint Url and Service Name from the wsdl file that is generated on deploying Process.bpm i.e: Process-InsertUser.wsdl”.
    Endpoint url will be: http://localhost:8080/ode/processes/ExpenseApproval/Process/InsertUser/Client
    Service Name: CanonicServiceForClient

  20. On clicking the submit button ‘ExpenseApprovalInsertedUserReceiveData.jsp’ file will be opened. If user and username entered is not existing or is not in the database then “User inserted successfully”message will be displayed on ‘ExpenseApprovalInsertedUserReceiveData.jsp’ file:

  21. If user and username entered already exists or is available in the database then “User already exist” message will be displayed on ‘ExpenseApprovalInsertedUserReceiveData.jsp’ file:

 

Last Updated ( Jun 16 2008 )
  < Prev Next >