コード例 #1
0
    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);
    }
コード例 #2
0
  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();
    }
  }