protected boolean injectMessage(InputStream in, String contentType) { try { org.apache.synapse.MessageContext msgCtx = createMessageContext(); if (log.isDebugEnabled()) { log.debug("Processed Custom inbound EP Message of Content-type : " + contentType); } MessageContext axis2MsgCtx = ((org.apache.synapse.core.axis2.Axis2MessageContext) msgCtx).getAxis2MessageContext(); // Determine the message builder to use Builder builder; if (contentType == null) { log.debug("No content type specified. Using SOAP builder."); builder = new SOAPBuilder(); } else { int index = contentType.indexOf(';'); String type = index > 0 ? contentType.substring(0, index) : contentType; builder = BuilderUtil.getBuilderFromSelector(type, axis2MsgCtx); if (builder == null) { if (log.isDebugEnabled()) { log.debug("No message builder found for type '" + type + "'. Falling back to SOAP."); } builder = new SOAPBuilder(); } } OMElement documentElement = builder.processDocument(in, contentType, axis2MsgCtx); // Inject the message to the sequence. msgCtx.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement)); if (injectingSeq == null || injectingSeq.equals("")) { log.error("Sequence name not specified. Sequence : " + injectingSeq); return false; } SequenceMediator seq = (SequenceMediator) synapseEnvironment.getSynapseConfiguration().getSequence(injectingSeq); if (seq != null) { if (log.isDebugEnabled()) { log.debug("injecting message to sequence : " + injectingSeq); } seq.setErrorHandler(onErrorSeq); if (!seq.isInitialized()) { seq.init(synapseEnvironment); } if (!synapseEnvironment.injectInbound(msgCtx, seq, sequential)) { return false; } } else { log.error("Sequence: " + injectingSeq + " not found"); } } catch (Exception e) { log.error("Error while processing the Custom Inbound EP Message."); } return true; }