| 1077 | | if ebMS_info['info']['transport-protocol-name'].upcase != "HTTP" then |
|---|
| 1078 | | close_open_connection instruction_pipe, transaction |
|---|
| 1079 | | # start new sending tasker. |
|---|
| 1080 | | |
|---|
| 1081 | | else |
|---|
| 1082 | | |
|---|
| 1083 | | # new_ebXML_message_object |
|---|
| 1084 | | # new_ebXML_message_info |
|---|
| | 1074 | @logger.debug "There are responses to be delivered." |
|---|
| | 1075 | |
|---|
| | 1076 | if ebMS_info['info']['transport-protocol-name'].upcase != "HTTP" then |
|---|
| | 1077 | @logger.debug "If we do not have the HTTP transport protocol then we can close the connection." |
|---|
| | 1078 | close_open_connection instruction_pipe, transaction |
|---|
| | 1079 | |
|---|
| | 1080 | # start new sending tasker. |
|---|
| | 1081 | @logger.error "Sending non HTTP transport protocol is not yet implemented." |
|---|
| | 1082 | return false |
|---|
| | 1083 | |
|---|
| | 1084 | else |
|---|
| | 1085 | |
|---|
| | 1086 | @logger.debug "Sending an ebXML response message via the HTTP transport protocol." |
|---|
| | 1087 | |
|---|
| | 1088 | # new_ebXML_message_object |
|---|
| | 1089 | # new_ebXML_message_info |
|---|
| | 1090 | |
|---|
| | 1091 | # -> sign messages? |
|---|
| | 1092 | # start delivery? command? |
|---|
| | 1093 | |
|---|
| | 1094 | if new_ebXML_message_object.is_ebMS_signal? then |
|---|
| | 1095 | # <enumeration value="mshSignalsOnly"/> |
|---|
| | 1096 | # <enumeration value="responseOnly"/> |
|---|
| | 1097 | # <enumeration value="signalsAndResponse"/> |
|---|
| | 1098 | # <enumeration value="signalsOnly"/> |
|---|
| | 1099 | # <enumeration value="none"/> |
|---|
| 1086 | | # -> sign messages? |
|---|
| 1087 | | # start delivery? command? |
|---|
| 1088 | | |
|---|
| 1089 | | if new_ebXML_message_object.is_ebMS_signal? then |
|---|
| 1090 | | # <enumeration value="mshSignalsOnly"/> |
|---|
| 1091 | | # <enumeration value="responseOnly"/> |
|---|
| 1092 | | # <enumeration value="signalsAndResponse"/> |
|---|
| 1093 | | # <enumeration value="signalsOnly"/> |
|---|
| 1094 | | # <enumeration value="none"/> |
|---|
| 1095 | | |
|---|
| 1096 | | if ebMS_info['info']['mc-syncReplyMode'] == 'none' then |
|---|
| 1097 | | close_open_connection instruction_pipe, transaction |
|---|
| 1098 | | #start new sending tasker. |
|---|
| 1099 | | @logger.error "Not implemented yet to asynchronously send an ebXML response message" |
|---|
| 1100 | | # xxxxxxxxxxxxxxxx |
|---|
| 1101 | | elsif ebMS_info['info']['mc-syncReplyMode'] == 'mshSignalsOnly' |
|---|
| 1102 | | @logger.debug "Sending msh signal synchronously back over HTTP transport protocol." |
|---|
| 1103 | | send_sync_response new_ebXML_message_object.raw_ebXML_message, transaction, instruction_pipe |
|---|
| 1104 | | |
|---|
| 1105 | | elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsOnly' |
|---|
| 1106 | | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| 1107 | | close_open_connection instruction_pipe, transaction |
|---|
| 1108 | | # ???? |
|---|
| 1109 | | return false |
|---|
| 1110 | | |
|---|
| 1111 | | elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsAndResponse' |
|---|
| 1112 | | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| 1113 | | close_open_connection instruction_pipe, transaction |
|---|
| 1114 | | # ???? |
|---|
| 1115 | | return false |
|---|
| 1116 | | |
|---|
| 1117 | | elsif ebMS_info['info']['mc-syncReplyMode'] == 'responseOnly' |
|---|
| 1118 | | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| 1119 | | close_open_connection instruction_pipe, transaction |
|---|
| 1120 | | # ???? |
|---|
| 1121 | | return false |
|---|
| 1122 | | |
|---|
| 1123 | | else |
|---|
| 1124 | | @logger.debug "Unknown syncReplyMode '#{ebMS_info['info']['mc-syncReplyMode']}'. Not returning new responses." |
|---|
| 1125 | | close_open_connection instruction_pipe, transaction |
|---|
| 1126 | | # ???? |
|---|
| | 1101 | if ebMS_info['info']['mc-syncReplyMode'] == 'none' then |
|---|
| | 1102 | @logger.debug "The CPA indicates that the response ebXML message must be sent asynchronously. So closing connection first (if there is a connection)." |
|---|
| | 1103 | close_open_connection instruction_pipe, transaction |
|---|
| | 1104 | @logger.debug "The response ebXML message must be sent asynchronously ... so starting the delivery process for this new ebXML message." |
|---|
| | 1105 | |
|---|
| | 1106 | # CREATING A NEW TRANSACTION FOR NEW ASYNC EBXML MESSAGE |
|---|
| | 1107 | # ------------------------------------------------------ |
|---|
| | 1108 | |
|---|
| | 1109 | puts '----------------' |
|---|
| | 1110 | new_transaction = @transaction_manager.get_new_transaction |
|---|
| | 1111 | puts 'oooooooooooooooo' |
|---|
| | 1112 | |
|---|
| | 1113 | if new_transaction.nil? then |
|---|
| | 1114 | @logger.debug "Error creating a new transaction." |
|---|
| | 1118 | @logger.debug "Created a new transaction for outgoing ebXML response message. Transaction id: #{new_transaction.transaction_id}" |
|---|
| | 1119 | |
|---|
| | 1120 | # This is a new transaction so we have to set the root cause of this new transaction. |
|---|
| | 1121 | if !new_transaction.set_root_cause new_ebXML_message_object.raw_message_file_path then |
|---|
| | 1122 | @logger.error "Unable to store the new response ebXML message as root cause to the new transaction" |
|---|
| | 1123 | # TODO remove stuff? |
|---|
| | 1124 | return false |
|---|
| | 1125 | else |
|---|
| | 1126 | @logger.debug "Succesfully stored the directive as root cause" |
|---|
| | 1127 | end |
|---|
| | 1128 | |
|---|
| | 1129 | # Some transaction stuff |
|---|
| | 1130 | path = "#{@config['MESSAGE_DIR']}/#{b2b_system.system_name}/#{new_ebXML_message_object.message_id}" |
|---|
| | 1131 | complete_ebXML_message_file_path = "#{path}/ebXML_message.ebMS2" |
|---|
| | 1132 | complete_ebXML_message_parameters_file_path = "#{path}/ebXML_message_parameters.yml" |
|---|
| | 1133 | |
|---|
| | 1134 | new_transaction.attach_file complete_ebXML_message_file_path, "outgoing ebXML message (response)" |
|---|
| | 1135 | new_transaction.attach_file complete_ebXML_message_parameters_file_path, "outgoing ebXML message parameters (response)" |
|---|
| | 1136 | |
|---|
| | 1137 | # attach the ebXML message to the transaction |
|---|
| | 1138 | new_transaction.transition_to_new_state "plain outgoing ebXML message created" |
|---|
| | 1139 | @logger.debug "Setting ebXML message id '#{ebMS_info['ebXML_message']['ebXML_message_id']}' to transaction." |
|---|
| | 1140 | new_transaction.add_ebXML_message_id_reference new_ebXML_message_object.message_id |
|---|
| | 1141 | |
|---|
| | 1142 | command, expectation = start_delivery( new_transaction, b2b_system.system_name ) |
|---|
| | 1143 | if command.nil? then |
|---|
| | 1144 | @logger.warn "Unable to proceed with start deliervy." |
|---|
| | 1145 | transaction.fail "Error starting delivery" |
|---|
| | 1146 | return true |
|---|
| | 1147 | else |
|---|
| | 1148 | transaction.set_next_expectation(expectation) |
|---|
| | 1149 | say_to_ania command |
|---|
| | 1150 | return true |
|---|
| | 1151 | end |
|---|
| | 1152 | |
|---|
| | 1153 | elsif ebMS_info['info']['mc-syncReplyMode'] == 'mshSignalsOnly' |
|---|
| | 1154 | @logger.debug "Sending msh signal synchronously back over HTTP transport protocol." |
|---|
| | 1155 | send_sync_response new_ebXML_message_object.raw_message_file_path, transaction, instruction_pipe |
|---|
| | 1156 | |
|---|
| | 1157 | elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsOnly' |
|---|
| | 1158 | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| | 1159 | close_open_connection instruction_pipe, transaction |
|---|
| | 1160 | # ???? |
|---|
| | 1161 | return false |
|---|
| | 1162 | |
|---|
| | 1163 | elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsAndResponse' |
|---|
| | 1164 | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| | 1165 | close_open_connection instruction_pipe, transaction |
|---|
| | 1166 | # ???? |
|---|
| | 1167 | return false |
|---|
| | 1168 | |
|---|
| | 1169 | elsif ebMS_info['info']['mc-syncReplyMode'] == 'responseOnly' |
|---|
| | 1170 | @logger.warn "signalsAndResponse as syncReplyMode not implemented." |
|---|
| | 1171 | close_open_connection instruction_pipe, transaction |
|---|
| | 1172 | # ???? |
|---|
| | 1173 | return false |
|---|
| | 1174 | |
|---|