}
public void onMessage(Message message) {
try {
contentType = (String) message.get(Message.CONTENT_TYPE);
SoapMessage soapMessage = new SoapMessage(message);
// create XmlStreamReader
BindingOperationInfo boi = providerEndpoint.getEndpointInfo()
.getBinding().getOperation(messageExchange.getOperation());
if (boi.getOperationInfo().isOneWay()) {
return;
}
XMLStreamReader xmlStreamReader = createXMLStreamReaderFromMessage(soapMessage);
soapMessage.setContent(XMLStreamReader.class, xmlStreamReader);
soapMessage
.put(org.apache.cxf.message.Message.REQUESTOR_ROLE, true);
Exchange cxfExchange = new ExchangeImpl();
soapMessage.setExchange(cxfExchange);
cxfExchange.put(BindingOperationInfo.class, boi);
cxfExchange.put(Endpoint.class, providerEndpoint.getCxfEndpoint());
// create Interceptor chain
PhaseChainCache inboundChainCache = new PhaseChainCache();
PhaseManager pm = providerEndpoint.getBus().getExtension(
PhaseManager.class);
List<Interceptor> inList = new ArrayList<Interceptor>();
inList.add(new JbiInWsdl1Interceptor());
PhaseInterceptorChain inChain = inboundChainCache.get(pm
.getInPhases(), inList);
inChain.add(providerEndpoint.getOutInterceptors());
inChain.add(providerEndpoint.getOutFaultInterceptors());
soapMessage.setInterceptorChain(inChain);
inChain.doIntercept(soapMessage);
if (boi.getOperationInfo().isOneWay()) {
messageExchange.setStatus(ExchangeStatus.DONE);
} else if (soapMessage.get("jbiFault") != null
&& soapMessage.get("jbiFault").equals(true)) {
Fault fault = messageExchange.createFault();
fault.setContent(soapMessage.getContent(Source.class));
messageExchange.setFault(fault);
} else if (messageExchange instanceof InOut) {
NormalizedMessage msg = messageExchange.createMessage();
msg.setContent(soapMessage.getContent(Source.class));
messageExchange.setMessage(msg, "out");
} else if (messageExchange instanceof InOptionalOut) {
if (soapMessage.getContent(Source.class) != null) {
NormalizedMessage msg = messageExchange.createMessage();
msg.setContent(soapMessage.getContent(Source.class));
messageExchange.setMessage(msg, "out");
} else {
messageExchange.setStatus(ExchangeStatus.DONE);
}
} else {