Package org.apache.axiom.attachments

Examples of org.apache.axiom.attachments.ByteArrayDataSource


        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
                                                 "text/plain", fac);
        text.addAttribute(cType1);
        byte[] byteArray = new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                98 };
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMTextImpl textData = new OMTextImpl(dataHandler, false, fac);

        envelope.addChild(body);
        body.addChild(data);
        data.addChild(text);
View Full Code Here


        boundary = omOutput.getMimeBoundary();
        omOutput.setSOAP11(false);

        String contentType = omOutput.getContentType();
        DataHandler dataHandler;
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMText textData = factory.createOMText(dataHandler, true);
        assertNotNull(textData.getContentID());

        DataHandler dataHandler2 = new DataHandler(
                "Apache Software Foundation", "text/plain");
View Full Code Here

                        BytesMessage bm = (BytesMessage) message;
                        byte[] msgBytes = new byte[(int) bm.getBodyLength()];
                        bm.reset();
                        bm.readBytes(msgBytes);
                        DataHandler dataHandler = new DataHandler(
                            new ByteArrayDataSource(msgBytes));
                        OMText textData = soapFactory.createOMText(dataHandler, true);
                        wrapper.addChild(textData);
                        msgContext.setDoingMTOM(true);
                    } else {
                        handleException("Unsupported JMS Message format : " + message.getJMSType());
View Full Code Here

            wrapper.addChild(textData);

        } else {
            byte[] msgBytes = getMessageBinaryPayload(message);
            if (msgBytes != null) {
                DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(msgBytes));
                OMText textData = soapFactory.createOMText(dataHandler, true);
                if (wrapperQName == null) {
                    wrapperQName = BaseConstants.DEFAULT_BINARY_WRAPPER;
                }
                wrapper = soapFactory.createOMElement(wrapperQName, null);
View Full Code Here

          entry.addAttribute(TYPE, BYTE, attrNS);
          entry.setText(((Byte) o).toString());
        } else if (o instanceof byte[]) {
          entry.addAttribute(TYPE, BYTEARRAY, attrNS);
          OMText text = fac.createOMText(new DataHandler(
              new ByteArrayDataSource((byte[]) o)), true);
          entry.addChild(text);
        } else if (o instanceof Float) {
          entry.addAttribute(TYPE, FLOAT, attrNS);
          entry.setText(o.toString());
        } else if (o instanceof Double) {
View Full Code Here

                        BytesMessage bm = (BytesMessage) message;
                        byte[] msgBytes = new byte[(int) bm.getBodyLength()];
                        bm.reset();
                        bm.readBytes(msgBytes);
                        DataHandler dataHandler = new DataHandler(
                            new ByteArrayDataSource(msgBytes));
                        OMText textData = soapFactory.createOMText(dataHandler, true);
                        wrapper.addChild(textData);
                        msgContext.setDoingMTOM(true);
                    } else {
                        handleException("Unsupported JMS Message format : " + message.getJMSType());
View Full Code Here

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
        OMElement rpcWrapEle = fac.createOMElement("echoMTOMtoBase64", omNs);
        OMElement data = fac.createOMElement("data", omNs);
        byte[] byteArray = new byte[] { 13, 56, 65, 32, 12, 12, 7, 98 };
        DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        expectedTextData = new OMTextImpl(dataHandler, true, fac);
        data.addChild(expectedTextData);
        rpcWrapEle.addChild(data);
        return rpcWrapEle;
    }
View Full Code Here

        DataSource source = null;

        // Part two is attachment
        if (outputStream instanceof ByteArrayOutputStream) {
            source = new ByteArrayDataSource(((ByteArrayOutputStream) outputStream).toByteArray());
        }
        messageBodyPart = new MimeBase64BodyPart();
        messageBodyPart.setDataHandler(new DataHandler(source));
        messageBodyPart.setDisposition(Part.ATTACHMENT);
View Full Code Here

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
        OMElement rpcWrapEle = fac.createOMElement("mtomSample", omNs);
        data = fac.createOMElement("data", omNs);
        expectedDH = new DataHandler(
                new ByteArrayDataSource(new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                        98 }));
        OMElement subData = fac.createOMElement("subData", omNs);
        OMText textData = new OMTextImpl(expectedDH, fac);
        subData.addChild(textData);
        data.addChild(subData);
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
       
        //Create a DataSource from a String
        String string = "Sending a JAXB generated string object to Source Provider endpoint";
        stringDS = new ByteArrayDataSource(string.getBytes(),"text/plain");
     
        //Create a DataSource from an image
        File file = new File(imageResourceDir+File.separator+"test.jpg");
      ImageInputStream fiis = new FileImageInputStream(file);
      Image image = ImageIO.read(fiis);
View Full Code Here

TOP

Related Classes of org.apache.axiom.attachments.ByteArrayDataSource

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.