uCosminexus Service Platform, Basic Development Guide
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.
For details about how to send an error, see the contents of a user-defined reception in the troubleshooting during the execution of a Web Service (SOAP Communication), in the manual Cosminexus Service Platform System Setup and Operation Guide.
The error acquisition method differs depending on the type of SOAP Communication Infrastructure.
{ try { ... // Invoke Web Services ... } catch (xxxxxxxxxxException e) { ... } catch (C4Fault e) { ... } } |
{ try { ... } catch (xxxxxxxxxxException e) { ... } catch (C4Fault e) { // Acquire Fault information from C4Fault System.out.println("C4Fault Message = " + e.getMessage()); System.out.println("C4Fault FaultCode = " + e.getFaultCode()); System.out.println("C4Fault FaultActor = " + e.getFaultActor()); System.out.println("C4Fault FaultString = " + e.getFaultString()); // Acquire Detail from C4Fault Element ele[] = e.getFaultDetails(); printElement(ele); } } /** * Print Element */ private static void printElement(Element[] ele) { int eleNumber = ele.length; System.out.println("Element count = " + eleNumber); for (int i=0; i<eleNumber; i++) { // Acquire NodeList from Element array if (ele[i] != null) { printNodeList(ele[i].getChildNodes()); } else { System.out.println("Element[" + i + "] = null"); } } } /** * Print NodeList */ private static void printNodeList(NodeList nodelist) { int nodelistcount = nodelist.getLength(); for (int j=0; j<nodelistcount; j++) { Node node1 = nodelist.item(j); NodeList nodelist1 = node1.getChildNodes(); int nodelist1len = nodelist1.getLength(); if (nodelist1len == 0) { System.out.println("empty ChildNode"); } else if(nodelist1len == 1) { Node node2 = node1.getFirstChild(); if(node2 != null) { System.out.println("ChildNode[" + j + "] getTextContent = " + node2.getTextContent()); } else { System.out.println("ChildNode[" + j + "] = null"); } } else { printNodeList(nodelist1); } } } |
Table 8-19 Structure of Element[] acquired with the getFaultDetails() method
Name | Explanation |
---|---|
errorMessage | This is an error message set in the exception that occurred in the HCSC server. |
errorCode | This is an error code corresponding to the exception that occurred in the HCSC server. |
processInstanceID | Instance ID information of a business process Since this information is not set in an exception that occurred in the HCSC server, it becomes null (nil attribute). |
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.