uCosminexus Service Platform, Reception and Adapter Definition Guide

[Contents][Glossary][Index][Back][Next]

Appendix B.1 APIs of the custom adapter development framework

This section describes the custom adapter development framework APIs provided by Service Platform.

The interfaces and exception classes defined in the custom adapter development framework are stored in the following location:

 
Service-Platform-installation-directory\CSC\lib\csc_adapter.jar
 

When compiling a General custom adapter, include this JAR file in the classpath.

Organization of this subsection
(1) Protocol converter interfaces
(2) Adapter context interface
(3) Message interfaces
(4) Exception classes

(1) Protocol converter interfaces

(a) CSCMsgCustomProtocolConverter interface

Description
This interface is used to implement the protocol converter.
The package name of the CSCMsgCustomProtocolConverter interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.

Format
 
public interface CSCMsgCustomProtocolConverter
{
  public void start()
          throws CSCMsgCustomAdapterException;
  public void stop();
  public void setCustomAdapterContext(CSCMsgCustomAdapterContext adapterContext);
  public void invoke(CSCMsgRequestMessage requestMessage, 
                     CSCMsgResponseMessage responseMessage)
          throws CSCMsgCustomAdapterException;
}
 

Methods
The following table lists the methods provided by the CSCMsgCustomProtocolConverter interface:
Method name Description
start method This method is invoked when the General custom adapter is started. This method implements start processing for the protocol converter.
This method is invoked only once.
stop method This method is invoked when the General custom adapter ends. This method implements end processing for the protocol converter.
This method is invoked only once.
setCustomAdapterContext method This method is invoked when the adapter context is set. This method describes the processing for storing the allocated adapter context in an instance field of the protocol converter.
This method is invoked only once.
invoke method This method is invoked when invoking a service component via the General custom adapter. This method describes the processing for invoking a service component.
This method is invoked each time there is a request to invoke the service adapter.
The following figure shows the order in which each of these methods is invoked from the custom adapter development framework.

Figure B-1 Order of method invocation from the custom adapter development framework

[Figure]
1. Constructor
When the General custom adapter starts, the protocol converter is instantiated by the default constructor invoked from the custom adapter development framework.
2. setCustomAdapterContext method
The setCustomAdapterContext method is invoked from the custom adapter development framework immediately after the protocol converter class is instantiated. This method is invoked only once when the General custom adapter starts. Ensure that you maintain the adapter context received as an argument in an instance field of the protocol converter.
3. start method
The start method is invoked from the custom adapter development framework immediately after the setServiceAdapterInfo method. This method is invoked only once when the General custom adapter starts.
4. invoke method
The invoke method is invoked from the custom adapter development framework during processing to invoke a service component. This method is used to perform protocol conversion and service invocation processing.
5. stop method
The stop method is invoked from the custom adapter development framework immediately before the General custom adapter is deleted from the HCSC server. This method performs end processing for the General custom adapter. This method is invoked only once when the General custom adapter ends.

Notes
  • Public default constructor
    The custom adapter development framework uses the default constructor to instantiate the classes that implement this interface. For this reason, you must implement a public default constructor in classes that implement this interface.
  • Multi-threading
    Because the protocol converter is shared by multiple General custom adapter instances, you must implement a thread safe class.
  • Throwing exceptions
    The methods of the CSCMsgCustomProtocolConverter class can only throw specific exceptions. Do not have the methods throw java.lang.RuntimeException or classes that derive from it. If a method throws such an exception, normal operation is not guaranteed.

[Figure] start method
Description
This method is invoked when the General custom adapter is started.
We recommend that you use this method to secure the resources that will be used throughout the life cycle of the General custom adapter.
Format
 
public void start()
  throws CSCMsgCustomAdapterException;
 
Parameters
None.
Exceptions
jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgCustomAdapterException
Generated when execution of the start method fails.
Return values
None.

[Figure] stop method
Description
This method is invoked when the General custom adapter ends. It describes the end processing for the General custom adapter.
Format
 
public void stop();
 
Parameters
None.
Exceptions
None.
Return values
None.

[Figure] setCustomAdapterContext method
Description
This method is invoked when the adapter context is set.
The start method is always invoked after this method.
The adapter context interface obtained by this method must be maintained throughout the lifecycle of the General custom adapter.
Format
 
public void setCustomAdapterContext(CSCMsgCustomAdapterContext adapterContext);
 
Parameters
adapterContext
Passes the CSCMsgCustomAdapterContext reference.
Exceptions
None.
Return values
None.

[Figure] invoke method
Description
This method is invoked when invoking a service component via the General custom adapter. This method describes the processing for invoking a service component.
The invoke method invokes the service component based on the request message stored in the requestMessage parameter.
If the communication model is synchronous, the response message is stored in the responseMessage parameter.
If the communication model is asynchronous, null is passed for responseMessage.
Format
 
public void invoke (CSCMsgRequestMessage requestMessage, 
                    CSCMsgResponseMessage responseMessage)
  throws CSCMsgCustomAdapterException;
 
Parameters
  • requestMessage
    The CSCMsgRequestMessage reference that stores the request message is passed.
  • responseMessage
    If the communication model is synchronous, the CSCMsgResponseMessage reference that stores the response message is passed. If the communication model is asynchronous, null is passed.
Exceptions
jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgCustomAdapterException
Generated when execution of the invoke method fails.
Return values
None.

(2) Adapter context interface

(a) CSCMsgCustomAdapterContext interface

Description
This interface is used by the protocol converter to acquire adapter information. The package name of the CSCMsgCustomAdapterContext interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.
The adapter context interface is input as an argument of the setCustomAdapterContext method immediately before processing to start the General custom adapter. The protocol converter maintains this argument as an instance field and acquires the required information.

Format
 
public interface CSCMsgCustomAdapterContext
{
  public String getAdapterName();
  public Properties getProperties();
  public byte[] getResourceAsBytes(String fileName)
    throws CSCMsgResourceAccessException;
  public java.io.InputStream getResourceAsStream(String fileName)
    throws CSCMsgResourceAccessException;
}
 

Methods
The following table lists the methods provided by the CSCMsgCustomAdapterContext interface:
Method name Description
getAdapterName method Acquires the name of the General custom adapter.
getProperties method Acquires the contents of the custom adapter property file as Properties.
getResourceAsBytes method Acquires the contents of the resource file in binary format.
getResourceAsStream method Acquires the stream for accessing the resource file.

[Figure] getAdapterName method
Description
This method acquires the name of the General custom adapter.
Format
 
public String getAdapterName();
 
Parameters
None.
Exceptions
None.
Return values
Returns the name of the General custom adapter.

[Figure] getProperties method
Description
This method acquires the contents of the custom adapter property file as Properties.
Format
 
public Properties getProperties();
 
Parameters
None.
Exceptions
None.
Return values
Returns the contents of the property file.

[Figure] getResourceAsBytes method
Description
This method acquires the contents of the resource file in binary format.
Format
 
public byte[] getResourceAsBytes(String fileName)
  throws CSCMsgResourceAccessException;
 
Parameters
fileName
Specifies the file name of the resource to be accessed.
Exceptions
CSCMsgResourceAccessException
The resource specified by the fileName parameter is not found, or java.io.IOException was generated.
Return values
Returns the contents of the resource file in binary format.

[Figure] getResourceAsStream method
Description
This method acquires the stream for accessing the resource file.
Format
 
public java.io.InputStream getResourceAsStream(String fileName)
  throws CSCMsgResourceAccessException;
 
Parameters
fileName
Specifies the file name of the resource to be accessed.
Exceptions
CSCMsgResourceAccessException
The resource specified by the fileName parameter is not found, or java.io.IOException was generated.
Return values
Returns the contents of the resource file in stream format.
Notes
Do not allocate a stream returned by this method to a static field. Doing so might cause a memory leak.

(3) Message interfaces

The following table lists the interfaces used to exchange messages between the HCSC server and protocol converter:

Table B-1 List of APIs used to work with messages

Interface name Description
CSCMsgMessageConstant interface Defines the constants required to work with messages.
CSCMsgRequestMessage interface Provides the methods that acquire the information (such as operation names and messages) required to invoke service components.
CSCMsgResponseMessage interface Provides the methods that store the results of service component invocation (messages or fault information).
(a) CSCMsgMessageConstant interface

Description
This interface defines the constants required by the protocol converter to work with messages. The package name of the CSCMsgMessageConstant interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.
The protocol converter uses these constants to check the type of message stored as the request message or response message.

Format
 
public interface CSCMsgMessageConstant
{
  public static final int MESSAGE_TYPE_NONE;
  public static final int MESSAGE_TYPE_XML;
  public static final int MESSAGE_TYPE_BINARY;
  public static final int MESSAGE_TYPE_ANY;
}
 

Member attributes
MESSAGE_TYPE_NONE:
Indicates that no message is stored.
MESSAGE_TYPE_XML:
Indicates that the message is in XML format (DOM format).
MESSAGE_TYPE_BINARY:
Indicates that the message is in binary format.
MESSAGE_TYPE_ANY:
Indicates that the message is in an arbitrary format.

(b) CSCMsgRequestMessage interface

Description
This interface provides the methods that acquire the information required to invoke service components (such as operation names and messages).
The package name of the CSCMsgRequestMessage interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.

Format
 
public interface CSCMsgRequestMessage
{
  public byte[] getBytes() 
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgInvalidMessageException;
  public Map getMessageContext();
  public int getMessageType();
  public String getOperationName();
  public org.w3c.dom.Document getXMLDocument() 
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgInvalidMessageException;
  public byte[] getXMLBytes() 
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgInvalidMessageException;
}
 

Methods
The following table lists the methods provided by the CSCMsgRequestMessage interface:
Method name Description
getBytes method Acquires messages in binary format.
getMessageContext method When a General custom adapter is invoked via a business process, this method returns information related to the business process.
getMessageType method Acquires the type of message stored as the request message.
getOperationName method Acquires the name of the operation invoked when invoking the service component.
getXMLDocument method Acquires messages in XML format.
getXMLBytes method Acquires XML messages as a byte array.

[Figure] getBytes method
Description
This method acquires messages in binary format.
Format
 
public byte[] getBytes() 
  throws CSCMsgIllegalMessageTypeException,
         CSCMsgInvalidMessageException;
 
Parameters
None.
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The message format is not binary. Alternatively, a message is already stored. You cannot use this method to acquire messages that are in XML format.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The stored message is invalid.
Return values
This method returns the response as a byte array if the specified message type is binary (MESSAGE_TYPE_BINARY).
If no message is stored (MESSAGE_TYPE_NONE), the method returns a 0 byte array (an array of length 0).
Notes
  • You can modify the binary messages (byte arrays) acquired by this method without causing any issues.
  • A copy of the object is created when you execute this method. Executing the method again will cause the object to be re-acquired in its original form.

[Figure] getMessageContext method
Description
When a General custom adapter is invoked via a business process, this method returns information related to the business process.
It returns information in the java.util.Map format.
The Map returned by the getMessageContext method is the object returned by the Collections#unmodifiableMap() method.
It cannot be modified.
Because the Map is not a synchronized object, it needs to be exclusively locked when shared among multiple threads.
When the getMessageContext method is invoked without going through a business process, the Map it returns contains the information from the HCSC server name to the J2EE server name in the table below.

Table B-2 Information acquired by getMessageContext method

Information type Map contents Description
Element Value
Element name Element type Value type
Business process name CSCMsgCustomAdapterConstant.ContextType.BP_DEFINITION_NAME enum java.lang.String The name of the business process from which the General custom adapter is invoked#1
Business process version CSCMsgCustomAdapterConstant.ContextType.BP_VERSION enum java.lang.String The version of the business process from which the General custom adapter is invoked#1
Invoke service activity name CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_NAME enum java.lang.String The name of the invoke service activity of the business process from which the General custom adapter is invoked#1
Service name of General custom adapter CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_CUSTOMADAPTERNAME enum java.lang.String The service name of the General custom adapter invoked from the invoke service activity#1
Operation name CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_OPERATIONNAME enum java.lang.String Operation name of invoke service activity#1, #2
Process instance ID CSCMsgCustomAdapterConstant.ContextType.BP_PROCESSINSTANCEID enum java.lang.String Process instance ID#1
HCSC server name CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_HCSC enum java.lang.String HCSC server name
Cluster name CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_CLUSTER enum java.lang.String Cluster name
J2EE server name CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_J2EE enum java.lang.String J2EE server name

#1
This element returns information about the business process that directly invokes the General custom adapter.
If a business process (BP1) invokes another business process (BP2) which then invokes the General custom adapter, the method will not acquire information about BP1.

#2
If multiple operations are defined in the General custom adapter invoked from the invoke service activity, the method only acquires the name of the operation invoked in the request processing.

Format
 
public Map getMessageContext();
 
Parameters
None.
Exceptions
None.
Return values
java.util.Map

[Figure] getMessageType method
Description
This method acquires the type of message stored as the request message.
Format
 
public int getMessageType();
 
Parameters
None.
Exceptions
None.
Return values
This method returns the type of message stored as the request message. For details on the return values, see B.1(3)(a) CSCMsgMessageConstant interface. Note that if you created a General custom adapter for an arbitrary message format, MESSAGE_TYPE_ANY is returned regardless of the message type.

[Figure] getOperationName method
Description
This method acquires the name of the operation invoked when invoking the service component.
Format
 
public String getOperationName();
 
Parameters
None.
Exceptions
None.
Return values
This method returns the name of the invoked operation.

[Figure] getXMLDocument method
Description
Acquires messages in XML format.
Format
 
public org.w3c.dom.Document getXMLDocument() 
  throws CSCMsgIllegalMessageTypeException,
         CSCMsgInvalidMessageException;
 
Parameters
None.
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The message format is not XML. Alternatively, a message is already stored. You cannot use this method to acquire messages that are in binary format.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The stored message is invalid.
Return values
This method returns a response as an object in DOM format if the assigned message type is XML (MESSAGE_TYPE_XML).
If no message is stored (MESSAGE_TYPE_NONE), the method returns null.
Notes
  • You can modify the XML messages (DOM) acquired by this method without causing any issues.
  • A copy of the object is created when you execute this method. Executing the method again will cause the original object to be re-acquired.
  • If you created a General custom adapter for an arbitrary message format, executing this method generates an error (KDEC03016-E) and messages cannot be acquired. In this scenario, use the getBytes method instead.

[Figure] getXMLBytes method
Description
This method acquires XML messages as a byte array.
When using StAX or other tools to read messages, you can reduce memory usage by using this method.
Format
 
public byte[] getXMLBytes() 
  throws CSCMsgIllegalMessageTypeException,
         CSCMsgInvalidMessageException;
 
Parameters
None.
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The message format is not XML.
    You cannot use this method to acquire messages that are in binary format.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The stored message is invalid.
Return values
This method returns a response as an object in byte array format if the assigned message is in XML format (MESSAGE_TYPE_XML).
If no message is stored (MESSAGE_TYPE_NONE), the method returns null.
Notes
  • You can modify the XML messages (byte arrays) acquired by this method without causing any issues.
  • A copy of the object is created when you execute this method. Executing the method again will cause the original object to be re-acquired.
  • Note the following when using the StAX XML processor to read XML messages:
    - An exception occurs if a message in XML version 1.1 is set.
    - An exception occurs if you use ISO-10646-UCS-4 encoding.
    - The inclusion of element names starting with colons (:) in the XML document does not cause an exception.
    - The presence of a single CDATA end token (]]>) in the character data of the XML document does not cause an exception.
    - For empty elements, only the opening and closing tags are output.
    Example: <sample></sample>

(c) CSCMsgResponseMessage interface

Description
This interface provides the methods that store the results of service component invocation (messages or fault information) in response messages.
The package name of the CSCMsgResponseMessage interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.

Format
 
public interface CSCMsgResponseMessage
{
  public int getMessageType();
  public void setBytes(byte[] message)
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgMultipleMessageInsertionException,
                 CSCMsgInvalidMessageException;
  public void setFault(String faultCode, 
                       String faultString,
                       String faultActor, 
                       byte[] faultDetail)
          throws CSCMsgMultipleMessageInsertionException;
  public void setFault(String faultCode, 
                       String faultString,
                       String faultActor, 
                       org.w3c.dom.Document faultDetail)
          throws CSCMsgMultipleMessageInsertionException,
                 CSCMsgInvalidMessageException;
  public void setXMLDocument(org.w3c.dom.Document dom)
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgMultipleMessageInsertionException,
                 CSCMsgInvalidMessageException;
  public void setXMLBytes(byte[] byte)
          throws CSCMsgIllegalMessageTypeException,
                 CSCMsgMultipleMessageInsertionException,
                 CSCMsgInvalidMessageException;
}
 

Methods
The following table lists the methods provided by the CSCMsgResponseMessage interface:
Method name Description
getMessageType method Acquires the type of message to be stored in the response message.
setBytes method Stores binary format messages in response messages.
setFault method (format 1) Stores fault information generated at service component invocation in response messages.
setFault method (format 2) Stores fault information generated at service component invocation in response messages.
setXMLDocument method Stores XML format messages in response messages.
setXMLBytes method Stores XML messages in response messages in binary array format.

[Figure] getMessageType method
Description
This method acquires the type of message to be stored in the response message.
Format
 
public int getMessageType();
 
Parameters
None.
Exceptions
None.
Return values
This method returns the type of message to be stored in the response message. Note that if you create a General custom adapter for messages in an arbitrary format, MESSAGE_TYPE_ANY is returned regardless of the message type.
  • MESSAGE_TYPE_NONE:
    No message is to be stored.
  • MESSAGE_TYPE_XML:
    The message is to be stored in XML format.
  • MESSAGE_TYPE_BINARY:
    The message is to be stored in binary format.

[Figure] setBytes method
Description
This method stores a binary message in the response message.
Format
 
public void setBytes(byte[] message)
        throws CSCMsgIllegalMessageTypeException,
               CSCMsgMultipleMessageInsertionException,
               CSCMsgInvalidMessageException;
 
Parameters
message
Specifies a binary format message.
If the method stores a binary message, the message type is set to binary format (MESSAGE_TYPE_BINARY). If the method stores a byte array with a length of 0 or null, the message type is set to the type indicating that no message is stored (MESSAGE_TYPE_NONE).
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The format of the set message is not binary. Alternatively, a message is already stored. If the message stored in the request message is in XML format, you cannot use binary as the format of the response message.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgMultipleMessageInsertionException
    A message or fault information is already set.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The specified binary format contains an error.
Return values
None.
Notes
If you created a General custom adapter for messages in an arbitrary format, use this method regardless of the message format. This method sets the type of the stored message to any type (MESSAGE_TYPE_ANY). The message type is set to any type (MESSAGE_TYPE_ANY) even if the message is a byte array of 0 bytes or null.

[Figure] setFault method (format 1)
Description
This method stores fault information generated when a service component is invoked.
Use this method to store the contents of faultDetail in binary format.
Because there will be no response message, the message type indicating that no message is stored (MESSAGE_TYPE_NONE) is set.
Format
 
public void setFault(String faultCode, 
                     String faultString,
                     String faultActor, 
                     byte[] faultDetail)
        throws CSCMsgMultipleMessageInsertionException;
 
Parameters
  • faultCode
    Specifies faultCode information.
    If null is specified, Server.ServiceExecutionError is stored.
  • faultString
    Specifies faultString information.
    If null is specified, Service Execution Error at CustomAdapter is stored.
  • faultActor
    Specifies faultActor information.
    If null is specified, the service ID set in HCSC-Definer is stored.
  • faultDetail
    Specifies detail information in XML format as a byte array.
    If a byte array with a length of 0 is specified, the byte array of 0 bytes is stored as is. If null is specified, null is stored as is.
Exceptions
jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgMultipleMessageInsertionException
A response message or fault information is already stored.
Return values
None.
Notes
  • faultDetail is the XML document converted to binary format. It must begin with an XML declaration. If this declaration is missing, an error will not occur but the method might not work correctly.
  • If you intend to convert the XML document to a byte array, use UTF-8 as the encoding. If you specify any other encoding, the method might not work correctly.

[Figure] setFault method (format 2)
Description
This method stores fault information generated when a service component is invoked.
Use this method to store the contents of faultDetail in XML format (DOM format).
Because there will be no response message, the message type indicating that no message is stored (MESSAGE_TYPE_NONE) is set.
Format
 
public void setFault(String faultCode, 
                     String faultString,
                     String faultActor, 
                     org.w3c.dom.Document faultDetail)
        throws CSCMsgMultipleMessageInsertionException,
               CSCMsgInvalidMessageException;
 
Parameters
  • faultCode
    Specifies faultCode information.
    If null is specified, Server.ServiceExecutionError is stored.
  • faultString
    Specifies faultString information.
    If null is specified, Service Execution Error at CustomAdapter is stored.
  • faultActor
    Specifies faultActor information.
    If null is specified, the service ID set in HCSC-Definer is stored.
  • faultDetail
    Specifies detail information in DOM format.
    If null is specified, null is stored as-is.
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgMultipleMessageInsertionException
    A response message or fault information is already stored.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The specified DOM format contains an error.
Return values
None.

[Figure] setXMLDocument method
Description
This method stores an XML format message (DOM format) in the response message.
Format
 
public void setXMLDocument(org.w3c.dom.Document dom)
        throws CSCMsgIllegalMessageTypeException,
               CSCMsgMultipleMessageInsertionException,
               CSCMsgInvalidMessageException;
 
Parameters
dom
Specifies a message in DOM format.
If the stored message is in XML format, the message type is set to XML format (MESSAGE_TYPE_XML). If null is stored, the message type is set to the type that indicates no message is stored (MESSAGE_TYPE_NONE).
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The format of the set message is not XML. Alternatively, a message is already stored. If the message stored in the request message is an XML message, you cannot change the format of the response message to binary.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgMultipleMessageInsertionException
    A message or fault information is already set.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The specified DOM format contains an error.
Return values
None.
Notes
If you created a General custom adapter for an arbitrary message format, executing this method generates an error (KDEC03016-E) and messages cannot be stored. In this scenario, use the setBytes method instead.

[Figure] setXMLBytes method
Description
This method stores XML format messages (binary array) in response messages.
If the General custom adapter handles XML format messages as byte arrays, the need to convert the messages to DOM format is eliminated. In this case, you can reduce memory usage by using the setXMLBytes method.
Format
 
public void setXMLBytes(byte[] byte)
        throws CSCMsgIllegalMessageTypeException,
               CSCMsgMultipleMessageInsertionException,
               CSCMsgInvalidMessageException;
 
Parameters
byte
Specifies a byte array format message.
Note that if byte is not null, the message type is set to XML (MESSAGE_TYPE_XML). If byte is null, the message type is set to the type indicating that no message is stored (MESSAGE_TYPE_NONE).
Exceptions
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgIllegalMessageTypeException
    The format of the request message is not XML. If the request message type is binary, you cannot change the type of the response message to XML.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgMultipleMessageInsertionException
    A message or fault information is already set.
  • jp.co.Hitachi.soft.csc.msg.adapter.custom.CSCMsgInvalidMessageException
    The specified XML format contains an error.
Return values
None.
Notes
  • Note the following when using StAX to create messages:
    - An exception occurs if a message in XML version 1.1 is set.
    - An exception occurs if you use ISO-10646-UCS-4 encoding.
    - The inclusion of element names starting with colons (:) in the XML document does not cause an exception.
    - The presence of a single CDATA end token (]]>) in the character data of the XML document does not cause an exception.
    - For empty elements, only the opening and closing tags are output.
    Example: <sample></sample>
(d) CSCMsgCustomAdapterConstant class

Description
This interface defines the Map keys that can store the business process information acquired by the getMessageContext method of the CSCMsgRequestMessage interface.
The package name of the CSCMsgCustomAdapterConstant interface is jp.co.Hitachi.soft.csc.msg.adapter.custom.

Format
 
public interface CSCMsgCustomAdapterConstant {
  public enum ContextType {
           BP_DEFINITION_NAME,
           BP_VERSION,
           BP_INVOKEACTIVITY_NAME,
           BP_INVOKEACTIVITY_CUSTOMADAPTERNAME,
           BP_INVOKEACTIVITY_OPERATIONNAME,
           BP_PROCESSINSTANCEID,
           SERVERNAME_HCSC,
           SERVERNAME_CLUSTER,
           SERVERNAME_J2EE;
  }
}
 

Enum constants
BP_DEFINITION_NAME:
The name of the business process from which the General custom adapter was invoked
BP_VERSION:
The version of the business process from which the General custom adapter was invoked
BP_INVOKEACTIVITY_NAME:
The name of the invoke service activity of the business process from which the General custom adapter was invoked
BP_INVOKEACTIVITY_CUSTOMADAPTERNAME:
The service name of the General custom adapter invoked from the invoke service activity
BP_INVOKEACTIVITY_OPERATIONNAME:
The operation name of the invoke service activity
BP_PROCESSINSTANCEID:
The process instance ID
SERVERNAME_HCSC:
The HCSC server name
SERVERNAME_CLUSTER:
The cluster name
SERVERNAME_J2EE:
The J2EE server name

(4) Exception classes

The following table lists the exception classes generated during protocol converter development:

Table B-3 List of protocol converter exception classes

Class name Description
CSCMsgCustomAdapterException class The exception thrown when an exception occurs during processing to initialize the General custom adapter or invoke the service component
CSCMsgIllegalMessageTypeException class The exception thrown when a method is invoked whose message format differs from the message type being acquired or stored
CSCMsgMultipleMessageInsertionException class The exception thrown when a message or fault information is already stored.
You cannot set a message or fault information if this information has already been stored.
CSCMsgInvalidMessageException class The exception thrown when the type (format) of a stored request message is invalid.
It is also thrown when an invalid message type is specified for the response message.
CSCMsgResourceAccessException class The exception thrown when an error occurs during resource access.
This exception occurs in the following situations:
  • The resource you attempted to acquire does not exist
  • An I/O exception (java.io.IOException) occurred