Example usage for javax.xml.ws.handler MessageContext put

List of usage examples for javax.xml.ws.handler MessageContext put

Introduction

In this page you can find the example usage for javax.xml.ws.handler MessageContext put.

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

From source file:org.apache.juddi.xlt.util.LoggingHandler.java

private void setFaultReceived(MessageContext context) {
    context.put(XLT_FAULT, true);
}

From source file:org.openehealth.ipf.platform.camel.ihe.ws.AbstractWebService.java

/**
 * Calls the consumer for processing via Camel.
 *
 * @param body/*from   w  w w.  j av  a2  s.c  o  m*/
 *          contents of the in-message body to be processed.
 * @param additionalHeaders
 *          additional in-message headers (can be <code>null</code>).
 * @param exchangePattern
 *          pattern of the exchange put into the route.
 * @return the resulting exchange.
 */
protected Exchange process(Object body, Map<String, Object> additionalHeaders,
        ExchangePattern exchangePattern) {
    Validate.notNull(consumer);
    MessageContext messageContext = new WebServiceContextImpl().getMessageContext();
    Exchange exchange = consumer.getEndpoint().createExchange(exchangePattern);

    // prepare input message & headers
    Message inputMessage = exchange.getIn();
    inputMessage.setBody(body);
    processIncomingHeaders(messageContext, inputMessage);
    if (additionalHeaders != null) {
        inputMessage.getHeaders().putAll(additionalHeaders);
    }

    // set Camel exchange property based on request encoding
    exchange.setProperty(Exchange.CHARSET_NAME, messageContext.get(org.apache.cxf.message.Message.ENCODING));

    // process
    consumer.process(exchange);

    // handle resulting message and headers
    Message resultMessage = Exchanges.resultMessage(exchange);
    processUserDefinedOutgoingHeaders(messageContext, resultMessage, false);

    // set response encoding based on Camel exchange property
    String responseEncoding = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
    if (responseEncoding != null) {
        messageContext.put(org.apache.cxf.message.Message.ENCODING, responseEncoding);
    }
    return exchange;
}

From source file:test.unit.be.e_contract.dssp.client.DigitalSignatureServiceTestPort.java

private String addAttachment(String mimetype, String contentId, byte[] data) {
    LOG.debug("adding attachment: " + contentId);
    DataSource dataSource = new ByteArrayDataSource(data, mimetype);
    DataHandler dataHandler = new DataHandler(dataSource);
    MessageContext messageContext = this.webServiceContext.getMessageContext();

    Map<String, DataHandler> outputMessageAttachments = (Map<String, DataHandler>) messageContext
            .get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
    outputMessageAttachments.put(contentId, dataHandler);
    messageContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, outputMessageAttachments);

    return contentId;
}