public void onCompletion(Packet response) { LOGGER.finer(LocalizationMessages.WSMC_0105_STORING_RESPONSE(clientUID)); if (response.getMessage() != null) { final HeaderList headers = response.getMessage().getHeaders(); headers.remove(configuration.getAddressingVersion().toTag); headers.add( Headers.create( configuration.getAddressingVersion().toTag, configuration.getMcVersion().getWsmcAnonymousAddress(clientUID))); } responseStorage.store(response, clientUID); }
private String getClientUID(Packet request) { Header replyToHeader = request .getMessage() .getHeaders() .get(configuration.getAddressingVersion().replyToTag, false); if (replyToHeader != null) { try { String replyToAddress = replyToHeader.readAsEPR(configuration.getAddressingVersion()).getAddress(); return configuration.getMcVersion().getClientId(replyToAddress); } catch (XMLStreamException ex) { throw LOGGER.logSevereException( new RxRuntimeException( LocalizationMessages.WSMC_0103_ERROR_RETRIEVING_WSA_REPLYTO_CONTENT(), ex)); } } return null; }
void store(@NotNull Packet response, @NotNull String clientUID) { if (!getClientQueue(clientUID).offer(response)) { LOGGER.severe(LocalizationMessages.WSMC_0104_ERROR_STORING_RESPONSE(clientUID)); } }
private NextAction handleMakeConnectionRequest(Packet request, String clientUID) { try { LOGGER.entering(); String selectionUID; try { MakeConnectionElement mcElement = request .getMessage() .readPayloadAsJAXB( configuration .getMcVersion() .getUnmarshaller(configuration.getAddressingVersion())); selectionUID = configuration.getMcVersion().getClientId(mcElement.getAddress().getValue()); } catch (JAXBException ex) { throw LOGGER.logSevereException( new RxRuntimeException( LocalizationMessages.WSMC_0107_ERROR_UNMARSHALLING_PROTOCOL_MESSAGE(), ex)); } if (selectionUID == null) { // TODO return a MissingSelection SOAP fault throw LOGGER.logSevereException( new RxRuntimeException(LocalizationMessages.WSMC_0108_NULL_SELECTION_ADDRESS())); } if (!selectionUID.equals(clientUID)) { // TODO return a SOAP fault? throw LOGGER.logSevereException( new RxRuntimeException( LocalizationMessages.WSMC_0109_SELECTION_ADDRESS_NOT_MATCHING_WSA_REPLYTO())); } Packet response = null; if (selectionUID != null && responseStorage.hasPendingResponse(selectionUID)) { LOGGER.finer( LocalizationMessages.WSMC_0110_PENDING_MESSAGE_FOUND_FOR_SELECTION_UUID(selectionUID)); response = responseStorage.getPendingResponsePacket(selectionUID); } if (response == null) { LOGGER.finer( LocalizationMessages.WSMC_0111_NO_PENDING_MESSAGE_FOUND_FOR_SELECTION_UUID( selectionUID)); response = createEmptyResponse(request); } else { Message message = response.getMessage(); if (message != null) { HeaderList headers = message.getHeaders(); headers.add( Headers.create( configuration.getMcVersion().getJaxbContext(configuration.getAddressingVersion()), new MessagePendingElement( Boolean.valueOf( selectionUID != null && responseStorage.hasPendingResponse(selectionUID))))); } } return super.doReturnWith(response); } finally { LOGGER.exiting(); } }
public void onCompletion(Throwable error) { LOGGER.severe( LocalizationMessages.WSMC_0106_EXCEPTION_IN_REQUEST_PROCESSING(clientUID), error); }