Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMOutputFormat


            worker.getIs().close();
        } catch (IOException ignore) {}       
    }

    private void sendUsingOutputStream(MessageContext msgContext) throws AxisFault {
        OMOutputFormat format = Util.getOMOutputFormat(msgContext);
        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext);
        OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);

        if (msgContext.isServerSide()) {
            OutTransportInfo transportInfo =
View Full Code Here


                            org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING);
            if (charSet == null) {
                charSet = MessageContext.DEFAULT_CHAR_SET_ENCODING;
            }

            OMOutputFormat format = new OMOutputFormat();

            format.setSOAP11(msgContext.isSOAP11());
            format.setCharSetEncoding(charSet);
            // Check if msg is 'In-Reply-To' received message
            OutTransportInfo transportInfo = (OutTransportInfo) msgContext
                    .getProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO);

            if (transportInfo != null && transportInfo instanceof MailBasedOutTransportInfo) {
View Full Code Here

        }
    }

    public void writeMimeMessage(MessageContext msgContext, OutputStream out) throws AxisFault {
        try {
            OMOutputFormat format = new OMOutputFormat();
            MessageFormatter messageFormatter = TransportUtils
                    .getMessageFormatter(msgContext);
            format.setDoOptimize(msgContext.isDoingMTOM());
            //Set to null so that the code will not fail on 7bit.
            format.setCharSetEncoding(null);
            messageFormatter.writeTo(msgContext, format, out, false);
            out.flush();
        } catch (Exception e) {
            throw new AxisFault(e.getMessage(),e);
        }
View Full Code Here

     * @param msgContext the message context
     * @return the OMOutputFormat to be used
     */
    public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {

        OMOutputFormat format = new OMOutputFormat();
        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
        msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext));
        msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext));       
        format.setSOAP11(msgContext.isSOAP11());
        format.setDoOptimize(msgContext.isDoingMTOM());
        format.setDoingSWA(msgContext.isDoingSwA());

        format.setCharSetEncoding(HTTPTransportUtils.getCharSetEncoding(msgContext));
        Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
        if (mimeBoundaryProperty != null) {
            format.setMimeBoundary((String) mimeBoundaryProperty);
        }

        return format;
    }
View Full Code Here

     *
     * @param msgCtx message context
     * @return the content type
     */
    public static String getContentType(MessageContext msgCtx) {
        OMOutputFormat format = new OMOutputFormat();
        String soapActionString = getSOAPAction(msgCtx);
        String charSetEnc = (String) msgCtx.getProperty(
                Constants.Configuration.CHARACTER_SET_ENCODING);

        if (charSetEnc != null) {
            format.setCharSetEncoding(charSetEnc);
        } else {
            OperationContext opctx = msgCtx.getOperationContext();
            if (opctx != null) {
                charSetEnc = (String) opctx.getProperty(
                        Constants.Configuration.CHARACTER_SET_ENCODING);
            }
        }

        // If the char set enc is still not found use the default
        if (charSetEnc == null) {
            charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
        }

        format.setSOAP11(msgCtx.isSOAP11());
        format.setCharSetEncoding(charSetEnc);

        String encoding = format.getCharSetEncoding();
        String contentType = format.getContentType();

        if (encoding != null) {
            contentType += "; charset=" + encoding;
        }

View Full Code Here

       
        msg.setMTOMEnabled(true);
       
        SOAPEnvelope soapOM = (SOAPEnvelope) msg.getAsOMElement();
       
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        soapOM.serializeAndConsume(baos, format);

        TestLogger.logger.debug("==================================");
View Full Code Here

                    "OM".equals(m.getXMLPartContentType()));
       
        // Serialize the Envelope using the same mechanism as the
        // HTTP client.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        env.serializeAndConsume(baos, new OMOutputFormat());
       
        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        TestLogger.logger.debug(newText);
View Full Code Here

        assertTrue(((OMSourcedElementImpl)o).isExpanded() == false);
       
        // Serialize the Envelope using the same mechanism as the
        // HTTP client.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        env.serializeAndConsume(baos, new OMOutputFormat());
       
        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        TestLogger.logger.debug(newText);
View Full Code Here

        TestLogger.logger.debug("---------------------------------------");
        TestLogger.logger.debug("test: " + getName());
       
        OMElement payload = createPayload();
       
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        payload.serializeAndConsume(baos, format);

        TestLogger.logger.debug("==================================");
View Full Code Here

        SOAPEnvelope env = factory.createSOAPEnvelope();
        SOAPBody body = factory.createSOAPBody(env);
       
        body.addChild(payload);
       
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        env.serializeAndConsume(baos, format);

        TestLogger.logger.debug("==================================");
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMOutputFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.