Examples of addDataHandler()


Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

    @Override
    protected XMLMessage prepareMessage() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement payload = factory.createOMElement(new QName("root"));
        Attachments attachments = new Attachments();
        attachments.addDataHandler(contentID, new DataHandler(new ByteArrayDataSource(attachmentContent, "application/octet-stream")));
        return new XMLMessage(payload, XMLMessage.Type.SWA, attachments);
    }

    @Override
    protected void checkMessageData(XMLMessage expected, XMLMessage actual) throws Exception {
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

    @Override
    protected XMLMessage prepareMessage() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement payload = factory.createOMElement(new QName("root"));
        Attachments attachments = new Attachments();
        attachments.addDataHandler(contentID, new DataHandler(new ByteArrayDataSource(attachmentContent, "application/octet-stream")));
        return new XMLMessage(payload, XMLMessage.Type.SWA, attachments);
    }

    @Override
    protected void checkMessageData(XMLMessage expected, XMLMessage actual) throws Exception {
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    if (!SAAJUtil.compareContentTypes(attachment.getContentType(), handler.getContentType())) {
                        ConfigurableDataHandler configuredHandler = new ConfigurableDataHandler(handler.getDataSource());
                        configuredHandler.setContentType(attachment.getContentType());
                        handler = configuredHandler;
                    }
                    attachments.addDataHandler(contentId, handler);
                }
                options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
            }
        }
       
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    throw new SOAPException("Attachment with NULL DataHandler");
                }
                if (contentId.startsWith("<") && contentId.endsWith(">")) {
                    contentId = contentId.substring(1, contentId.length()-1);
                }
                attachments.addDataHandler(contentId, dh);
            }
        }
        OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement();
        MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments);
        return builder.getSOAPEnvelope();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

        MessageContext mc = new MessageContext();
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(factory.getDefaultEnvelope());
        mc.setDoingSwA(true);
        Attachments attachments = mc.getAttachmentMap();
        attachments.addDataHandler("cid1@test.org", new DataHandler("test1", "text/plain"));
        attachments.addDataHandler("cid2@test.org", new DataHandler("test2", "text/plain"));
        mc.setProperty(Constants.Configuration.MM7_COMPATIBLE, true);
        OMOutputFormat format = new OMOutputFormat();
        format.setDoingSWA(true);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(factory.getDefaultEnvelope());
        mc.setDoingSwA(true);
        Attachments attachments = mc.getAttachmentMap();
        attachments.addDataHandler("cid1@test.org", new DataHandler("test1", "text/plain"));
        attachments.addDataHandler("cid2@test.org", new DataHandler("test2", "text/plain"));
        mc.setProperty(Constants.Configuration.MM7_COMPATIBLE, true);
        OMOutputFormat format = new OMOutputFormat();
        format.setDoingSWA(true);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        formatter.writeTo(mc, format, baos, true);
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    outMessage.setEnvelope(inMessage.getEnvelope());
                    Attachments inAttachments = inMessage.getAttachmentMap();
                    Attachments outAttachments = outMessage.getAttachmentMap();
                    for (String contentId : inAttachments.getAllContentIDs()) {
                        if (!contentId.equals(inAttachments.getSOAPPartContentID())) {
                            outAttachments.addDataHandler(contentId,
                                    inAttachments.getDataHandler(contentId));
                        }
                    }
                    outMessage.setDoingSwA(inMessage.isDoingSwA());
                    outMessage.setDoingMTOM(inMessage.isDoingMTOM());
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    if (!SAAJUtil.compareContentTypes(attachment.getContentType(), handler.getContentType())) {
                        ConfigurableDataHandler configuredHandler = new ConfigurableDataHandler(handler.getDataSource());
                        configuredHandler.setContentType(attachment.getContentType());
                        handler = configuredHandler;
                    }
                    attachments.addDataHandler(contentId, handler);
                }
                options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
            }
        }
       
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    throw new SOAPException("Attachment with NULL DataHandler");
                }
                if (contentId.startsWith("<") && contentId.endsWith(">")) {
                    contentId = contentId.substring(1, contentId.length()-1);
                }
                attachments.addDataHandler(contentId, dh);
            }
        }
        OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement();
        MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments);
        return builder.getSOAPEnvelope();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments.addDataHandler()

                    throw new SOAPException("Attachment with NULL DataHandler");
                }
                if (contentId.startsWith("<") && contentId.endsWith(">")) {
                    contentId = contentId.substring(1, contentId.length()-1);
                }
                attachments.addDataHandler(contentId, dh);
            }
        }
        OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement();
        MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments);
        return builder.getSOAPEnvelope();
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.