Skip to main content

Message Mapper

To process all messages generically, we added a mapper to the system. This mapper creates a common message object from every message, and holds vital information on destinations, response and message process.

Below is an example mapping with mandatory fields and explanation on what they mean and what they should hold.

    {
"inbound_filename": "the name if the file that will show up in the filemanager",
"outbound_needs_ack": "true for async false for sync",
"header_maps": {
"technical_message_id": "the technical_message_id from the soap:Header/MessageAddressing",
"correlation_id": "the correlation_id from the soap:Header/MessageAddressing",
"sender_id": "the sender_id from the soap:Header/MessageAddressing",
"receiver_id": "the receiver_id from the soap:Header/MessageAddressing",
"carrier_id": "the carrier_id from the soap:Header/MessageAddressing",
"content_type": "the content_type from the soap:Header/MessageAddressing",
},
"field_maps": {
"process_type_id": "id of the message type (N10, N11) of not there think of logical abbreviation of message type",
"creation_timestamp": "message creation timestamp",
"allocation_date": "allocation date: usually period end or if na then now",
"----COMMENT----": "parsed_allocation_date: 'parsed allocation date to use in file tags",
"domain": "ean/id of the metering point",
"message_id": "unique (uuid) of the message",
"revision_number": "follows the message_id default to 1",
"correlation_id": "unique (uuid) same over request and response",
"receiver_id": "ean of the receiving party",
"receiver_contact_type": "contact type of the receiving party",
"sender_id": "ean of the sending party",
"sender_contact_type": "contact type of the sending party",
"-----COMMENT----": "conditional fields for async messages",
"conversation_id": "ONLY FOR soap_hub.name = 'mmchub' unique (uuid) of the conversation can be ''",
"new_ack_message_id": "ONLY FOR soap_hub.name = 'mmchub' unique (uuid)",
"new_correlation_id": "ONLY IF GLDPM = True: unique (uuid)",
"reason_code": "TAKEN FROM ACKS IN ASYNC PROCESS reason/rejection code",
"reason_text": "TAKEN FROM ACKS IN ASYNC PROCESS reason/rejection text",
"ack_created_datetime": "TAKEN FROM ACKS IN ASYNC PROCESS acknowledgement creation timestamp",
"------COMMENT----": "conditional fields for sync messages",
"external_ref": "FOR PUD ACK: external reference",
"external_mrid": "FOR PUD ACK: external mrid",
"dossier_id": "FOR PUD ACK: dossier id"
},
"inbound_file_tags": {
"----COMMENT----": "tags to be used in the fileservice. tagname: ref to name in field_maps",
"SenderID": "sender_id",
"-----COMMENT----": "...",
"AllocationPoint": "domain"
},
"ack_maps": {
"msg_type": {
"msg_type": "ONLY if different from default. multiple possible",
"ns": "namespace of the acknowledgement",
"default_reason_code": "if positive acknowledgement"
},
"default": {
"msg_type": "Acknowledgement or response message type",
"ns": "namespace of the acknowledgement",
"default_reason_code": "if positive acknowledgement 000"
}
},
"soap_hub": {
"name": "mmchub or edsn",
"service_name": "mmchub, gldpm, PUD or CAR",
"base_url": {
"test": "base url to test environment",
"production": "base url to production environment"
},
"message": {
"multi_response": {
"multi_response": "False/True if multiple responses are expected (loop until empty response)",
"check_field": "what field to check on the response (point to field in field_maps of response mapper) if the field is not empty the response is not empty and a new request will be send",
"message_id_element": "element of the message id to regenerate on re-send",
"creation_ts_element": "element of the CreationTimestamp to regenerate on re-send"
},
"urls": {
"msg_type": "{base_url}<URLPART>/{msg_type}/<URLPART> ONLY if different from default. multiple posible",
"default": "{base_url}<URLPART>/{msg_type}/<URLPART>",
"-----COMMENT----": "conditional fields for async messages",
"get": "{base_url}url",
"list": "{base_url}url"
},
"soap_actions": {
"send_action": "SOAP Send action",
"-----COMMENT----": "conditional fields for async messages",
"get_action": "SOAP Get action",
"list_action": "SOAP List action"
}
},
"acknowledgements":{
"-----COMMENT----": "acknowledgements can be used if soapActions and URL's for acknowledgements differ from the messages themself.",
"urls": {
"default": "{base_url}<URLPART>/{ack_type}/<URLPART>",
"get": "{base_url}url",
"list": "{base_url}url"
},
"soap_actions": {
"send_action": "SOAP Send action",
"get_action": "SOAP Get action"
}
}
}
}

The mapper files should have the same name as the message_type and are uploaded to the config bucked in the folder “maps”

Header maps

Header maps hold the mapping from the soap header of a message to the common structure. They define a function to use and the XPath to the actual element in the message.

    "header_maps": {
"common_name": {
"function": "get_from_message",
"args": "xPath"
},

The “common_name“ holds the key of the field, like described below. See Field maps for functions and extra explanation.

Field maps

Field maps hold the mapping from the message to the common structure. They define a function to use and the XPath to the actual element in the message.

    "field_maps": {
"common_name": {
"function": "get_from_message",
"args": "xPath"
},

The “common_name“ holds the key of the field, like described below.

We then have a couple of functions that can be performed.

"get_from_message" This gets the element value from a message based on the XPath defined in the "args" field

            "creation_timestamp": {
"function": "get_from_message",
"args": "CreationTimestamp"
},

"return_string" This returns the exact string that is defined in the "args" field. This is used to set a default value

           "sting": {
"function": "return_string",
"args": "hallo"
},

"parse_to_date" This parses a timestamp from the xPath defined in the "args" field to a simple date

            "timestamp": {
"function": "parse_to_date",
"args": "CreationTimestamp"
},

"current_date_time" This returns the current timestamp"args" field should be empty.

           "timestamp": {
"function": "current_date_time",
"args": ""
},

"generate_uuid" This returns a new uuid4 "args" field should be empty.

           "new_id": {
"function": "generate_uuid",
"args": ""
},

"not_null_value" If the firs function returns nothing, perform the second one. "args" hold the functions

    "domain": {
"function": "not_null_value",
"args": [
{
"function": "get_from_message",
"args": "MarketEvaluationPoint/mRID"
},
{
"function": "get_from_message",
"args": "Domain/mRID"
}
]
},

"concat_hyphen" this adds two fields together with a -

   "inbound_filename":{
"function": "concat_hyphen",
"args": [
{
"function": "get_from_message",
"args": "ProcessTypeID"
},
{
"function": "get_from_message",
"args": "MessageID"
}
]
},