ENSTO-E Energy Communication Platform ECP Public Interface ENTSO-E Energy Communication Platform ECP Public Interface Un ic or n S ys t em s © 2 0 09- 2 0 13 U n ic o rn S ys t e m s a.s . J ank o vc o va 10 3 7/ 4 9, Pr ah a 7 , CZ - 17 0 0 0 Title: ENTSO-E Energy Communication Platform ECP Public Interface Author: Version: Date: Michal Ráček, Petr Sochůrek, Jiří Neuman, Jiří Dudek, Luboš Světik 3.0.1 02/08/2013 Contact: E-mail: info@unicornsystems.eu Tel.: (+420) 221 400 111 ENTSO-E Energy Communication Platform ECP Public Interface 1. CONTENTS 1. 2. 3. 4. Contents .............................................................................................................3 Abstract ..............................................................................................................5 Revisions History ................................................................................................6 Overview ............................................................................................................7 4.1. Messaging API ................................................................................................7 4.1.1. Send Message ...........................................................................................7 4.1.2. Receive Message ......................................................................................7 4.1.3. Confirm Receive Message .........................................................................7 4.1.4. Check Message Status ..............................................................................7 4.1.5. Connectivity Test .......................................................................................8 4.2. Monitoring API ................................................................................................8 4.3. Plugins ...........................................................................................................8 4.3.1. Receive Handlers ......................................................................................8 4.3.2. Send Handlers ...........................................................................................9 5. Logical Messaging API Description ................................................................... 10 5.1. Send Message .............................................................................................. 10 5.1.1. Input/Output Description .......................................................................... 11 5.2. Receive Message .......................................................................................... 12 5.2.1. Input/Output Description .......................................................................... 13 5.3. Confirm Receive Message ............................................................................. 14 5.3.1. Input/Output Description .......................................................................... 15 5.4. Check Message Status .................................................................................. 15 5.4.1. Input/Output Description .......................................................................... 16 5.5. Connectivity Test .......................................................................................... 18 5.5.1. Input/Output Description .......................................................................... 19 5.5.2. Usage of the Connectivity Test Operation ................................................. 19 6. Web Services ................................................................................................... 21 6.1. Implementation of the Logical API ................................................................. 21 6.2. Webmethods description ............................................................................... 21 6.2.1. Webmethod SendMessage ....................................................................... 21 6.2.2. Webmethod ReceiveMessage .................................................................. 22 6.2.3. Webmethod ConfirmReceiveMessage ...................................................... 23 6.2.4. Webmethod CheckMessageStatus ........................................................... 24 6.2.5. Webmethod ConnectivityTest ................................................................... 25 6.3. Error Handling .............................................................................................. 26 7. File System Shared Folder (FSSF) .................................................................... 27 7.1. File Naming Conventions .............................................................................. 27 7.2. Folders ......................................................................................................... 28 7.3. Message Send-Receive Scenario .................................................................. 29 8. Java API ........................................................................................................... 31 8.1. Key Concepts ............................................................................................... 31 8.1.1. Messaging API Invocation ........................................................................ 31 8.1.2. Implementation of the Logical API ............................................................ 32 8.1.3. Error Handling ......................................................................................... 32 8.2. Description of Java methods ........................................................................... 32 8.2.1. Java sendMessage Method ...................................................................... 32 8.2.2. Java receiveMessage Method .................................................................. 33 8.2.3. Java confirmReceiveMessage Method ...................................................... 34 8.2.4. Java checkMessageStatus Method ........................................................... 35 8.2.5. Java connectivityTest Method .................................................................. 36 8.3. Plugins ......................................................................................................... 37 8.3.1. Receive Event Handler ............................................................................ 38 8.3.2. Send Event Handler ................................................................................. 39 9. Web Service Monitoring API.............................................................................. 41 -3- ENTSO-E Energy Communication Platform ECP Public Interface 9.1. Web Methods Description .............................................................................. 41 9.1.1. Webmethod getModuleStatusInfo ............................................................. 41 10. Configuration of Channels and Message Receivers ........................................... 45 11. ECP Integration Library..................................................................................... 46 12. References ....................................................................................................... 47 Attachment A – W ebservice Public API WSDL .............................................................. 48 Attachment B – Monitoring Public API WSDL ................................................................ 49 Attachment C – Public API Javadoc ............................................................................. 50 -4- ENTSO-E Energy Communication Platform ECP Public Interface 2. ABSTRACT This document describes the public API of the ECP endpoint through which business applications can integrate with ECP and use it for sending and receiving messages. The document covers all basic ECP messaging functions and describes in detail the nuances of all three technological channels – Web Service API, Java API and file system shared folder (FSSF). In addition, more advanced functionalities are presented, including the ECP health monitoring API and the ECP extension API, including the send handlers and the receive handlers. >5< ENTSO-E Energy Communication Platform ECP Public Interface 3. REVISION HISTORY Version Date Author Description 1.00 02/07/2009 Stanislav Mikulecký Final Revision 1.5 16/02/2009 Jiří Neuman Changes for ECP 1.5 2.1 03/02/2011 Jiří Dudek Changes for ECP 2.1 3.0 04/07/2013 3.0.1 02/08/2013 Petr Zdráhal RTE remarks 3.0.2 27/08/2013 Unicorn English revision Luboš Světik, Petr Changes for ECP 3.0 Zdráhal >6< ENTSO-E Energy Communication Platform ECP Public Interface 4. OVERVIEW The public interface of ECP can be divided into two groups according to the purpose of provided methods. > Messaging API – provides the key functions of ECP, which are sending and receiving messages, checking message delivery status and connectivity tests. ECP provides these functions via several channels. > Monitoring API – provides support functions which report information about the current internal state of the deployed ECP module. > Plugins – the behaviour of ECP can be expanded by specific plugins that can modify how messages are sent and received. 4.1. Messaging API Messaging API contains the core functions of ECP. They ensure the secure and reliable transportation of messages from one ECP endpoint to another. 4.1.1. Send Message This function accepts a business message to send via ECP to another endpoint. The message is first validated and, if successful, accepted for transportation over ECP. After acceptance, ECP is responsible for the delivery of the message. As a result, a unique message ID is returned. This message ID can be used for further checks on the message delivery status. 4.1.2. Receive Message This method receives a message which was delivered to the ECP endpoint. The method returns the message to the caller business application. The message is not marked as delivered until the application confirms the reception using the "Confirm Receive Message" method. 4.1.3. Confirm Receive Message This method confirms to ECP that it correctly received a message. The method marks the message as received within ECP. At this point, ECP considers the message successfully transported. 4.1.4. Check Message Status This method checks the status of a message (specified by a message ID), allowing the sender of the message to check whether the message reached its destination, whether there was an error during transportation or whether the message is waiting in some intermediate ECP component between the sender and the receiver endpoints. >7< ENTSO-E Energy Communication Platform ECP Public Interface 4.1.5. Connectivity Test To check the connectivity with another ECP endpoint, a tracing message can be sent using the connectivity test method. This method sends a tracing message and returns the message ID assigned by ECP. To verify that the tracing message reached the receiver, the sender should check its status. Note that the connectivity test is meant to be used only for checking the connectivity from one ECP endpoint to another. You can think of the connectivity test as a "trace route" utility. You send a tracing message and its path is available using the Check message status method. Note: to check the connectivity between a business application and an ECP Endpoint, refer to the Monitoring API description below. 4.2. Monitoring API The monitoring interface can be used to check the health of a deployed ECP module. A business application can use the Monitoring API to verify that the ECP Endpoint to which it is connected is running and in a good shape. The ECP administrator is able to discover various errors, including a broken database connection, incorrectly deployed components or problems with the delivery of messages (stuck messages). Monitoring functions are currently available only via Web Service. 4.3. Plugins An ECP plugin is a class implementing a specific interface packed in JAR and put into a specific directory located in the deployed ECP module. ECP currently supports the two types of plugins described in the following paragraphs. The configuration of plugins is described in [AdminGuide]. 4.3.1. Receive Handlers A receive handler is a plugin which is notified by ECP whenever a message of a given type is delivered to the endpoint in which the plugin is registered. When the receive handler is notified about a new message, it decides what to do with the message. In a typical implementation, the handler receives the message and passes it to a business application via Web service. An example of a receive handler is included in [ECPExamples] in the Java project named ECP_WS_RECEIVE_HANDLER_EXAMPLE. This sample receive handler shows how to process an event about an incoming message (this event is notified to the receive handler by ECP). When the event is processed, the handler calls the method callWS (ReceivedMessage ecpMessage) that the Endpoint owner can modify to pass the message to a business application using a webservice call. >8< ENTSO-E Energy Communication Platform ECP Public Interface 4.3.2. Send Handlers A send handler is used for processing messages immediately after their status is changed to DELIVERED, RECEIVED or FAILED. SendEventHandler is a custom Java class which is registered at the ECP endpoint. This class exposes one method called by ECP endpoint immediately after the status of a message of a given type changes. Note that ECP only notifies the handler about that message and it is up to the handler implementation as to how to process this notification. Typically, the send handler notifies a business application about the state change of a message it has sent, so that the application knows whether the message was or was not correctly received by the recipient. An example of a send handler is included in [ECPExamples] in the Java project named SAMPLES_SENDHANDLER. This sample send handler logs all events it receives into the log file in the temporary directory. >9< ENTSO-E Energy Communication Platform ECP Public Interface 5. LOGICAL MESSAGING API DESCRIPTION This chapter describes the parameters and results of the messaging API methods. Its aims to provide an overview of the messaging API, which is the same for all channels. The principle is the following: 1. A message is sent by a business application using the Send Message operation. 2. The message is transported through the ECP network to the receiver. 3. The message is received by a business application using the Receive Message operation. 4. Message reception is confirmed by the receiving business application and the message is marked as received. 5. The status of the message can be observed by the sending business application with the Check Message Status operation at any time. 1:Send Message 3:Receive Message 2:Transport Check Message Status Sender Endpoint 5.1. 4:Confirm Message Receive Receiver Endpoint Send Message This operation accepts and sends a business message to another endpoint. The message is validated and, if the validation passes, the message is accepted for transportation over ECP. After the message has been accepted, ECP is responsible for the delivery of the message. As a result of this method call, a unique message ID is returned. This message ID identifies the sent message and can be used to check the state of the message delivery at any further time. This operation prevents double sending. The application should provide a conversation ID which must be unique for each message. In the case a conversation ID is reused and that the message was already sent, ECP does not send it again and returns the message ID back to the application.. > 10 < ENTSO-E Energy Communication Platform ECP Public Interface Sent Message Conversation ID Input Output Message ID Error Send Message Error code Error ID Error message Error details Receiver code 5.1.1. Input/Output Description Input parameters: Parameter Type Description Sent Message SentMessage Metadata and payload of message. Required True The ID which identifies this conversation. If send message is called twice with the same Conversation ID String Conversation ID, it returns the same result. It is False used to prevent double messages in the case of sender application error. SentMessage object: Parameter Type Receiver Code String Description Required Recipient’s endpoint code. True Regexp pattern: [A-Za-z0-9-@]+ Message business type. Business Type String True Regexp pattern: [A-Za-z0-9-]+ Message ID assigned by BA (optional). BA Message ID string False Regexp pattern: [A-Za-z0-9-]* Code or description of sender’s BA (optional). Sender Application string False Regexp pattern: [A-Za-z0-9-]* Message payload (required). Content content True The type is different in all channels. > 11 < ENTSO-E Energy Communication Platform ECP Public Interface Response: Parameter Type Message ID string Required Description Unique message ID that ECP automatically True assigned to sent message. Error: Parameter Type Error code string Description Required The code representing the type of error (e.g. validation error, unexpected error, etc.). True Unique identification of the failure. The Error ID Error ID string shall always be used to track the error in the True application logs. Error message string Error details string Receiver code string 5.2. An error message usually describing the reason of failure. Additional error details. True False Code of the receiver to which the message was addressed. False Receive Message This operation receives a message delivered to the ECP endpoint. The method returns the message (if any) to the business application. The ECP message status is not changed to "delivered" until the "Confirm receive" method is called by the business application. This prevents the loss of messages in the case of a business application or network error. Input Output Receive Message Error Business type Receive content flag Error code Error ID Error message Error details Business type > 12 < Received message Waiting messages count ENTSO-E Energy Communication Platform ECP Public Interface 5.2.1. Input/Output Description Input parameters: Parameter Type Required Description The type of message to be received. When message type is not set, the first message Business type String waiting for download will be received, regardless of its type. True Regexp pattern: [A-Za-z0-9-]* The flag indicating whether the content of the message should also be downloaded. Receive content boolean > true – complete message is returned True > false – only metadata of message are returned (without content) Response : Parameter Type Description Required Metadata and payload of message. Received message ReceivedMess age Can be null if there are no messages to be False received. Waiting messages count Number of remaining messages of the business number type that was specified as the input parameter True of ReceiveMessage method. ReceivedMessage object: Parameter Type Description Required Message ID string Unique message ID. True Receiver Code string Endpoint code of the message’s receiver . True Sender Code string Endpoint code of message's sender. True Business Type string Message business type. True BA Message ID string Message ID assigned by BA. False Sender Application string Core or description of sender’s BA. False Message payload (required). It can be null if Content content the “Receive content” flag is set to false. The type is different in all channels. > 13 < False ENTSO-E Energy Communication Platform ECP Public Interface Error: Parameter Type Error code string Description Required The code representing the type of error (e.g. validation error, unexpected error, etc.). True Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the True application logs. Error message usually describing the failure Error message string Error details string Additional error details. False Business type string Business type used as a parameter. False 5.3. reason. True Confirm Receive Message A business application uses this operation to confirm to ECP that a message has been correctly received. The ECP message state is then changed to "received". At this very moment, ECP considers the message successfully transported. Output Input Confirm Receive Message Error Message ID Error code Error ID Error message Error details Message ID > 14 < ENTSO-E Energy Communication Platform ECP Public Interface 5.3.1. Input/Output Description Input parameters: Parameter Type Description Required Unique message ID. Message ID string True Regexp pattern: [A-Za-z0-9-]+ Response: No response. Error: Parameter Type Error code string Description The code representing the type of error (e.g. validation error, unexpected error, etc.). Required True Unique identification of the failure. The Error ID Error ID string shall always be used to track the error in the True application logs. Error message usually describing the failure Error message string Error details string Additional error details. False Message ID string ID of message which should be confirmed. False 5.4. reason. True Check Message Status This operation returns the state of the message (specified by message ID). This method allows the sender of the message to check whether the message reached its destination, whether there was an error during transportation or if the message is waiting in some intermediate ECP component. > 15 < ENTSO-E Energy Communication Platform ECP Public Interface Message ID Output Input Message status Error Check Message Status Error code Error ID Error message Error details Message ID 5.4.1. Input/Output Description Input parameters: Parameter Type Required Description Unique message ID. Message ID string True Regexp pattern: [A-Za-z0-9-]+ Response: Required Parameter Type Description Message status MessageStatus Metadata processing status. False MessageStatus object: Parameter Type Description Message ID string Unique message ID. True State MessageState State of the message. True Receiver Code string Endpoint code of the message’s receiver . True Sender Code string Endpoint code of the message's sender. True Business Type string Message business type. True BA Message ID string Message ID assigned by BA (optional). False Sender Application string Code or description of a sender’s BA (optional). False Send timestamp timestamp Exact date and time the message was sent. True Receive timestamp timestamp Exact date and time the message was received. False List Trace of MessageTraceI tem. Detailed information Required about course through ECP network. > 16 < the message's False ENTSO-E Energy Communication Platform ECP Public Interface MessageTraceItem object: Parameter Type Description Timestamp timestamp Exact date and time of the event. True State of message processing. True State Component Component description Details MessageTrace State string string string Required The code of ECP messaging component on which the event occurred. Human-understandable description of the messaging component. Details about the event. True True False MessageState enumeration: Name VERIFYING ACCEPTED Description The message is waiting for receiver verification due to connectivity problems between the messaging component and Directory Service. The message has been accepted by the ECP component and stored in the messagebox. The message has been successfully passed to another ECP component. At DELIVERING the moment, this ECP component has not yet obtained further information about message delivery to the endpoint of the recipient. DELIVERED The message has been delivered to the targe t endpoint. RECEIVED The message has been received by the target business application or user. FAILED The processing of the message failed. MessageTraceState enumeration: Name VERIFYING ACCEPTED Description The message is waiting for receiver verification due to connectivity problems between the messaging component and Directory Service. The message has been accepted by the ECP component and stored in the messagebox. TRANSPORTED The message has been successfully passed to another ECP component. DELIVERED The message has been delivered to the target endpoint. RECEIVED The message has been received by the target business application or user. FAILED The processing of the message failed. Error: Parameter Type Error code string Description The code representing the type of the error (e.g. validation error, unexpected error , etc.). > 17 < Required True ENTSO-E Energy Communication Platform ECP Public Interface Parameter Type Description Required Unique identification of the failure. The Error ID Error ID string shall always be used to track the error in the True application logs. Error message usually describing the failure Error message string Error details string Additional error details. False Message ID string ID of message whose state should be returned. False 5.5. reason. True Connectivity Test To check connectivity with another ECP endpoint, a tracing message can be sent using the connectivity test method. This method sends a tracing message and returns the message ID assigned by ECP. The tracing message is delivered to the receiver endpoint, but is never passed to a receiver’s business application. To verify that the tracing message reached the receiver endpoint, the sender can check the delivery status of the message using the "Check Message Status" method. Input Output Connectivity Test Error Receiver code Error code Error ID Error message Error details Receiver code > 18 < Message ID ENTSO-E Energy Communication Platform ECP Public Interface 5.5.1. Input/Output Description Input parameters: Parameter Type Required Description Endpoint code of the receiver. Receiver code string False Regexp pattern: [A-Za-z0-9-@]+ Response: Parameter Type Message ID string Required Description The unique message ID that ECP automatically assigned to sent message. True Error : Parameter Type Error code string Error ID string Description Required The code representing the error type (e.g. validation error, unexpected error, etc.). True Unique identification of the failure. The Error ID shall always be used to track the error in the True application logs. Error message string Error details string Receiver code 5.5.2. string Error message usually describing the reason of failure. Additional error details. Code of receiver to True False which was addressed. message False Usage of the Connectivity Test Operation 1. Call the Connectivity Test method, which sends a tracing message to the endpoint specified by the Receiver code parameter. 2. The response of the method contains the ECP message ID assigned to the tracing message. Remember this message ID. 3. To verify connectivity with the receiver, call the Check Message Status method with the message ID of the tracing message as a parameter. 4. If the message state is DELIVERED,the tracing message reached the receiver and the connectivity test is successful. > 19 < ENTSO-E Energy Communication Platform ECP Public Interface 5. If the message is not DELIVERED after the first call of the Check Message Status operation, call it repeatedly. Also, check the message trace to find out which ECP components the message has passed through. 6. If the message state contains the value FAILED or if the message state does not change to DELIVERED after a while and the message trace does not contain new values, the connection may be broken: the connectivity test was is not successful. > 20 < ENTSO-E Energy Communication Platform ECP Public Interface 6. WEB SERVICES Messaging functions are provided by the ECPEnpointService webservice (for WSDL, see Attachment A). When the ECP application is running, the WSDL is available at the URL http(s)://<server IP address>:<port>/ECP_MODULE/services/ECPEndpointService?wsdl . Depending on the configuration of the ECP endpoint, the webservice is available via HTTP or HTTPS protocol. 6.1. Implementation of the Logical API The web service channel provides access to all methods of messaging API. This chapter describes the key concepts of the implementation: > Input parameters are wrapped into the request objects. > Results are wrapped into the response objects. > Error description is transferred as Detail part of SOAP fault. These types are described in the following webmethod description. 6.2. Webmethods description 6.2.1. Webmethod SendMessage This webmethod provides the Send Message operation described in Chapter 5.1 – Send Message. A detailed description of webmethod types and their attributes may be found in Attachment A – Webservice Public API WSDL. The input/output wrapping types: Logical type Wrapping type Input SendMessageRequest SendMessageResponse Response Fault Fault Detail SendMessageFault SendMessageError > 21 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of webmethod: SendMessageRequest SendMessageResponse SentMessage sentMessage string conversationID Input Output string messageID Error SendMessage SendMessageError SentMessage SendMessageFault string receiverCode string businessType base64Binary content string senderApplication string baMessageID 6.2.2. SentMessageErrorDetail string errorCode string errorID string errorMessage string errorDetails string receiverCode Webmethod ReceiveMessage This webmethod provides the Receive Message operation described in Chapter 0 – Error: Parameter Type Error code string Error ID string Description The code representing the type of error (e.g. validation error, unexpected error, etc.). Required True Unique identification of the failure. The Error ID shall always be used to track the error in the True application logs. Error message string Error details string Receiver code string An error message usually describing the reason of failure. Additional error details. Code of the receiver to which the message was addressed. True False False Receive Message. A detailed description of the webmethod types and their attributes may be found in Attachment A – Webservice Public API WSDL. The input/output wrapping types: Logical type Wrapping type Input ReceiveMessageRequest ReceiveMessageResponse ReceiveMessageFault Response Fault > 22 < ENTSO-E Energy Communication Platform ECP Public Interface Logical type Wrapping type Fault Detail ReceiveMessageError > 23 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of webmethod: ReceiveMessageRequest ReceiveMessageResponse string businessType boolean downloadMessage Input Output ReceivedMessage message long remainingMessagesCount Error ReceiveMessage ReceivedMessage ReceiveMessageError string errorCode string errorID string errorMessage string errorDetails string businessType 6.2.3. ReceiveMessageFault ReceiveMessageError Detail string messageID string receiverCode string senderCode string businessType base64Binary content string senderApplication string baMessageID Webmethod ConfirmReceiveMessage This webmethod provides the Confirm Receive Message operation described in Chapter 5.3 – Confirm Receive Message. A detailed description of the webmethod types and their attributes may be found in Attachment A – Webservice Public API WSDL. The input/output wrapping types: Logical type Wrapping type Input Fault ConfirmReceiveMessageRequest ConfrimReceiveMessageResponse ConfirmReceiveMessageFault Fault Detail ConfirmReceiveMessageError Response > 24 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of webmethod: ConfirmReceiveMessageRequest ConfirmReceiveMessageResponse Input string messageID Output string messageID Error ConfirmReceiveMessage ConfirmReceiveMessageFault ConfirmReceiveMessageError Detail ConfirmReceiveMessageError string errorCode string errorID string errorMessage string errorDetails string messageID 6.2.4. Webmethod CheckMessageStatus This webmethod provides the Check Message Status operation described in Chapter 5.4 – Check Message . A detailed description of the webmethod types and their attributes may be found in Attachment A – Webservice Public API WSDL. The input/output wrapping types: Logical type Wrapping type Input CheckMessageStatusRequest CheckMessageStatusResponse CheckMessageStatusFault CheckMessageStatusError Response Fault Fault Detail > 25 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of webmethod: CheckMessageStatusRequest CheckMessageStatusResponse Input string messageID Output MessageInformation messageInformation Error CheckMessageStatus CheckMessageStatusError string errorCode string errorID string errorMessage string errorDetails string messageID CheckMessageStatusFault CheckMessageStatusError Detail MessageState MessageStatus string messageID MessageState state string receiverCode string senderCode string businessType string senderApplication string baMessageID dateTime sendTimestamp dateTime recieveTimestamp MessageTrace trace VERIFYING ACCEPTED DELIVERING DELIVERED RECEIVED FAILED MessageTrace MessageTraceItem[] trace MessageTraceState VERIFYING ACCEPTED TRANSPORTED DELIVERED RECEIVED FAILED 6.2.5. MessageTraceItem dateTime timestamp MessageTraceState state string component string componentDescription string details Webmethod ConnectivityTest This webmethod provides the Connectivity Test operation described in Chapter 5.5 – Connectivity Test. A detailed description of the webmethod types and their attributes may be found in Attachment A – Webservice Public API WSDL. The input/output wrapping types: Logical type Wrapping type Input Fault ConnectivityTestRequest ConnectivityTestResponse ConnectivityTestFault Fault Detail ConnectivityTestError Response > 26 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of webmethod : ConnectivityTestRequest string receiverCode ConnectivityTestResponse Input Output string messageID Error ConnectivityTest ConnectivityTestError ConnectivityTestFault SentMessageError Detail 6.3. string errorCode string errorID string errorMessage string errorDetails string receiverCode Error Handling Errors which occur on the server-side of web service (e.g. input data validation errors, unexpected errors, etc.) are reported back to the client using the standard SOAP Fault mechanism (http://www.w3.org/TR/soap12-part1/#soapfault). The ECP specific information about the error is transported using the Detail part of the SOAP Fault element. The fault and detail types are described in each webmethod description. > 27 < ENTSO-E Energy Communication Platform ECP Public Interface 7. FILE SYSTEM SHARED FOLDER (FSSF) The FSSF is an interface between ECP and the business applications that use files. The folders where the exchange occurs should be accessed by ECP as local files. This interface allows a BA to send messages via an OUT folder, and received messages are filed via an IN folder. In addition, the ECP endpoint can be configured to create one-per-sent-message log files (stored into the OUT_LOG folder). If a message cannot be sent (due to a validation problem or an internal error), ECP moves it from the OUT folder to the OUT_ERROR folder. Note that the FSSF channel only provides a subset of the messaging API operations and possibilities. The following operations are supported: > Send message – without the support of the conversation ID > Receive message – the "confirm message receive" operation is implicit. The message stated is changed to "received" immediately after the message is written in the IN folder. Refer to [AdminGuide] for detailed information about FSSF configuration. 7.1. File Naming Conventions There are four types of files used in the FSSF channel. Each file type is written into a separate folder and the file name is made of several parts separated by an underscore (underscores must exist even if optional parts are empty): file to send (OUT): <SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.EXT failed file (OUT_ERROR): <SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.EXT received file (IN): <SENDERAPP>_<SENDER>_<TYPE>_<BAMessageID>_<ECPMessageID>.EXT log file (OUT_LOG): <SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.log File name part <SENDERAPP> Type Optional Description Identifier of application of sender, for informational purposes only (supplied by sender BA). Regexp pattern: [A-Za-z0-9-]* Code of endpoint of recipient (supplied by sender BA) . <RECEIVER> Mandatory Regexp pattern: [A-Za-z0-9-@]+ Code of endpoint of sender. <SENDER> Mandatory Regexp pattern: [A-Za-z0-9-@]+ > 28 < ENTSO-E Energy Communication Platform ECP Public Interface File name part Type Description Type of message (supplied by sender BA). <TYPE> Mandatory Regexp pattern: [A-Za-z0-9-]+ <BAMessageID> Optional The unique message identifier assigned by BA. It is recommended that GUID be used to avoid uniqueness conflicts in the OUT folder. Regexp pattern: [A-Za-z0-9-]* <ECPMessageID> Mandatory The unique GUID identifier assigned by ECP to identify the message. Its uniqueness ensures avoiding uniqueness conflicts in the IN folder. Regexp pattern: [A-Za-z0-9-]+ File extension (supplied by BA). ECP ignores files with a TMP <EXT> Optional extension (both uppercase and lowercase). Regexp pattern: [A-Za-z0-9-]* Notes > The content of each part of the filename can only contain alphanumeric characters and hyphens without accents, spaces and special characters. > ECP rejects a file - when the filename does not follow the format defined above; - when the filename length exceeds 255 characters; - when the file is empty. ECP ignores files whose extension contains TMP (either all uppercase or all lowercase). 7.2. Folders The Interface is formed by the following shared file system folders: > OUT - contains: the message files to be sent via ECP; the file content can be arbitrary (XML, binary). - usage: a BA puts message files into the folder; ECP picks them up and removes them > OUT_ERROR - contains: the message files that were not sent by ECP (either rejected or some error occurred during their processing). > 29 < ENTSO-E Energy Communication Platform ECP Public Interface - usage: the files in this folder can be corrected manually and sent again. > OUT_LOG - contains: the message log files. - The logged message events are: accepted, refused, delivering, delivered, received, failed (the latter can only happen for a message that has been accepted by ECP). - usage: ECP continuously logs the message-related events in log files. When the message is accepted the message ID is also logged; a BA can read the message log file at anytime. - by configuration it is possible to create one file per message or one file per day. > IN - contains: the received message files, the content of which can be arbitrary. - folder structure: subfolder for each message type or group of messages types. - usage: ECP writes the received message files into the folder, BA picks up the message files (the BA is responsible for remove message files from the IN folder). 7.3. Message Send-Receive Scenario ECP BA1 (Sender) OUT IN/TYPE BA2 (Receiver) OUT_LOG Message send-receive scenario (with sender’s endpoint configured to use one-per-message log): 1. The Sender BA puts the message file “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.EXT” into the OUT folder. 2. The ECP picks up the message file “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.EXT” from the OUT folder. 3. The ECP creates the log file “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.log” into the OUT_LOG folder and writes the “message accepted” record into it. 4. The ECP transports the message file through the ECP network and continuously logs message-related events in the “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.log” file. > 30 < ENTSO-E Energy Communication Platform ECP Public Interface 5. On the recipient side, the ECP stores the message into the “<SENDERAPP>_<SENDER>_<TYPE>_<BAMessageID>_<ECPMessageID>.EXT” file into the IN folder and then writes “message received” record into the “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.log” file on sender’s side. 6. The Receiving BA picks up the message file “<SENDERAPP>_<SENDER>_<TYPE>_<BAMessageID>_<ECPMessageID>.EXT” from the IN folder. > 31 < ENTSO-E Energy Communication Platform ECP Public Interface 8. JAVA API This API can be used by business applications running on the same application server (within the same virtual machine) as the ECP endpoint which the business application wants to connect to. The ECP functions are accessed eu.entso_e.ecp.v1.endpoint. via classes and packages located in package The key components are: Component Description ECPFacadeProvider Contains a static method providing ECPMessaging. ECPMessaging The interface represents a facade providing access to the messaging functions of the ECP Module. 8.1. 8.1.1. Key Concepts Messaging API Invocation The operation of the messaging API can be invoked in following way: 1. Get ECPMessaging component using the ECPFacadeProvider component. 2. Invoke messaging operation. > 32 < ENTSO-E Energy Communication Platform ECP Public Interface 8.1.2. Implementation of the Logical API The Java channel provides access to all methods of messaging API. This chapter describes the key concepts of the implementation. > Input parameters are not wrapped into the request object as in the web service channel – they are common parameters of Java methods. > Error description is transferred using standard checked Java exceptions. > Content is transferred using streams. There is only interface MessageContent which provides access to content stream. If the application is sending a message, it has to provide its own implementation of this interface. This is required because: - ECP content can be up to 50 Mb. Holding all data in memory is not recommended. - Every application can use its own message content storage and hence it is not possible to provide default implementation. 8.1.3. Error Handling Every messaging operation provides its own exception and contains all the information described in Chapter 5 – Logical Messaging API Description. The mapping is as follows: Method Description getErrorCode() getErrrorID() Provides error code. getMessage() getCause() Provides error message. Provides details of the error. 8.2. 8.2.1. Provides unique error ID. Description of Java Methods Java sendMessage Method This method provides the Send Message operation described in Chapter 5.1 – Send Message. A detailed description of the method types and their attributes may be found in Attachment C – Public API Javadoc. > 33 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of operation: 8.2.2. Java receiveMessage Method This method provides the Receive Message operation described in Chapter 0 – Error: Parameter Type Error code string Description The code representing the type of error (e.g. validation error, unexpected error, etc.). Required True Unique identification of the failure. The Error ID Error ID string shall always be used to track the error in the True application logs. Error message string Error details string Receiver code string An error message usually describing the reason of failure. Additional error details. Code of the receiver to which the message was addressed. > 34 < True False False ENTSO-E Energy Communication Platform ECP Public Interface Receive Message. A detailed description of the method types and their attributes may be found in Attachment C – Public API Javadoc. > 35 < ENTSO-E Energy Communication Platform ECP Public Interface Domain model of operation: ReceiveMessageResult String businessType boolean downloadMessage Input Output ReceivedMessage getMessage() int getRemainingMessagesCount() Error receiveMessage ReceivedMessage ReceiveMessageException String getErrorCode() String getErrorID() String getOriginalMessage() Throwable getCause() String getBusinessType() String getMessageID() String getReceiverCode() String getSenderCode() String getBusinessType() MessageContent getContent() String getSenderApplication() String getBaMessageID() MessageContent InputStream getInputStream() 8.2.3. Java confirmReceiveMessage Method This method provides the Confirm Receive Message operation which described in Chapter 5.3 – Confirm Receive Message. A detailed description of the method types and their attributes may be found in Attachment C – Public API Javadoc. Domain model of operation: > 36 < ENTSO-E Energy Communication Platform ECP Public Interface String messageID Input Output Error confirmReceiveMessage ConfirmReceiveMessageException String getErrorCode() String getErrorID() String getOriginalMessage() Throwable getCause() String getMessageID() 8.2.4. Java checkMessageStatus Method This method provides the Check Message Status operation described in Chapter 5.4 – Check Message . A detailed description of the method types and their attributes may be found in Attachment C – Public API Javadoc. Domain model of operation: > 37 < ENTSO-E Energy Communication Platform ECP Public Interface MessageStatus String messageID Output Input Error checkMessageStatus String getMessageID() MessageState getState() String getReceiverCode() String getSenderCode() String getBusinessType() String getSenderApplication() String getBaMessageID() Date getSendTimestamp() Date getRecieveTimestamp() MessageTrace[] getTrace() CheckMessageStatusException String getErrorCode() String getErrorID() String getOriginalMessage() Throwable getCause() String getMessageID() MessageState VERIFYING ACCEPTED DELIVERING DELIVERED RECEIVED FAILED MessageTraceState VERIFYING ACCEPTED TRANSPORTED DELIVERED RECEIVED FAILED 8.2.5. MessageTraceItem Date getTimestamp() MessageTraceState getState() String getComponent(); String getcomponentDescription() String getDetails() Java connectivityTest Method This method provides the Connectivity Test operation described in Chapter 5.5 – Connectivity Test. A detailed description of the method types and their attributes may be found in Attachment C – Public API Javadoc. > 38 < ENTSO-E Energy Communication Platform ECP Public Interface 8.3. Plugins This chapter describes interfaces related to ECP plugins. More information about ECP plugins can be found in Chapter 0 – The monitoring interface can be used to check the health of a deployed ECP module. A business application can use the Monitoring API to verify that the ECP Endpoint to which it is connected is running and in a good shape. The ECP administrator is able to discover various errors, including a broken database connection, incorrectly deployed components or problems with the delivery of messages (stuck messages). Monitoring functions are currently available only via Web Service. Plugins. Interface Description The interface for handling ReceiveEvents. ReceiveEventHandler The interface is used to implement custom handlers for receive events. Each handler must be registered into the endpoint as described in [AdminGuide]. The implementation typically downloads the related message and pushes it directly into the business application or directly notifies the business application about the message waiting to be received. ReceiveEvent An event which indicates that a message or an acknowledgement was delivered to the endpoint. > 39 < ENTSO-E Energy Communication Platform ECP Public Interface Interface Description The interface for handling SendEvents. SendEventHandler An event which indicated that a message changed its state to SendEvent 8.3.1. The interface is used to implement custom handlers for send events. Each handler must be registered in the endpoint as described in [AdminGuide]. DELIVERED, RECEIVED or FAILED. Receive Event Handler This chapter contains a detailed description of ReceiveEventHandler and ReceiveEvent interfaces. An example of a receive handler is included in [ECPExamples] in the Java project named ECP_WS_RECEIVE_HANDLER_EXAMPLE. This sample receive handler shows how to process an event about an incoming message (this event is pushed to the receive handler by ECP). When the event is processed, the handler calls method callWS(ReceivedMessage ecpMessage), which you should fill by your webservice call. Domain model: ReceiveEventHandler invoke void handleReceiveEvent(ReceiveEvent) ECP ReceiveEvent String getRelatedMessageId() String getEventDescription() long getAttempt() ReceiveEventHandler description: Method Description > 40 < ENTSO-E Energy Communication Platform ECP Public Interface Method Description Invoked when a new message arrives at this endpoint and is waiting to be received. In a typical implementation of the handler, the event is processed in one of the following ways: handleReceiveEvent downloads the related message via ECPMessaging and pushes it directly to the business application; or directly notifies the business application about the message waiting to be received. If this method throws an exception, ECP will try to call it again. ReceiveEvent description: Method Description getRelatedMessageId getEventDescription getAttempt 8.3.2. Returns ID of the message related to the ReceiveEvent. Returns text description of the ReceiveEvent. Returns a sequence number of the attempt for notification with the ReceiveEvent. If processing of ReceiveEvent fails, the ECP tries to repeat the notification (with an incremented attempt field). Send Event Handler This chapter contains a detailed description of the SendEventHandler and SendEvent interfaces. An example of a send handler is included in [ECPExamples] in the Java project named SAMPLES_SENDHANDLER. This sample send handler logs all events which it receives in the log file in the temporary directory. Domain model: SendEventHandler invoke void handleSendEvent(SendEvent) ECP SendEvent String getRelatedMessageId() String getEventDescription() long getAttempt() > 41 < ENTSO-E Energy Communication Platform ECP Public Interface SendEventHandler description: Method handleSendEvent Description Invoked when the status of the sent message is changed to DELIVERED, RECEIVED of FAILED. If this method throws an exception, ECP will try to call it again. SendEvent description: Method getRelatedMessageId getEventDescription getAttempt Description Returns ID of the message related to the SendEvent. Returns the status of the sent message. Possible values are: delivered received failed Returns sequence number of attempt for notification with the SendEvent. If the processing of SendEvent fails, the ECP reattempts the notification (with an incremented attempt field). > 42 < ENTSO-E Energy Communication Platform ECP Public Interface 9. WEB SERVICE MONITORING API ECP provides monitoring API via the web service ModuleStatusInfoV2Service described in this chapter. For WSDL of ModuleStatusInfoV2Service web service, see Attachment B. ModuleStatusInfoService webservice provides the following webmethods: Webmethod Description getModuleStatusInfo() GetModuleStatusInfoResult Returns monitoring information about the entire ECP module and its deployed components together with information about its surroundings (other connected modules and endpoints). Webmethods of ModuleStatusInfoService webservice use following data objects: Type Description GetModuleStatusInfoResult 9.1. Result of getModuleStatusInfo operation. Web Methods Description 9.1.1. Webmethod getModuleStatusInfo 9.1.1.1. Data object description GetModuleStatusInfoResult Attribute Type Description operationResult OperationResult Internal result of operation. moduleStatusInfo WSModuleStatusInfo Information about ECP module. > 43 < ENTSO-E Energy Communication Platform ECP Public Interface OperationResult Attribute Type Description Code of operation result. One of the following values is returned. resultCode String OK - Operation was successful. ERROR - Operation failed due to error. resultText String Details related to operation or error details. WSModuleStatusInfo Attribute Type Description Name of the ECP module unique in ECP. moduleName String Regexp pattern: [A-Za-z0-9-@]+ Operation mode of the ECP module. It moduleMode contains String Gateway, the Node) names of all (Node, enabled components. currentTime Date applicationName String Current server time. Name of the application. Regexp pattern: [A-Za-z0-9-]+ componentsInfo ComponentStatusInfoWS[] connectedEndpointsInfo ConnectedEndpointStatusInfoWS[] connectedModulesInfo ConnectedModuleStatusInfoWS certificates CertificateInfoWS[] informationMessagesInfo InformationMessageStatusInfoWS[] certificateAuthorityInfo CertificateAuthorityInfoWS[] Information about messaging components of the ECP module. Information about endpoints connected to the ECP module. Information about ECP modules connected to this ECP module. Information about all active certificates of the ECP module. List Information messages of the ECP module. Information about all trusted certificate authorities of the ECP Node. ComponentStatusInfoWS Attribute Type componentId String Description Component’s unique identification in ECP. Regexp pattern: [A-Za-z0-9-@]+ componentDescription Human String readable (optional). > 44 < description of component ENTSO-E Energy Communication Platform ECP Public Interface Attribute Type Description waitingDownload int Number of messages waiting for download. waitingUpload int totalDownloaded int totalUploaded int lastDownloadIn Date lastDownloadOut Date lastUploadIn Date lastUploadOut Date Number of messages waiting for upload. Number of all messages that were ever downloaded (or are waiting for download) from this component. Number of all messages that were ever uploaded (or are waiting for upload) by this component. Time the last message was downloaded to the component from the parent component. Time the last message was downloaded from the component by a child component. Time the last message was uploaded to this component by a child component. Time the last message was uploaded by this component to parent component. ConnectedEndpointStatusInfoWS Attribute Type Description Endpoint code unique in ECP. endpointName String Regexp pattern: [A-Za-z0-9-@]+ Name of the module through which the endpoint moduleName is connected to this module. String Regexp pattern: [A-Za-z0-9-@]+ lastDownloadedMessage Date lastUploadedMessage Date Time the last message was downloaded by the endpoint from this module. Time the last message was uploaded by the endpoint to this module. ConnectedModuleStatusInfoWS Attribute Type Description Unique identifier of the module in ECP. For a parent connection, the name shows the URL of name the parent. String Regexp pattern: [A-Za-z0-9-@]+ Mode of the module connected to this module. type String Possible PRIMARY PARENT. > 45 < values are PARENT SLAVE, and TUNNEL, SECONDARY ENTSO-E Energy Communication Platform ECP Public Interface Attribute Type Description Type of the channel through which the module channel is connected to this module. String Can be WS or SCP. lastConnection Time the last successful connection to this Date module was made by the connected module. InformationMessageStatusInfoWS Attribute Type Description Id String Unique identifier message. component String type String Information message type. severity String Severity of the information message. timestamp Date Date the information message was created. message String Text of the information message. Attribute Type Description type String Type of certificate. certificateAuthority String activeSince Date Timestamp since certificate is active. validUntil Date Timestamp until certificate is valid. preferred boolean If certificate is preferred. of the information Application component which has created the information message. CertificateInfoWS Name of the certificate authority which issued the certificate. CertificateAuthorityInfoWS Attribute Type Description name String Name of the certificate authority. type String Type of the certificate authority. validUntil Date Timestamp until the certificate authority is valid. > 46 < ENTSO-E Energy Communication Platform ECP Public Interface 10. CONFIGURATION OF CHANNELS AND MESSAGE RECEIVERS The Endpoint may use multiple channels and several message receivers for receiving messages. It is possible to configure them to accept only messages of specified types. Each message receiver can accept multiple message types, but each message type can be accepted by only one receiver. For example, the FSSF channel can be configured to accept Type1 and Type2 messages, while some user’s custom Receive Event Handler accepts Type3 messages. The detailed configuration of E/D Client channels is described in the [AdminGuide] document in the chapter ECP Public API – Configuration. > 47 < ENTSO-E Energy Communication Platform ECP Public Interface 11. ECP INTEGRATION LIBRARY The integration library distributed with ECP contains all the necessary classes and interfaces; it also contains support classes for calling the web services. The ECP integration library contains two classes which support the calling of the web services. As these classes use Apache Axis, make sure to have Axis library on your classpath. You may download it from Apache web page http://ws.apache.org/axis2/download/1_4_1/download.cgi. The following classes are provided to support the calling of web services: > ECPEndpointServiceStub – provides access to the ECP messaging functions. > ModuleStatusInfoV2ServiceStub – provides access to the ECP monitoring API. > 48 < ENTSO-E Energy Communication Platform ECP Public Interface 12. REFERENCES [AdminGuide] ECP Administrator’s Guide (ECP Administrators Guide.doc) [ECPExamples] ECP Examples (ECP Examples.zip) > 49 < ENTSO-E Energy Communication Platform ECP Public Interface ATTACHMENT A – WEBSERVICE PUBLIC API WSDL The WSDL for Messaging webservice can be downloaded from any endpoint by URL: http://<node IP>:8080/ECP_MODULE/services/ECPEndpointService?wsdl > 50 < ENTSO-E Energy Communication Platform ECP Public Interface ATTACHMENT B – MONITORING PUBLIC API WSDL The WSDL for ModuleStatusInfoService webservice can be downloaded from any module by URL: http:// <node IP>:8080/ECP_MODULE/services/ModuleStatusInfoV2Service?wsdl > 51 < ENTSO-E Energy Communication Platform ECP Public Interface ATTACHMENT C – PUBLIC API JAVADOC The ECP Public API Javadoc can be found in the same directory as the ECP integration library and is named ecp-javadoc.jar. > 52 <