CWE Energy Communication Platform ECP Public Interface CWE Energy Communication Platform ECP Public Interface Un ic or n S ys t em s © 2 00 9- 2 01 1 U nic or n S ys t em s a.s . J ank o vc o va 10 3 7/ 4 9, Pr ah a 7 , CZ - 17 0 0 0 Title: CWE Energy Communication Platform ECP Public Interface Author: Version: Date: Michal Ráček, Petr Sochůrek, Jiří Neuman, Jiří Dudek 2.1 03/02/2011 Contact: E-mail: info@unicornsystems.eu Tel.: (+420) 221 400 111 CWE CWE Energy Communication Platform ECP Public Interface 1. CONTENTS 1. 2. 3. 4. Contents .............................................................................................................3 Key Conclusion ...................................................................................................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. Java methods Description ............................................................................. 32 8.2.1. Java Method sendMessage ...................................................................... 32 8.2.2. Java Method receiveMessage .................................................................. 33 8.2.3. Java Method confirmReceiveMessage ...................................................... 34 8.2.4. Java Method checkMessageStatus ........................................................... 35 8.2.5. Java Method connectivityTest .................................................................. 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- CWE CWE 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 11.1. Support for Calling Web Services .................................................................. 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- CWE Energy Communication Platform ECP Public Interface 2. KEY CONCLUSION This document describes public API of the ECP endpoint through which applications can integrate with ECP and use it for sending and receiving messages. The document covers all basic ECP messaging functions and in detail describes the nuances of all three technological channels – Web Service API, Java API and file system shared folder (FSSF). In addition, also more advanced functionalities are explained, including ECP health monitoring API and ECP extension API including send handlers and receive handlers. >5< CWE Energy Communication Platform ECP Public Interface 3. REVISIONS HISTORY Version Date Author Description 0.1 24/06/2009 Michal Ráček ECP public interface 0.10 24/06/2009 Petr Sochůrek Revision 0.11 26/06/2009 Michal Ráček 0.12 01/07/2009 Michal Ráček API revision against EP. 1.00 02/07/2009 Stanislav Mikulecký Final Revision 1.01 16/07/2009 Petr Sochůrek FSSF naming conventions precised. 1.02 21/07/2009 Petr Sochůrek 1.03 19/08/2009 Petr Sochůrek 1.04 14/10/2009 Jiří Neuman 1.05 03/11/2009 Michal Ráček Changes for ECP 1.0.2 1.5 16/02/2009 Jiří Neuman Changes for ECP 1.5 1.51 12/04/2010 Jiří Neuman Removed senderBA from WS and Java API, minor revisions. Java API description standardized and added specification for ReceiveEventHandler. WS and Java API specification updated. WSDL extracted to separate file. Added information about configuration of channels and message receivers Added examples of SOAP requests and response for web service methods. Other minor improvements. 2.1 03/02/2011 Jiří Dudek Changes for ECP 2.1 >6< CWE Energy Communication Platform ECP Public Interface 4. OVERVIEW Public interface of ECP can be divided into two groups according to the purpose of provided methods. > Messaging API – provides key functions of ECP which are sending and receiving of messages, checking message delivery status and connectivity tests. ECP provides these functions via several channels. Some functions may not be available on all of them. > Monitoring API – provides support functions which report important information about current internal state of deployed ECP module. > Plugins – the behaviour of ECP can be extended by specific plugins that can modify the way of how messages are sent and received. 4.1. Messaging API Messaging API contains core functions of ECP. They ensure secure and reliable transportation of message from one ECP endpoint to another. 4.1.1. Send Message This function accepts business message for sending over ECP to another endpoint. The message will be validated and, if the validation succeeds, the message will be accepted for transportation over ECP. After message acceptance the ECP is responsible for the delivery of the message. As a result of this method call, unique message ID is returned. This message ID allows identifying sent message and checking the state of message delivery. 4.1.2. Receive Message This method allows receiving message which was delivered to the ECP endpoint. The method returns the message to business application. The message is not marked as delivered until confirm receive is called. 4.1.3. Confirm Receive Message This method confirms message recipience. The method marks the message as received. At this point, ECP considers the message successfully transported. 4.1.4. Check Message Status Method checks state of the message (specified by message ID). This method allows sender of the message to check whether the message reached its destination, whether there was an error during transportation or if the message is stuck at some intermediate ECP component. Also the receiver >7< CWE Energy Communication Platform ECP Public Interface of the message can use this method to check whether specific message is present at the receiver’s endpoint. 4.1.5. Connectivity Test To check connectivity to certain ECP endpoint, tracing message can be send using connectivity test method. This method sends the tracing message and returns its message ID assigned by ECP. To verify that the tracing message reached the receiver, sender should check its delivery status by previously mentioned method. Please note, that the connectivity test is meant to be used only for checking connectivity from one ECP endpoint to another. You can think of connectivity test as of a trace route utility. You send a tracing message and then trace its path using Check message delivery status method. When you need to make your business application check availability of its ECP Client, please refer to the Monitoring API description below. Connectivity test should not be used to test connectivity between a business application and its ECP Client. 4.2. Monitoring API The monitoring interface can be used to check health of deployed ECP module. A business application can use the Monitoring API to verify that the ECP Client to which it is connected is running and in a good shape. ECP administrator is able to discover various errors including broken database connection, incorrectly deployed components or problems with delivery of messages (stuck messages). Monitoring functions are currently available only via Web Service. 4.3. Plugins ECP plugin is a class implementing specific interface, packed in JAR and put into specific directory located in the deployed ECP module. ECP supports currently two types of plugins described in following paragraphs. Configuration of plugins is described in [AdminGuide]. 4.3.1. Receive Handlers Receive handler is a plugin which is notified by ECP whenever a message of given type is delivered to the endpoint in which the plugin is registered. When receive handler is notified about new message, it is up to it to decide what to do with the message. In typical implementation of the receive handler, the handler receives the message and passes it to the business application via Web service. >8< CWE Energy Communication Platform ECP Public Interface An example of a receive handler is included in [ECPExamples] in Java project named ECP_WS_RECEIVE_HANDLER_EXAMPLE. This sample receive handler shows how to process event about incoming message (this event is pushed into 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. Common scenario of Receive Handler usage. ECP The receive handler for processing of the message is chosen according to the ECP configuration. Incoming Message Message is delivered into the ECP. 4.3.2. module.properties ECP Module Custom Receive Handler Message is pushed into the chosen Receive Handler implementation. Business Application Custom implementation of the receive handler pushes the message into Business Application. Send Handlers Send handler is concept that allows processing messages immediately after the state of these messages is changed to DELIVERED, RECEIVED or FAILED. SendEventHandler is a custom class which is registered into the ECP endpoint. This class exposes one required method which is called by ECP endpoint immediately after the message of defined type changes the state. Note that ECP only notifies the handler about that message and it is up to the handler implementation how it will react on this notification. Typically, the send handler notifies the business application about the state change, so that users of the application know that the message was e.g. received by target recipient. An example of a send handler is included in [ECPExamples] in Java project named SAMPLES_SENDHANDLER. This sample send handler logs all events which it receives into the log file in the temporary directory. >9< CWE Energy Communication Platform ECP Public Interface 5. LOGICAL MESSAGING API DESCRIPTION This chapter describes messaging API methods parameters and results. Its main aim is to provide overview of messaging API which is same for all channels. The principle is following: 1. Message is sent by sending business application using Send Message operation. 2. Message is transported through the ECP network to the receiver. 3. Message is received by receiving business application using Receive Message operation. 4. Message reception is confirmed by the receiving business application and message is marked as received. 5. The message processing state can be observed by the Check Message Status operation any time during this process. 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 business message for sending over ECP to another endpoint. The message is validated and, if the validation passed, the message is accepted for transportation over ECP. After message acceptation is ECP responsible for the delivery of the message. As a result of this method call, unique message ID is returned. This message ID allows identification of the sent message and checking the state of the message delivery. This operation contains check against a double sending. With every call the application should provide Conversation ID which has to be unique for each message. This ID has to be also same if one message would be send twice (because of the business application or network error). If ECP receives more send requests with the same Conversation ID it will return the same result (message ID) and sends this message only once. > 10 < CWE 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 False ID which identifies this conversation. If send message will be called twice with the same Conversation ID String Conversation ID then it returns same result. It True is used to prevent message doubling in case of sender application error. SentMessage object: Parameter Type Receiver Code String Description Required Code of endpoint of recipient. False Regexp pattern: [A-Za-z0-9-@]+ Message business type. Business Type String False Regexp pattern: [A-Za-z0-9-]+ Message id assigned by BA (optional). BA Message ID string True Regexp pattern: [A-Za-z0-9-]* Code or description of sender’s BA (optional). Sender Application string True Regexp pattern: [A-Za-z0-9-]* Message payload (required). Content content False The type is different in all channels. > 11 < CWE Energy Communication Platform ECP Public Interface Response: Parameter Type Message ID string Required Description Unique message ID that ECP automatically False assigned to sent message. Error: Parameter Type Error code string Description Required The code representing the kind of the error (e.g. validation error, unexpected error etc). False Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the False application logs. Error message string Error details string Receiver code string 5.2. Error message usually describing the reason of failure. Additional error details. False True Code of the receiver to which the message was addressed. True Receive Message This operation allows receiving message which was delivered to the ECP endpoint. The method returns the message to business application. The message is not marked as delivered until Confirm receive method is called. This prevents losing of messages in case of 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 CWE Energy Communication Platform ECP Public Interface 5.2.1. Input/Output Description Input parameters: Parameter Type Required Description The message type of message to be received. When Business type String message type is not set, the first message waiting for download will be received, regardless of its message type. False Regexp pattern: [A-Za-z0-9-]* The flag indicating if content of the message should be downloaded too. Receive content boolean > true – complete message is returned False > 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 True received. Waiting messages count Count of remaining messages of the business number type that was specified as input parameter of False ReceiveMessage method. ReceivedMessage object: Parameter Type Description Required Message ID string Unique ID of the message. False Receiver Code string Endpoint code of the message’s receiver False Sender Code string Endpoint code of message's sender False Business Type string Message business type. False BA Message ID string Message ID assigned by BA. True Sender Application string Core or description of sender’s BA. True 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 < True CWE Energy Communication Platform ECP Public Interface Error: Parameter Type Error code string Description Required The code representing the kind of the error (e.g. validation error, unexpected error etc). False Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the False application logs. Error message usually describing the reason of Error message string Error details string Additional error details. True Business type string Business type which was used as a parameter. True 5.3. failure. False Confirm Receive Message This operation confirms message reception. The method marks the message as received. At this point, 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 < CWE Energy Communication Platform ECP Public Interface 5.3.1. Input/Output Description Input parameters: Parameter Type Description Required Unique ID of the message. Message ID string False Regexp pattern: [A-Za-z0-9-]+ Response: No response. Error: Parameter Type Error code string Description The code representing the kind of the error (e.g. validation error, unexpected error etc ). Required False Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the False application logs. Error message usually describing the reason of Error message string Error details string Additional error details. True Message ID string ID of message which should be confirmed. True 5.4. failure. False Check Message Status This operation checks state of the message (specified by message ID). This method allows sender of the message to check whether the message reached its destination, whether there was an error during transportation or if the message is stuck at some intermediate ECP component. Also the receiver of the message can use this method to check whether specific message is present at the receiver’s endpoint. > 15 < CWE 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 ID of the message. Message ID string False Regexp pattern: [A-Za-z0-9-]+ Response: Required Parameter Type Description Message status MessageStatus Metadata processing status. True MessageStatus object: Parameter Type Description Message ID string Unique ID of the message. False State MessageState State of the message. False Receiver Code string Endpoint code of the message’s receiver False Sender Code string Endpoint code of message's sender False Business Type string Message business type. False BA Message ID string Message id assigned by BA (optional). True Sender Application string Code or description of sender’s BA (optional). True Send timestamp timestamp Exact date and time when message was sent. False Receive timestamp timestamp List Trace Exact and time when message was received. of MessageTraceI tem. date Required Detailed information about message's traversal through ECP network. > 16 < True True CWE Energy Communication Platform ECP Public Interface MessageTraceItem object: Parameter Type Description Timestamp timestamp Exact date and time of the event. False State of the message processing. False State Component Component description Details MessageTrace State string string string Required The code of ECP messaging component on which the event happened. Human-understandable description of the messaging component. Details about the event. False False True MessageState enumeration: Name VERIFYING ACCEPTED Description The message is waiting for receiver verification due to connectivity problems between 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 into endpoint of the recipient. DELIVERED The message has been delivered to the target endpoint. RECEIVED The message has been received by 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 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 t arget endpoint. RECEIVED The message has been received by target business application or user. FAILED The processing of the message failed. Error: Parameter Type Error code string Description The code representing the kind of the error (e.g. validation error, unexpected error etc). > 17 < Required False CWE Energy Communication Platform ECP Public Interface Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the False application logs. Error message usually describing the reason of Error message string Error details string Additional error details. True Message ID string ID of message which state should be returned. True 5.5. failure. False Connectivity Test To check the connectivity to certain ECP endpoint, tracing message can be send using connectivity test method. This method sends the tracing message and returns its message ID assigned by ECP. The tracing message is delivered only to the target endpoint, it is never passed to the receiver’s business application. To verify that the tracing message reached the receiver, sender should check its delivery status by previously mentioned method. Input Output Connectivity Test Error Receiver code Error code Error ID Error message Error details Receiver code > 18 < Message ID CWE Energy Communication Platform ECP Public Interface 5.5.1. Input/Output Description Input parameters: Parameter Type Required Description Endpoint code of receiver. Receiver code string True Regexp pattern: [A-Za-z0-9-@]+ Response: Parameter Type Message ID string Required Description Unique message ID that ECP automatically assigned to sent message. False Error : Parameter Type Error code string Error ID string Description Required The code representing the kind of the error (e.g. validation error, unexpected error etc). False Unique identification of the failure. The Error ID shall be always used to track the error in the False 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 False True which was addressed. message True Usage of the Connectivity Test Operation: 1. Call the Connectivity Test method, which then sends tracing message through ECP to endpoint specified by the Receiver code parameter. 2. Response of this method contains ECP message ID assigned to the tracing message. Note this message ID. 3. To verify connectivity to given receiver, call the Check Message Status operation and use the message ID of the tracing message as parameter in this method. 4. If message state is DELIVERED then the tracing message reached the receiver and connectivity test was successful. > 19 < CWE 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 over which ECP components the message had passed. 6. If the message state contains value FAILED or the message state does not change to DELIVERED after a while and message trace does not contain new values, the connection may be broken. > 20 < CWE 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 ECP endpoint, the webservice is available via HTTP or HTTPS protocol. 6.1. Implementation of the Logical API 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 object. > Results are wrapped into the response objects. > Error description is transferred as Detail part of SOAP fault. These types are described in following webmethod description. 6.2. Webmethods description 6.2.1. Webmethod SendMessage This webmethod provides the Send Message operation which is described in 5.1 Send Message. The detail description of the webmethod tpes and its 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 < CWE 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 which is described in 0 Error: Parameter Type Error code string Error ID string Description The code representing the kind of the error (e.g. validation error, unexpected error etc). Required False Unique identification of the failure. The Error ID shall be always used to track the error in the False application logs. Error message string Error details string Receiver code string Error message usually describing the reason of failure. Additional error details. Code of the receiver to which the message was addressed. False True True Receive Message. The detail description of the webmethod types and its 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 < CWE Energy Communication Platform ECP Public Interface Logical type Wrapping type Fault Detail ReceiveMessageError > 23 < CWE 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 which is described in 5.3 Confirm Receive Message. The detail description of the webmethod types and its 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 < CWE 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 which is described in 5.4 Check Message . The detail description of the webmethod types and its 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 < CWE 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 which is described in 5.5 Connectivity Test. The detail description of the webmethod types and its 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 < CWE 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 standard SOAP Fault mechanism (http://www.w3.org/TR/soap12-part1/#soapfault). The ECP specific information about error is transported using the Detail part of SOAP Fault element. The fault and detail types are described in each webmethod description. > 27 < CWE Energy Communication Platform ECP Public Interface 7. FILE SYSTEM SHARED FOLDER (FSSF) This interface is represented by file system shared folders through which an application and ECP exchange files. Each ECP endpoint that is configured to support FSSF interface should use its own set of shared folders. This interface allows BA to send messages (via OUT folder) and ensures receiving of messages (via IN folder). In addition, ECP endpoint can be configured to create one-per-sent-message log files (stored into OUT_LOG folder). If sending of message fails (due to a validation problem or internal error) it is moved from OUT folder into OUT_ERROR folder. Please note that FSSF channel allows using only subset of messaging API operations and some operation do not provide the same possibilities. Following operations are supported: > Send message – without support of Conversation ID > Receive message – there is no need to confirm message receive. The message is marked as received immediately after putting into receive folder. > Confirm receive message – due to behavior of the receive message the Confirm Receive Message operation is not supported. > Check message status – not supported > Connectivity test – not supported Please, refer to [AdminGuide] for detailed information about FSSF configuration. 7.1. File Naming Conventions There are 4 types of files used in FSSF channel. Each file type is written into a separate folder and its file name is formed by several parts which are separated with fixed number of underscores (underscores must be stated even if some 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>_<RECEIVER>_<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-]* > 28 < CWE Energy Communication Platform ECP Public Interface Code of endpoint of recipient (supplied by sender BA) . <RECEIVER> Mandatory Regexp pattern: [A-Za-z0-9-@]+ Type of message (supplied by sender BA). <TYPE> Mandatory Regexp pattern: [A-Za-z0-9-]+ <BAMessageID> Optional The unique identifier of message assigned by BA. It is recommended to use GUID in order 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 <EXT> Optional extension TMP (both uppercase and lowercase). Regexp pattern: [A-Za-z0-9-]* Notes > Content of each part of filename is limited to alphanumeric characters and hyphen with no character with accents, no spaces, no special characters, and no white space. > ECP rejects files - when filename does not follow format defined above - when have length that exceeds 255 characters. - when there is no content. > ECP ignores files whose filename - contains TMP extension (both uppercase and lowercase). 7.2. Folders Interface is formed by following shared file system folders: > OUT - contains: message files to be sent via ECP; files content can be arbitrary - usage: BA puts message files into the folder; ECP picks up message files from the folder (ECP removes message file from the folder after it is picked up) > OUT_ERROR > 29 < CWE Energy Communication Platform ECP Public Interface - contains: message files that were rejected by ECP or some error occurred during their processing by ECP. - usage: ECP moves rejected files from OUT directory here so they can be corrected manually and sent again. > OUT_LOG - contains: message log files (one file per message) - logged message events: accepted, refused, delivering, delivered, received, failed (can happen only after the message was already accepted by ECP) - usage: ECP continuously logs message-related events into log files; when the message is accepted also assigned message id is logged; BA can read the message log file anytime - by configuration possible to create one filer per message or one file per day > IN - contains: received message files, files content can be arbitrary - folder structure: subfolder for each message type - usage: ECP writes received message files into the folder, BA picks up message files (it is the BA responsibility to remove message files from 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 „message accepted“ record into it > 30 < CWE Energy Communication Platform ECP Public Interface 4. The ECP transports the message file through the ECP network and continuously logs message related events into the “<SENDERAPP>_<RECEIVER>_<TYPE>_<BAMessageID>.log “ file. 5. On the recipient side, the ECP stores the message into the “<SENDERAPP>_<RECEIVER>_<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>_<RECEIVER>_<TYPE>_<BAMessageID>_<ECPMessageID>.EXT “ from the IN folder. > 31 < CWE Energy Communication Platform ECP Public Interface 8. JAVA API This API can be used by business applications which are 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 Contains ECPFacadeProvider method which provides instance The interface represents facade which provides access to messaging functions of ECP Module. Key Concepts 8.1.1. Messaging API Invocation The operation of messaging API can be invoked in following way: 1. Get ECPMessaging component using the ECPFacadeProvider component. 2. Invoke messaging operation. ECPFacadeProvider 1:getMessaging() ECPMessaging getMessaging() Business Application of ECPMessaging. ECPMessaging 8.1. static 2:p e rfor mo per a tion ECPMessaging String sendMessage(SentMessage message, String conversationID) ReceiveMessageResult receiveMessage(String businessType, boolean downloadContent) void confirmReceiveMessage(String messageID) MessageStatus checkMessageStatus(String messageID) String connectivityTest(String receiverCode) > 32 < CWE Energy Communication Platform ECP Public Interface 8.1.2. Implementation of the Logical API 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 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 application is sending message then it has to provide own implementation of this interface. This is required because: - ECP content can be up to 50 Mb. It is not recommended to hold the whole data in memory. - Every application can use it’s 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 it contains all information which are described in 5 Logical Messaging API Description. The mapping is following: 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. Java methods Description Java Method sendMessage This method provides the Send Message operation which is described in 5.1 Send Message. The detail description of the method types and its attributes may be found in Attachment C – Public API Javadoc. > 33 < CWE Energy Communication Platform ECP Public Interface Domain model of operation: SentMessage sentMessage String conversationID Input Output String messageId Error sendMessage SentMessage String receiverCode String businessType MessageConent content String senderApplication String baMessageID SendMessageException String getErrorCode() String getErrorID() String getOriginalMessage() Throwable getCause() String getReceiverCode() MessageContent InputStream getInputStream() 8.2.2. Java Method receiveMessage This method provides the Receive Message operation which is described in 0 Error: Parameter Type Error code string Description The code representing the kind of the error (e.g. validation error, unexpected error etc). Required False Unique identification of the failure. The Error ID Error ID string shall be always used to track the error in the False application logs. Error message string Error details string Receiver code string Error message usually describing the reason of failure. Additional error details. Code of the receiver to which the message was addressed. > 34 < False True True CWE Energy Communication Platform ECP Public Interface Receive Message. The detail description of the method types and its attributes may be found in Attachment C – Public API Javadoc. > 35 < CWE 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 Method confirmReceiveMessage This method provides the Confirm Receive Message operation which is described in 5.3 Confirm Receive Message. The detail description of the method types and its attributes may be found in Attachment C – Public API Javadoc. Domain model of operation: > 36 < CWE 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 Method checkMessageStatus This method provides the Check Message Status operation which is described in 5.4 Check Message . The detail description of the method types and its attributes may be found in Attachment C – Public API Javadoc. Domain model of operation: > 37 < CWE 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 Method connectivityTest This method provides the Connectivity Test operation which is described in 5.5 Connectivity Test. The detail description of the method types and its attributes may be found in Attachment C – Public API Javadoc. > 38 < CWE Energy Communication Platform ECP Public Interface String receiverCode Input Output String messageId Error connectivityTest ConnectivityTestException String getErrorCode() String getErrorID() String getOriginalMessage() Throwable getCause() String getReceiverCode() 8.3. Plugins This chapter describes interfaces related to the ECP Plugins. More information about ECP plugins can be found in 0 The monitoring interface can be used to check health of deployed ECP module. A business application can use the Monitoring API to verify that the ECP Client to which it is connected is running and in a good shape. ECP administrator is able to discover various errors including broken database connection, incorrectly deployed components or problems with delivery of messages (stuck messages). Monitoring functions are currently available only via Web Service. Plugins. Interface Description The interface for handling ReceiveEvents. ReceiveEventHandler 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 < CWE 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. Interface is used to implement custom handlers for send events. Each handler must be registered into the endpoint as described in [AdminGuide]. DELIVERED, RECEIVED or FAILED. Receive Event Handler This chapter contains detail description of ReceiveEventHandler and ReceiveEvent interfaces. An example of a receive handler is included in [ECPExamples] in Java project named ECP_WS_RECEIVE_HANDLER_EXAMPLE. This sample receive handler shows how to process event about incoming message (this event is pushed into 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 < CWE Energy Communication Platform ECP Public Interface Method Description Invoked when new message arrives into this endpoint and becomes waiting to be received. In typical implementation of handler the event is processed in one of the following ways: handleReceiveEvent downloads the related message via ECPMessaging and pushes it directly into business application, or directly notifies business application about the message waiting to be received. If this method throws 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 sequence number of attempt for notification with the ReceiveEvent. If processing of ReceiveEvent fails, the ECP tries to do notification again (with incremented attempt field). Send Event Handler This chapter contains detail description of SendEventHandler and SendEvent interfaces. An example of a send handler is included in [ECPExamples] in Java project named SAMPLES_SENDHANDLER. This sample send handler logs all events which it receives into the log file in the temporary directory. Domain model: SendEventHandler invoke void handleSendEvent(SendEvent) ECP SendEvent String getRelatedMessageId() String getEventDescription() long getAttempt() > 41 < CWE Energy Communication Platform ECP Public Interface SendEventHandler description: Method handleSendEvent Description Invoked when state of sent message is changed to DELIVERED, RECEIVED of FAILED state. If this method throws 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 state of the sent message. Possible values are : Delivered Received Failed Returns sequence number of attempt for notification with the SendEvent. If processing of SendEvent fails, the ECP tries to do notification again (with incremented attempt field). > 42 < CWE Energy Communication Platform ECP Public Interface 9. WEB SERVICE MONITORING API ECP provides monitoring API via web service ModuleStatusInfoV2Service described in this chapter. For WSDL of ModuleStatusInfoV2Service web service, please see Attachment B. ModuleStatusInfoService webservice provides following webmethods: Webmethod Description getModuleStatusInfo() GetModuleStatusInfoResult Returns monitoring information about the whole 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 objects description GetModuleStatusInfoResult Attribute Type Description operationResult OperationResult Internal result of operation. moduleStatusInfo WSModuleStatusInfo Information about ECP module. > 43 < CWE 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 The details related to operation running or error String 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 String contains names(Node, Gateway, Node) of all 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 CWE Energy Communication Platform ECP Public Interface 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 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 parent connection, name shows URL of the name String parent. 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 CWE Energy Communication Platform ECP Public Interface 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 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 information message. Date when the information message was created. 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 < CWE Energy Communication Platform ECP Public Interface 10. CONFIGURATION OF CHANNELS AND MESSAGE RECEIVERS E/D Client may have multiple channels and message receivers available for receiving messages. There is a possibility 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 only by one receiver. For example FSSF channel can be configured to accept messages of types Type1 and Type2 while some user’s custom Receive Event Handler accepts messages of type Type3. Detailed configuration of E/D Client channels is described in the [AdminGuide] document in chapter ECP Public API – Configuration. > 47 < CWE Energy Communication Platform ECP Public Interface 11. ECP INTEGRATION LIBRARY There is integration library distributed with ECP. This library contains all important classes and interfaces which is required to integrate with ECP It also contains support classes for calling web services. 11.1. Support for Calling Web Services ECP integration library contains two classes which support calling of web services. As these classes use Apache Axis, please 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. Following classes are provided to support calling of web services: > ECPEndpointServiceStub – provides access to ECP messaging functions. > ModuleStatusInfoV2ServiceStub – provides access to ECP monitoring API. > 48 < CWE Energy Communication Platform ECP Public Interface 12. REFERENCES [AdminGuide] ECP Administrator’s Guide (ECP Administrators Guide.doc) [ECPExamples] ECP Examples (ECP Examples.zip) > 49 < CWE 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://url:port/ECP_MODULE/services/ECPEndpointService?wsdl > 50 < CWE 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://url:port/ECP_MODULE/services/ModuleStatusInfoV2Service?wsdl > 51 < CWE Energy Communication Platform ECP Public Interface ATTACHMENT C – PUBLIC API JAVADOC The ECP Public API javadoc may be found in the same directory as ECP integration library and it has name ecp-javadoc.jar. > 52 <