8.3.8 Acquiring error information
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.
- #
- While executing the cjwsimport command, the exception name is given the suffix "_Exception" to avoid removing the underscore "_" (underscore) and the existence of duplicate names with the save class of fault information (FaultBean).
- Organization of this subsection
- (1) Example of implementing service requester side
- (2) Format of error information (SOAPFault)
(1) Example of implementing service requester side
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.
- In SOAP1.1
/**
* 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) {
:
}
} |
- In SOAP1.2
/**
* 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:
(a) Method of exception information maintenance class
- getErrorMessage (common for SOAP1.1 and SOAP1.2)
- Description
- Acquires the error message.
- Used for acquiring contents of the following exceptions:
- Exception detected in HCSC-Messaging
- Faults from the service component and business process
- Format
- public java.lang.String getErrorMessage()
- getErrorCode (common for SOAP1.1 and SOAP1.2)
- Description
- Acquires the error code.
- Used for acquiring error codes for contents of the following exceptions:
- Exception detected in HCSC-Messaging
- Faults from the service component and business process
- Format
- public java.lang.String getErrorCode()
- getProcessInstanceID (common for SOAP1.1 and SOAP1.2)
- Description
- Acquires the business process instance ID.
- Format
- public String getProcessInstanceID()
- getCscmsgFaultCode (for SOAP1.1)
- Description
- If communication is received from SOAP1.1, acquires FaultCode information from the service component (Web Service), business process or custom adapter.
- Format
- public java.lang.String getCscmsgFaultCode()
- getCscmsgFaultString (for SOAP1.1)
- Description
- If communication is received from SOAP1.1, acquires FaultString information from the service component (Web Service), business process or custom adapter.
- Format
- public java.lang.String getCscmsgFaultString()
- getCscmsgFaultActor (for SOAP1.1)
- Description
- If communication is received from SOAP1.1, acquires FaultActor information from the service component (Web Service), business process or custom adapter.
- Format
- public java.lang.String getCscmsgFaultActor()
- getCscmsgFaultCode (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires the CscmsgFaultCode class that maintains FaultCode or Code information from the service component (Web Service), business process or custom adapter.
- Format
- public jp.co.hitachi.soft.csc.msg.message.reception.ejb.CscmsgFaultCode getCscmsgFaultCode()
- getCscmsgFaultReason (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires the CscmsgFaultReason class that maintains Reason information from the service component (Web Service), business process or custom adapter.
- Format
- public jp.co.hitachi.soft.csc.msg.message.reception.ejb.CscmsgFaultReason getCscmsgFaultReason()
- getCscmsgFaultRole (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires Role information from the service component (Web Service), business process or custom adapter.
- Format
- public java.lang.String getCscmsgFaultRole()
- getCscmsgFaultNode (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires Node information from the service component (Web Service), business process or custom adapter.
- Format
- public java.lang.String getCscmsgFaultNode()
- getCscmsgFaultDetail (common for SOAP1.1 and SOAP1.2)
- Description
- Acquires Detail information from the service component (Web service), business process or custom adapter.
- Transfers the Detail information ser by the service component to the service requester in byte arrays. The acquired byte arrays must be converted to character strings.
- If Detail information does not exist in the service component (Web Service), business process or custom adapter, respond with a byte array of 0 bytes (blank tab of SOAP message).
- Format
- public byte[] getCscmsgFaultDetail()
- getFaultName (common for SOAP1.1 and SOAP1.2)
- Description
- Acquires exception name from the service component (Web Service) or business process.
- Format
- public String getFaultName()
(b) Method of the CscmsgFaultCode class
- getValues (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires Value information containing FaultCode or Code information from the service component (Web Service), business process or custom adapter.
- Format
- public java.util.List<java.lang.String> getValues()
(c) Method of the CscmsgFaultReason class
- getTexts (for SOAP1.2)
- Description
- If communication is received from SOAP1.2, acquires Text information containing Reason information from the service component (Web Service), business process or custom adapter.
- Format
- public java.util.List<java.lang.String> getTexts()
(2) Format of error information (SOAPFault)
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. |
- Legend: Not applicable
- #1
- The detail element shows details of error information. Table10-10 shows the structural system in which it is saved.
- #2
- The detail element shows details of error information. Table10-11 shows the structural system in which it is saved.
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:
- Error detected in HCSC server
- Error from service component, business process and custom adapter
|
errorCode | Error codes correspond to the following exception contents.
- Error detected in HCSC server
- Error from service component, business process and custom adapter
|
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:
- SOAP Fault of user-defined exception from service component (Web Service or SessionBean)
- Fault from business process
In the SOAP Fault operation definition file, value is not set in case of SOAP Fault from Web Service defining targetNamespace URI. For details about the SOAP Fault operation definition file, see Cosminexus Service Platform Reference. | -- |
- Legend: Not applicable.
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.
- Error detected in HCSC server
- Error from service component, business process and custom adapter
|
errorCode | Error codes correspond to the following exception contents.
- Error detected in HCSC server
- Error from service component, business process and custom adapter
|
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:
- SOAP Fault of user-defined exception from service component (Web Service or SessionBean)
- Fault from business process
In the SOAP Fault operation definition file, value is not set in case of SOAP Fault from Web Service defining targetNamespace URI. For details about the SOAP Fault operation definition file, see Cosminexus Service Platform Reference. | -- |
- Legend: Not applicable.