Anda di halaman 1dari 10

05/04/2011 JAX-WS: Get Workers Tutorial

JAX-WS: Get Workers Tutorial


This tutorial walks through creating a Java web service client application using JAX-WS which invokes the
Workday v10 Human_Resources.Get_Workers() operation. For this tutorial, we will use the open source Eclipse
Java Development Environment with JDK 6.

1. Download and install the Java SE Developer Kit 1.6 (JDK 6)

http://java.sun.com/javase/downloads > JDK

2. Download and install the Eclipse IDE for Java Developers (Galileo)
http://www.eclipse.org/downloads > Eclipse IDE for Java Developers

3. Start Eclipse...
Navigate to the directory where you installed Eclipse and double-click on "eclipse.exe"
Select a workspace in the Workspace Launcher
Enter the workspace name where you want to save your projects in and click "OK"

4. Navigate to the Eclipse "Workbench" by clicking on the "Go to the Workbench" arrow.

5. Create a new "Java Project" in Eclipse


File > New > Java Project

community.workday.com/book/…/6403 1/10
05/04/2011 JAX-WS: Get Workers Tutorial

Enter the details for the project...


Project name: v10GetWorkersExample
Create new project in workspace
Use default JRE (currently, 'jre1.6')
Create separate folders for source and class files

Click "Finish"

community.workday.com/book/…/6403 2/10
05/04/2011 JAX-WS: Get Workers Tutorial
6. Generate your JAX-WS client artifacts (client code generation for your WWS)
1. Use the "wsimport" utility that was installed within your JDK to generate the JAX-WS WWS client
code artifacts
Navigate to "Run > External Tools > External Tools Configurations..."

Right-click on "Program" and click "New"


Name = wsimport for WWS Example
Location = {your JDK path}\bin\wsimport.exe
Working Directory = ${workspace_loc:/v10GetWorkersExample}
Arguments = https://partners-
cc.workday.com/ccx/service/developer/Human_Resources/v10?wsdl -s src -d bin -p
com.workday.human_resources -verbose

Click on "Apply", then "Run"


When the process is finished (you will see "<terminated>" in your Console windows at
the bottom of your Eclipse IDE), right-click on your project and select "Refresh" (or
press F5). You will now see that tour "src" folder contain the generated JAX-
WS classes for the WWS.

7. Create a "com.workday.demo" Java Package


1. Right-click on the "src" folder in your project and select "New > Package"
community.workday.com/book/…/6403 3/10
05/04/2011 1. Right-click on the "src" folderJAX-WS: Get Workers
in your project Tutorial"New > Package"
and select

2. Select the "File System" icon under the General tab and click "Next"

3. Enter "com.workday.demo" as the name for the package and click "Finish".

community.workday.com/book/…/6403 4/10
05/04/2011 JAX-WS: Get Workers Tutorial

8. Import the WorkdayCredentials.java Java Class that will be used to add the WS-Security header to your
WWS requests
Download WorkdayCredentials.java to your desktop
Right-click on the "com.workday.demo" package in your "src" folder and select "Import"

community.workday.com/book/…/6403 5/10
05/04/2011 JAX-WS: Get Workers Tutorial

Select the "File System" icon under the "General" tab and click "Next"

Enter the location where you downloaded the WorkdayCredentials.java file in the "From Directory",
select the file, and click "Finish"

community.workday.com/book/…/6403 6/10
05/04/2011 JAX-WS: Get Workers Tutorial

9. Import the GetWorkers.java Java Class that will be used to invoke the Get_Workers WWS operation
Download GetWorkers.java to your desktop
Right-click on the "com.workday.demo" package in your "src" folder and select "Import"

community.workday.com/book/…/6403 7/10
05/04/2011 JAX-WS: Get Workers Tutorial

Select the "File System" icon under the "General" tab and click "Next"

Enter the location where you downloaded the GetWorkers.java file in the "From Directory", select
the file, and click "Finish"

community.workday.com/book/…/6403 8/10
05/04/2011 JAX-WS: Get Workers Tutorial

10. Run your GetWorkers client code


Click on the "Run" icon in the Eclipse toolbar

That's it... You should see the output of the employee names in the "Console" window

community.workday.com/book/…/6403 9/10
05/04/2011 JAX-WS: Get Workers Tutorial

community.workday.com/book/…/6403 10/10