uCosminexus Service Platform, Basic Development Guide
If an error occurs at the request-destination service component, the HCSC server, or the JAX-WS engine, acquire the error information and take corrective action according to the information.
For a service adapter that uses the JAX-WS engine for communication, the exception (CSCMsgServerFaultException_Exception in SOAP1.1 and CSCMsgServerFault1.2Exception_Exception in SOAP1.2) in which the information is wrapped will be caught. Therefore, the save fault information class must be acquired using the getFaultInfo() method.
An example of implementation at the service requester side to acquire the save fault information class when using the getFaultInfo() method to acquire an exception class, is described below.
/** * Sample Program */ { try { : // Web service invocation : } catch (CSCMsgServerFaultException_Exception e) { // An exception or user-defined exception occurs in CSC // Get the exception object defined in CSC CSCMsgServerFaultException faultInfo = e.getFaultInfo(); // Output the exception information System.err.println("errorCode=" + faultInfo.getErrorCode()); System.err.println("errorMessage=" + faultInfo.getErrorMessage()); System.err.println("processInstanceID=" + faultInfo.getProcessInstanceID()); System.err.println("faultCode=" + faultInfo.getCscmsgFaultCode()); System.err.println("faultActor=" + faultInfo.getCscmsgFaultActor()); System.err.println("faultString=" + faultInfo.getCscmsgFaultString()); System.err.println("faultName=" + faultInfo.getFaultName()); byte[] faultDetail = faultInfo.getCscmsgFaultDetail(); try { if(faultDetail != null) { System.err.println("faultDetail=" + new String(faultDetail, "UTF-8")); } } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } } catch (SOAPFaultException e) { : } } |
/** * Sample Program */ { try { : // Web Service invocation : } catch (CSCMsgServerFault12Exception_Exception e) { // An internal exception or a user-defined exception occurred in CSC // Acquire fault information object defined in CSC CSCMsgServerFault12Exception faultInfo = e.getFaultInfo(); // Output exception information System.err.println("errorCode=" + faultInfo.getErrorCode()); System.err.println("errorMessage=" + faultInfo.getErrorMessage()); System.err.println("processInstanceID=" + faultInfo.getProcessInstanceID()); CscmsgFaultCode code = faultInfo.getCscmsgFaultCode(); if (code == null) { System.err.println("Code=" + code); } else { List<String> values = code.getValues(); for(String value : values) { System.err.println("Code Value=" + value); } } CscmsgFaultReason reason = faultInfo.getCscmsgFaultReason(); if (reason == null) { System.err.println("Reason=" + reason); } else { List<CscmsgFaultReasonText> texts = reason.getCscmsgFaultReasonText(); Locale locale = Locale.getDefault(); for(CscmsgFaultReasonText text : texts) { if(locale.equals(text.getLocale())) { System.err.println("Reason=" + text.getText()); } } } System.err.println("Role=" + faultInfo.getCscmsgFaultRole()); System.err.println("Node=" + faultInfo.getCscmsgFaultNode()); System.err.println("faultName=" + faultInfo.getFaultName()); byte[] faultDetail = faultInfo.getCscmsgFaultDetail(); try { if(faultDetail != null) { System.err.println("faultDetail=" + new String(faultDetail, "UTF-8")); } } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } } catch (SOAPFaultException e) { : } } |
If an exception (SOAP Fault) occurs from the Web Service in the detail information of the SOAP envelope, SOAP Fault information and HCSC-Messaging returned by the service (in which SOAP Fault occurred) includes the set error message and error code.
If an exception is detected in HCSC-Messaging and in a service other than the Web Service, the error code and error information detected in HCSC-Messaging is included.
Each method is described as follows:
The following table shows the format of error information (SOAPFault).
Table 8-9 Format of error information (SOAPFault)
Element | Name | Contents | |
---|---|---|---|
SOAP1.1 | SOAP1.2 | ||
faultcode | Code | Fault code | Value depends on the JAX-WS engine. Output a violation code. |
faultstring | -- | Fault character string | Value depends on the JAX-WS engine. Output an error message. |
-- | Reason | Fault reason | Value depends on the JAX-WS engine. Output an error message. |
faultactor | Role | Fault creator | Value depends on the JAX-WS engine. The value does not exist. |
-- | Node | Fault node | Value depends on the JAX-WS engine. The value does not exist. |
detail#1 | Detail#2 | Fault details | Contents correspond to wsdl:fault. |
Table 8-10 Details (SOAP1.1) of error information (SOAPFault)
Field name | Description | |
---|---|---|
Error (fault) from service component, business process, custom adapter or integrated HCSC server | Error (exception) detected in HCSC server | |
errorMessage | Error contents are as follows:
|
|
errorCode | Error codes correspond to the following exception contents.
|
|
processInstanceID | Information of business process instance ID. Value is set if an error occurs in the business process. |
|
cscmsgFaultCode | FaultCode information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultString | FaultString information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultActor | FaultActor information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultDetail | Detail information from service component (Web Service), business process or custom adapter. | -- |
faultName | Fault name (exception name) information from service component (Web service or SessionBean) or business process. Value is set in the following cases:
|
-- |
Table 8-11 Details (SOAP1.2) of error information (SOAPFault)
Field name | Description | |
---|---|---|
Error (fault) from service component, business process, custom adapter or integrated HCSC server | Error (exception) detected in HCSC server | |
errorMessage | Error contents are as follows.
|
|
errorCode | Error codes correspond to the following exception contents.
|
|
processInstanceID | Information of business process instance ID. Value is set if an error occurs in the business process. |
|
cscmsgFaultCode | FaultCode information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultReason | FaultReason information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultRole | Role information from service component (Web Service), business process or custom adapter. | -- |
cscmsgFaultDetail | Detail information from service component (Web Service), business process or custom adapter. | -- |
faultName | Fault name (exception name) information from service component (Web service or SessionBean) or business process. Value is set in the following cases:
|
-- |
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.