The following figure shows the flow of the development starting from the WSDL:
Figure 2-2 Development of Web Services starting from the WSDL
- Creating a WSDL file
You can create a WSDL file either manually or with commands.
- Creating manually
As the meta data of Web Services, create a WSDL file according to the WSDL 1.1 specifications, XML Schema specifications, and WS-I Basic Profile 1.1. For receiving messages of SOAP 1.1, code extension elements of the SOAP 1.1 specifications and for receiving messages of SOAP 1.2, code extension elements of the SOAP 1.2 specifications.
For the support range of the WSDL 1.1 specifications, see 20.1 Support range of the WSDL 1.1 specifications.
- Generating with commands
We recommend the generation of a WSDL using commands, when a user is accustomed of developing with Java language rather than with syntaxes of a WSDL and XML Schema.
After temporarily creating or compiling a Web Service Implementation Class, specify the -wsdl option and execute the WSDL generation functionality of the cjwsgen command to generate a WSDL file. Change the generated WSDL, as and when required. Use the generated Web Service Implementation Class only for entering the cjwsgen command. Therefore, you need not execute any method.
For receiving the messages of the SOAP 1.2 specifications, specify http://www.w3.org/2003/05/soap/bindings/HTTP/ in the javax.xml.ws.BindingType annotation while creating the Web Service Implementation Class.
After generating the WSDL, delete the Web Service Implementation Class that is not required anymore.
- Executing the cjwsimport command (Generating Java sources)
Execute the cjwsimport command to generate Java sources such as SEI, skeleton of the Web Service Implementation Class, and JavaBeans class (stubs) that are required for developing and executing Web Services, from the created WSDL file. Specify the -generateService option and execute the cjwsimport command. For the cjwsimport command, see 14.1 cjwsimport command.
- Implementing Web Services
Using the stubs generated in step 2, code the required processing in the skeleton of the Web Service Implementation Class and implement the Web Services. Also, compile the implemented Web Service Implementation Class. Note that the javax.xml.ws.BindingType annotation is automatically added according to the contents of the WSDL.
- Creating a DD
Create web.xml and application.xml. Code the Web Service-specific information in web.xml. For creating web.xml, see 3.4 Creating web.xml.
- Creating an EAR file
Create an EAR file containing the created file. For creating EAR files, see 3.5.3 Creating EAR files.
- Deploying and starting the EAR file
Deploy the created EAR file and start the file as a J2EE application (Web Service). For details on the import and start commands of J2EE applications, see cjimportapp (Importing J2EE applications) and cjstartapp (Starting J2EE applications) in the uCosminexus Application Server Command Reference Guide.
For the method to deploy (import) J2EE applications by using the management portal, see 12.3.3 Importing J2EE applications in the uCosminexus Application Server Management Portal User Guide.
For the method to start J2EE applications by using the management portal, see 12.3.1 Starting the J2EE applications in the uCosminexus Application Server Management Portal User Guide.
For examples in which the development of Web Services starts from the WSDL, see the following sections:
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.