msg.setStringProperty("Content-Type", writer.getContentType());
    public void process(MessageExchange exchange) throws Exception {        if (exchange.getStatus() == ExchangeStatus.DONE) {            return;        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {            return;        }        SoapMessage soapMessage = new SoapMessage();        NormalizedMessage nm = exchange.getMessage("in");        soapHelper.getJBIMarshaler().fromNMS(soapMessage, nm);        SoapWriter writer = soapHelper.getSoapMarshaler().createWriter(soapMessage);        ByteArrayOutputStream baos = new ByteArrayOutputStream();        writer.write(baos);        Message msg = session.createTextMessage(baos.toString());        msg.setStringProperty("Content-Type", writer.getContentType());        Map headers = (Map) nm.getProperty(JbiConstants.PROTOCOL_HEADERS);        if (headers != null) {            for (Iterator it = headers.keySet().iterator(); it.hasNext();) {                String name = (String) it.next();                String value = (String) headers.get(name);                msg.setStringProperty(name, value);            }        }        if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {            synchronized (producer) {                producer.send(msg);            }            exchange.setStatus(ExchangeStatus.DONE);            channel.send(exchange);        } else if (exchange instanceof InOut) {            msg.setJMSCorrelationID(exchange.getExchangeId());            msg.setJMSReplyTo(replyToDestination);            pendingExchanges.put(exchange.getExchangeId(), exchange);            try {                synchronized (producer) {                    producer.send(msg);                }            } catch (Exception e) {                pendingExchanges.remove(exchange.getExchangeId());                throw e;            }        } else {            throw new IllegalStateException(exchange.getPattern() + " not implemented");        }    }