uCosminexus Application Server, Application Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
The following figure shows the flow of Web Service client development using Java applications:
Figure 8-3 Flow of Web Service client development using Java applications
![[Figure]](FIGURE/ZU114000.GIF)
An overview of the individual operations is as follows:
- Creating a Java project
Create the Java project to be used for developing a Web Service client. For details, see 8.4.1(2) Creating a Java project.
- Acquiring a WSDL file
Acquire a WSDL file or acquire the URL of a released WSDL file. For details, see 8.4.1(3) Acquiring a WSDL file.
- Generating a Java source
Generate the Java source for implementing the Web Service client. For details, see 8.4.1(4) Generating a Java source.
- Implementing a Web Service client
Use the generated Java source to implement the Web Service client. For details, see 8.4.1(5) Implementing a Web Service client.
- Debugging Java applications
You debug the Java applications. For details, see 8.4.1(6) Debugging Java applications.
The following subsections describe the development of Web Service client using Java applications, according to the above flow.
Create a Java project to be used for developing a Web Service client using Java applications. To create a Java project:
- From the Eclipse menu bar, choose File - New - Project.
The New Project dialog box appears.
- Choose Java Project, and then click the Next button.
The Create a Java Project page appears.
- Specify the required items, and then click the Finish button.
A Java project is created.
Note that to use the JAX-WS engine to execute Web Services in Java applications, you must set up an external Jar in the project build path and the VM argument in the execution or debug environment of the Java applications. The setup procedure is as follows:
- Setting an external Jar in the project build path
- Select the Java project and from the right-click context menu, choose Build Path Configuration - Configure Build Path.
- On the Java Build Path page of the Properties dialog box, choose the Libraries tab.
- Click the Add External Jars button.
- Add the following external Jar:
Developer-installation-directory\jaxp\lib\csmjaxb.jar
Developer-installation-directory\jaxp\lib\csmjaxp.jar
Developer-installation-directory\jaxp\lib\csmstax.jar
Developer-installation-directory\jaxws\lib\cjjaxws.jar
Developer-installation-directory\CC\client\lib\j2ee-javax.jar
Developer-installation-directory\CC\client\lib\HiEJBClientStatic.jar
For Windows(x86) (including the WOW64 environment):
HNTRLib-installation-directory#\classes\hntrlib2j.jar
HNTRLib-installation-directory#\classes\hntrlibMj.jar
For Windows(x64):
HNTRLib2-installation-directory#\classes\hntrlib2j64.jar
HNTRLib2-installation-directory#\classes\hntrlibMj64.jar
#: In HNTRLib-installation-directory and HNTRLib2-installation-directory, specify the value of the environment variable COSMINEXUS_HNTRLIB_HOME.
- Setting the VM argument in the execution or debug configurations of Java applications
- From the Eclipse menu bar, choose Run - Run Configurations or Run - Debug Configurations.
- Double-click Java Applications.
- In the Main tab, set up the name of the Java project in Project.
- In Main class on the Main tab, set up the fully qualified name of the main class that executes the Java project.
- Choose the Arguments tab and set up the following VM argument:
-Dcosminexus.home="Developer-installation-directory"
Acquire the WSDL file that codes the meta information of the Web Services you are trying to invoke, or if the URL of the WSDL file has been released, acquire that URL.
Based on the acquired WSDL file, generate the Java source (service class, SEI, and Java Bean (stub)) required for developing and executing the Web Service client. You can generate the Java source from Eclipse. To generate a Java source:
- In the Project Explorer view, select the project to be used for developing a Web Service client.
- From the Eclipse menu bar, choose File - New - Other.
The New dialog box appears.
![[Figure]](FIGURE/ZU112100.GIF)
- Choose Cosminexus Web service - Web Service Client and click the Next button.
The Web Service Client page of the Web Service Client dialog box appears.
![[Figure]](FIGURE/ZU114100.GIF)
- Specify the following items:
Item name |
Specified value |
Project |
Select the Java project name of the workspace. |
WSDL file |
Specify the WSDL file or WSDL file URL. |
Java source folder |
Specify the folder for generating the Java source. |
When the following operations or settings are performed and the Web Service Client dialog box appears, the Java source folder selection becomes blank and the subsequent operations can no longer be performed. Therefore, specify a folder other than the project root in Java source folder.
- When Use project folder as root for sources and class files is selected in Project layout of the New Java Project dialog box for creating the Java project, if a Java project is used for Web Service client development
- When project root is set up in Source folders on build path in the Source tab on the Java Build Path page in the Properties dialog box of the project used for developing a Web Service client
Also, if the values entered in Project and Java source folder are changed, the values of the following items return to their initial states:
- If the values in Project are changed
The values of WSDL file, Java source folder, Java package, Binding file, and WSDL location return to the initial state.
- If the values in Java source folder are changed
The values of WSDL file, Java package, Binding file, and WSDL location return to the initial state.
Specify the following items as and when required:
Item name |
Specified value |
Java package |
Specify the package name of the Java source to be generated. |
Binding file |
Specify the binding file. |
WSDL location |
Specify the value to be set up in the wsdlLocation element of the javax.xml.ws.WebServiceClient annotation. |
For more details on each item, also see 14.1 cjwsimport command in the manual uCosminexus Application Server Web Service Development Guide.
- Click the Finish button.
A message, indicating that the processing is executed, appears and the Java source is generated.
- Note
- If the WSDL file and binding file of the invoked Web Service are modified and the Java source is regenerated using the Web Service Client dialog box due to the upgrading of Web Service version, make sure that a file with the name same as of the output file does not exist in the folder specified in Java source folder.
- If a service class, SEI, or Java Bean (stub) with the name same as of the output file exists, the service class, SEI, or Java Bean (stub) is overwritten.
Use the generated Java source to implement the Web Service client. For the examples of Implementing a Web Service client, see 3.6 Implementing a Web Service client in the manual uCosminexus Application Server Web Service Development Guide.
Debug the created Java applications. Specify the VM argument in the debug configuration of the Java applications and click the Debug button. For details on setting up the VM argument in the debug configuration of Java applications, see the subsection 8.4.1(2) Creating a Java project.
All Rights Reserved. Copyright (C) 2012, 2013, Hitachi, Ltd.