Example: Employees Job - Calling External Web Service
Example: Employees Job - Calling External Web Service
This is an example of Job calling the EmployeeService WebService (exposed by an external system).
It downloads employees information from an abstract ERP system (such as SAP, Oracle) into the Archibus Employees (em) table. It imports all records, mapping fields to Employee Name, Employee Number, Employee Standard, Employee Telephone, Email Address, Division Code, and Department Code fields.
This job will be typically invoked as a scheduled rule.
Configuration
The configuration files for the remoting configuration are in
/WEB-INF/config/context/remoting/examples/webservices-cxf/
folder. To use this example, configure WebCentral according to instructions in the
readme.txt
, located in this folder. This configuration includes both
remoting
(Web Services support) and
rendering
(Web Central and Smart Client forms and reports support).
Limitations
The current implementation of
CostService
does not use any authentication/security. For production deployment, you need to configure WebService to use security, which is appropriate for your deployment (for example, WS-Security: http://en.wikipedia.org/wiki/WS-Security).
Procedure
The implementation is located in the
/schema/ab-products/solutions/common/src/main/com/archibus/webservice/employee/
folder. The Job is implemented by the
EmployeesJob
Java class.
The
EmployeesJob
bean and supporting beans are defined in
/applications/examples/applications-child-context.xml
.
To demonstrate this example in Eclipse:
-
Activate the
EmployeesJob
rule. In Web Central, use this view: System / Add-In Manager / Define Workflow Rules .
SelectEmployeesJob
, change the value of Active? to Yes, and click on the Save button -
Copy bean definitions from /WEB-INF/config/context/applications/examples/applications-child-context.xml file to applications/applications-child-context.xml file.
-
Follow the instructions in
/WEB-INF/config/context/remoting/examples/webservices-cxf/readme.txt
to configure Webservices – CXF. - Obtain from Archibus Technical Support the ServerExample project. Import it into Eclipse.
-
In Eclipse, invoke “Jetty-ServerExample”. The ServerExample Jetty server will be running on port 8081. It exposes
EmployeeService WebService
with method
Employee[] getEmployees(String divisionId, String departmentId)
which returns an array with three employees.
- Run Web Central.
-
Use the
/schema/ab-products/solutions/common/ab-ex-webservice.axvw
view. Click on the “Import All Employees” button. The
archibus.log
file should contain several messages “Saving employee <…>”.