Examples of Attachments


Examples of org.apache.axiom.attachments.Attachments

   
    public void test() throws Exception {
        Attachments[] attachments = new Attachments[2];
        XMLStreamReader[] soapPartReader = new XMLStreamReader[2];
        for (int i=0; i<2; i++) {
            attachments[i] = new Attachments(getTestResource(TestConstants.MTOM_MESSAGE.getName()),
                    TestConstants.MTOM_MESSAGE.getContentType());
            soapPartReader[i] = StAXUtils.createXMLStreamReader(attachments[i].getRootPartInputStream());
        }
        XMLStreamReader actual = new XOPEncodingStreamReader(new XOPDecodingStreamReader(soapPartReader[1], new OMAttachmentAccessorMimePartProvider(attachments[1])), contentIDGenerator, OptimizationPolicy.DEFAULT);
        new XMLStreamReaderComparator(soapPartReader[0], actual).compare();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

import org.apache.axiom.testutils.stax.XMLStreamReaderComparator;
import org.apache.axiom.util.base64.Base64Utils;

public class XOPDecodingStreamReaderTest extends AbstractTestCase {
    private XMLStreamReader getXOPDecodingStreamReader() throws Exception {
        Attachments attachments = new Attachments(getTestResource(TestConstants.MTOM_MESSAGE.getName()),
                TestConstants.MTOM_MESSAGE.getContentType());
        return new XOPDecodingStreamReader(
                StAXUtils.createXMLStreamReader(attachments.getRootPartInputStream()),
                new OMAttachmentAccessorMimePartProvider(attachments));
    }
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        orgEnvelope.serialize(out, format);
        assertFalse(element.isExpanded());
       
        // Parse the serialized message
        Attachments att = new Attachments(new ByteArrayInputStream(out.toByteArray()), format.getContentType());
        assertEquals(2, att.getAllContentIDs().length);
        SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(att).getSOAPEnvelope();
        OMElement contentElement = envelope.getBody().getFirstElement().getFirstChildWithName(
                new QName("http://ws.apache.org/axiom/test/jaxb", "content"));
        OMText content = (OMText)contentElement.getFirstOMChild();
        assertTrue(content.isBinary());
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

    public AxiomSoapMessage(SOAPFactory soapFactory, boolean payloadCaching, boolean langAttributeOnSoap11FaultString) {
        SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
        axiomFactory = soapFactory;
      axiomMessage = axiomFactory.createSOAPMessage();
      axiomMessage.setSOAPEnvelope(soapEnvelope);
        attachments = new Attachments();
        this.payloadCaching = payloadCaching;
        this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
        soapAction = EMPTY_SOAP_ACTION;
    }
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

     */
    public AxiomSoapMessage(SOAPMessage soapMessage,
                            String soapAction,
                            boolean payloadCaching,
                            boolean langAttributeOnSoap11FaultString) {
        this(soapMessage, new Attachments(), soapAction, payloadCaching, langAttributeOnSoap11FaultString);
    }
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

       
        // Get a new builder.  Use an xop aware builder if the original
        // builder is xop aware
        StAXOMBuilder newBuilder = null;
        if (builder instanceof XOPBuilder) {
            Attachments attachments = ((XOPBuilder)builder).getAttachments();
            attachments.getAllContentIDs();
            if (xmlStreamReader instanceof OMXMLStreamReader) {
                if (log.isDebugEnabled()) {
                    log.debug("  read optimized xop:include");
                }
                ((OMXMLStreamReader)xmlStreamReader).setInlineMTOM(false);
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

            getFirstChildWithName(new QName("http://services.samples", "request")).
            getFirstChildWithName(new QName("http://services.samples", "imageId")).
            getText();

        MessageContext msgCtx   = MessageContext.getCurrentMessageContext();
        Attachments attachment  = msgCtx.getAttachmentMap();
        DataHandler dataHandler = attachment.getDataHandler(imageContentId);
        File tempFile = File.createTempFile("swa-", ".gif");
        FileOutputStream fos = new FileOutputStream(tempFile);
        dataHandler.writeTo(fos);
    fos.flush();
    fos.close();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

                getFirstChildWithName(new QName("http://services.samples", "uploadFileUsingSwAResponse")).
                getFirstChildWithName(new QName("http://services.samples", "response")).
                getFirstChildWithName(new QName("http://services.samples", "imageId")).
                getText();

        Attachments attachment = response.getAttachmentMap();
        dataHandler = attachment.getDataHandler(imageContentId);
        File tempFile = File.createTempFile("swa-", ".gif");
        FileOutputStream fos = new FileOutputStream(tempFile);
        dataHandler.writeTo(fos);
        fos.flush();
        fos.close();
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

        OutputStream out = blob.getOutputStream();
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        createTestDocument(dh).serialize(out, format);
        out.close();
        Attachments attachments = new Attachments(blob.getInputStream(), format.getContentType());
        test(dh, new XOPAwareStAXOMBuilder(attachments.getRootPartInputStream(), attachments), false, true, true);
    }
View Full Code Here

Examples of org.apache.axiom.attachments.Attachments

        request.serialize(out, format);
        out.close();
       
        // Get the SOAP response
        InputStream in = connection.getInputStream();
        Attachments attachments = new Attachments(in, connection.getContentType());
        SOAPEnvelope response = OMXMLBuilderFactory.createSOAPModelBuilder(attachments).getSOAPEnvelope();
        OMElement retrieveContentResponse = response.getBody().getFirstElement();
        OMElement content = retrieveContentResponse.getFirstElement();
        // Extract the DataHandler representing the optimized binary data
        DataHandler dh = (DataHandler)((OMText)content.getFirstOMChild()).getDataHandler();
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.