Class MessageHeader

java.lang.Object
com.highdeal.hci.MessageHeader
All Implemented Interfaces:
XMLMarshallable

public class MessageHeader extends Object implements XMLMarshallable
This Java class represents the header of a message sent via HCI sent by your client application to a connected SAP CC Core Server system; It includes information about the message originator and specifies the processing mode (TRANSACTION_ALL) of the operation requests that are included in the sent message body.

The message header MessageHeader contains:

  • A message originator, that is who (or what) sends the message, and the mean to authenticate it.
  • A transaction mode (all, first fail, most, or try), that describes how the service operations contained in the body should be executed by the connected SAP CC system. This processing mode is very important and changes the behavior of the connected SAP CC system.

Important Note

Make sure you specify the transaction mode that is relevant with your business requirements.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="header">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="originator" minOccurs="0" maxOccurs="1"/>
     </xs:sequence>
     <xs:attribute name="transaction" type="TransactionBehaviorType" default="all"/>
   </xs:complexType>
 </xs:element>

 <xs:simpleType name="TransactionBehaviorType">
   <xs:restriction base="xs:string">
     <xs:enumeration value="all"/>
     <xs:enumeration value="firstFail"/>
     <xs:enumeration value="most"/>
     <xs:enumeration value="try"/>
   </xs:restriction>
 </xs:simpleType>

  • Field Details

    • TRANSACTION_ALL

      public static final MessageHeader.TransactionMode TRANSACTION_ALL
      In this transaction mode, all or none of the operations are executed by the SAP CC system.
    • TRANSACTION_FIRST_FAIL

      public static final MessageHeader.TransactionMode TRANSACTION_FIRST_FAIL
      In this transaction mode, all operations are executed until the first that fails.
    • TRANSACTION_MOST

      public static final MessageHeader.TransactionMode TRANSACTION_MOST
      In this transaction mode, the operations are executed even if some of them failed.
    • TRANSACTION_TRY

      public static final MessageHeader.TransactionMode TRANSACTION_TRY
      In this transaction model, no operation is executed, they are only tried.
  • Constructor Details

    • MessageHeader

      public MessageHeader()
  • Method Details

    • getTransactionMode

      public MessageHeader.TransactionMode getTransactionMode()
      Returns the processing mode of the operation requests included in the message body.
      Returns:
      The transaction mode specified in this header
    • setTransactionMode

      public void setTransactionMode(MessageHeader.TransactionMode mode)
      Sets the processing mode of the operation requests included in the message body; The connected SAP CC system receives the message and manages the requests depending on this execution mode.

      The available operation processing modes are:

      • all, that means that all the operations should be executed, or none if one of them fails,
      • firstFail, that means that the operations are executed until one of them fails,
      • most, that means that all the operations that can be done should be done,
      • try, that means that all the operations are not done, but only attempted.
      Parameters:
      mode - The execution mode for the operation requests
      See Also:
    • getOriginator

      public MessageOriginator getOriginator()
      Returns the originator of this header.
      Returns:
      The originator of this message
    • setOriginator

      public void setOriginator(MessageOriginator o)
      Sets the originator (your client application) for this message.
      Parameters:
      o - The originator of this message
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Sets the attributes of the XML representation of the tag being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current tag
    • addChild

      public void addChild(String tagName, XMLMarshallable child)
      Adds a child to the objects, the child represents the marshallable object to be added into the content tree.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      tagName - The name of tag for the child
      child - The child to be added
    • addCharacterData

      public void addCharacterData(String cData)
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • marshal

      public void marshal(XMLOutputter output)
      Gives an XML representation of this object, and of its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshal the object into
    • toString

      public final String toString()
      Overrides:
      toString in class Object