public void handleMessage()

in bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java [65:146]


    public void handleMessage(SoapMessage message) {
        try {
            Source source = message.getContent(Source.class);
            if (source == null) {
                return;
            }
            
            Element element = new SourceTransformer().toDOMElement(source);
            XMLStreamWriter xmlWriter = message
                .getContent(XMLStreamWriter.class);
            
            if (!useJBIWrapper) {
                SoapVersion soapVersion = message.getVersion();                
                if (element != null) {                                                      
                    // if this message is coming from the CxfBCConsumer
                    Element bodyElement = null;
                    if (useSOAPWrapper) {
                    	bodyElement = (Element) element.getElementsByTagNameNS(
                            element.getNamespaceURI(),
                            soapVersion.getBody().getLocalPart()).item(0);
                    }
                    if (bodyElement != null) {
                        StaxUtils.writeElement(DomUtil.getFirstChildElement(bodyElement), xmlWriter, true);                           
                    } else {
                        // if this message is coming from the CxfBCProvider 
                        StaxUtils.writeElement(element, xmlWriter, true);
                    }
                }
                return;
            }
            
            if (!JbiConstants.WSDL11_WRAPPER_NAMESPACE.equals(element
                    .getNamespaceURI())
                    || !JbiConstants.WSDL11_WRAPPER_MESSAGE_LOCALNAME
                            .equals(element.getLocalName())) {
                throw new Fault(new Exception("Message wrapper element is '"
                        + QNameUtil.toString(element) + "' but expected '{"
                        + JbiConstants.WSDL11_WRAPPER_NAMESPACE + "}message'"));
            }
            BindingOperationInfo bop = message.getExchange().get(
                    BindingOperationInfo.class);
            if (bop == null) {
                throw new Fault(
                        new Exception("Operation not bound on this message"));
            }
            BindingMessageInfo msg = isRequestor(message) ? bop.getInput()
                    : bop.getOutput();

            
            SoapBindingInfo binding = (SoapBindingInfo) message.getExchange()
                    .get(Endpoint.class).getEndpointInfo().getBinding();
            String style = binding.getStyle(bop.getOperationInfo());
            if (style == null) {
                style = binding.getStyle();
            }

            if ("rpc".equals(style)) {
                addOperationNode(message, xmlWriter);
                getRPCPartWrapper(msg, element, message, xmlWriter);
            } else {
                Element partWrapper = DomUtil.getFirstChildElement(element);
                while (partWrapper != null) {
                    List<NodeList> partsContent = getPartsContent(message, element, partWrapper, msg); 
                    for (NodeList nl : partsContent) {
                        for (int i = 0; i < nl.getLength(); i++) {
                            Node n = nl.item(i);                            
                            StaxUtils.writeNode(n, xmlWriter, true);
                        }
                    }
                    partWrapper = DomUtil.getNextSiblingElement(partWrapper);
                }
            }

            if ("rpc".equals(style)) {
                xmlWriter.writeEndElement();
            }
        } catch (Fault e) {
            throw e;
        } catch (Exception e) {
            throw new Fault(e);
        }
    }