uCosminexus Service Platform, Basic Development Guide
A service requester that uses JAX-WS engine for communication can be created as the service requester for sending requests to a user-defined reception (Web Services). The service requester that uses the JAX-WS engine for communication sends request messages to the user-defined reception (Web Services) using SOAP (document-literal type).
The following figure shows the relationship between a service requester that uses the JAX-WS engine for communication and an HCSC server:
Figure 8-34 Relationship between a service requester that uses the JAX-WS engine for communication and an HCSC server (User-defined reception (Web Services))
The procedure for creating a service requester that uses the JAX-WS engine for communication is as follows:
Figure 8-35 Procedure for creating a service requester that uses the JAX-WS engine for communication (User-defined reception (Web Services))
The tasks in the individual steps are described below.
The WSDL editing method is the same as that used for creating an ordinary service requester in SOAP communication infrastructure.
For details about how to edit WSDL, see 8.7.2 Editing a WSDL.
Create a service class from the edited WSDL. To create a service class, you use the cjwsimport command provided by Cosminexus as a development support command.
A command input example is shown below:
cjwsimport -s source-file-output-destination-directory -d compiled-class-file-output-destination-directory WSDL-file |
For details about options of the cjwsimport command, see the manual Cosminexus Application Server Web Service Development Guide.
If the WSDL file edited in 10.6.7(1) WSDL editing is saved at a location different from the current directory in which the cjwsimport command is executed, also specify the directory.
If you execute this command, the directories and files will be created in the output destination directory of the specified source file based on the contents described in the WSDL.
To invoke a method of user-defined reception (Web Services), use the created service class and generate proxy class objects.
The following describes the procedure for creating an object of the proxy class for invoking user-defined reception (Web Services) on the basis of the created service class:
By invoking a method of the generated object, a request for service component execution is sent to the user-defined reception. Within the objects of a service class, request messages (SOAP messages) are automatically generated in the format defined in the WSDL.
The response message acquisition method is the same as that used for creating an ordinary service requester in SOAP communication infrastructure.
For details about response message acquisition, see 8.7.5 Acquiring Response Messages.
If an error occurs at the request-destination service component, the HCSC server, or the SOAP engine, acquire the error information and take corrective action according to the information.
/** * Sample Program */ { try { ... } catch (xxxxxxxxxxException_Exception e) { // When the SOAP fault defined in WSDL is returned back xxxxxxxxxxException faultInfo = e.getFaultInfo(); ... } catch (SOAPFaultException e) { // When an error occurs in the HCSC server SOAPFault soapFault = e.getFault(); if(soapFault != null) { // Output the information about SOAP fault System.err.println("faultCode=" + soapFault.getFaultCode()); System.err.println("faultActor=" + soapFault.getFaultActor()); System.err.println("faultString=" + soapFault.getFaultString()); Detail detail = soapFault.getDetail(); if(detail != null) { for(Iterator ite = detail.getDetailEntries(); ite.hasNext(); ) { printDetail((Element)ite.next()); } } } } } |
Table 8-20 Structure of Element[] acquired with the getDetail() method
Name | Content |
---|---|
errorMessage | This is the error message set up in the exception. |
errorCode | This is the error code corresponding to the error message set up in an exception. |
processInstanceID | This is the process instance ID of the business process. Because the process instance ID is not set up for an error detected in the messaging infrastructure, this will become null (nil attribute). This is applicable for an error occurring in the business process. |
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.