Examples of OMOutputFormat


Examples of org.apache.axiom.om.OMOutputFormat

        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(payload));
       
      
        // Test getting the raw bytes with the default encoding
        OMOutputFormat outputFormat = new OMOutputFormat();
        baos = new ByteArrayOutputStream();
        ds.serialize(baos, outputFormat);
        output = baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
//        System.out.println(output);
        assertTrue("The obtained bytes did not match the payload",
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
       
        // Return the byte array directly if it is the same encoding
        // Otherwise convert the bytes to the proper encoding
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OMOutputFormat format = new OMOutputFormat();
        format.setCharSetEncoding(encoding);
        try {
            serialize(baos, format);
        } catch (XMLStreamException e) {
            throw new OMException(e);
        }
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

        xmlWriter.flush();
    }

    public final byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OMOutputFormat format = new OMOutputFormat();
        format.setCharSetEncoding(encoding);
        try {
            serialize(baos, format);
        } catch (XMLStreamException ex) {
            throw new OMException(ex);
        }
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

    public final XMLStreamReader getReader() throws XMLStreamException {
        // Note: we don't actually expect this code to be called because OMSourcedElement should handle
        // AbstractPushOMDataSource instances differently. Nevertheless the code is functionally correct
        // (but not very good from a performance point of view, especially for XOP).
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        serialize(bos, new OMOutputFormat());
        return StAXUtils.createXMLStreamReader(new ByteArrayInputStream(bos.toByteArray()));
    }
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

        if (os != null) {
          if (log.isDebugEnabled()) {
                log.debug("serialize OutputStream optimisation: true");
            }
            String encoding = getCharacterEncoding(xmlWriter);
            OMOutputFormat format = new OMOutputFormat();
            format.setCharSetEncoding(encoding);
            serialize(os, format);
        } else {
          if (log.isDebugEnabled()) {
                log.debug("serialize OutputStream optimisation: false");
            }
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

        String text = null;
       
        if (msg != null) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                OMOutputFormat format = new OMOutputFormat();
                String charSetEncoding = (String) mc.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
                charSetEncoding = (charSetEncoding == null) ? "UTF-8" : charSetEncoding;
                format.setCharSetEncoding(charSetEncoding);
                MTOMXMLStreamWriter writer  = new MTOMXMLStreamWriter(baos, format);
                msg.outputTo(writer, false);
                writer.flush();
                text =  baos.toString(charSetEncoding);
            } catch (Throwable t) {
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

        // for JMS but just get the payload in its native format
        String jmsPayloadType = guessMessageType(msgContext);

        if (jmsPayloadType == null) {

            OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext);
            MessageFormatter messageFormatter = null;
            try {
                messageFormatter = TransportUtils.getMessageFormatter(msgContext);
            } catch (AxisFault axisFault) {
                throw new JMSException("Unable to get the message formatter to use");
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

    public XMLStreamReader getReader() throws XMLStreamException {
        // FIXME: [rfeng] This is a quick and dirty implementation
        // We could use the fastinfoset to optimize the roundtrip
        StringWriter writer = new StringWriter();
        serialize(writer, new OMOutputFormat());
        StringReader reader = new StringReader(writer.toString());
        return StAXUtils.createXMLStreamReader(reader);
    }
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

*/
public class AsyncHTTPSender extends AbstractHandler implements TransportSender {

    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

        OMOutputFormat format = new OMOutputFormat();
        String charSetEnc = (String) msgContext.getProperty(
            Constants.Configuration.CHARACTER_SET_ENCODING);

        if (charSetEnc != null) {
            format.setCharSetEncoding(charSetEnc);
        } else {
            OperationContext opctx = msgContext.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;
        }

        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
        msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext));
        format.setSOAP11(msgContext.isSOAP11());
        format.setDoOptimize(msgContext.isDoingMTOM());
        format.setCharSetEncoding(charSetEnc);

        // Trasnport URL can be different from the WSA-To. So processing
        // that now.
        EndpointReference epr = null;
        String transportURL = (String) msgContext.getProperty(
View Full Code Here

Examples of org.apache.axiom.om.OMOutputFormat

    writeTo(new OutputStreamWriter(out));
  }

  public void writeTo(java.io.Writer writer) throws IOException {
    try {     
      OMOutputFormat outputFormat = new OMOutputFormat();
      if (this.getCharsetEncoding() != null)
        outputFormat.setCharSetEncoding(this.getCharsetEncoding());
      MTOMXMLStreamWriter omwriter =
        new MTOMXMLStreamWriter(
          StAXUtils.createXMLStreamWriter(writer));
      omwriter.setOutputFormat(outputFormat);
      this.internalSerialize(omwriter);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.