Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMElement.toStringWithConsume()


    // Deserialization approach 2: use an Axiom tree with caching. In this case the
    // XMLStreamReader implementation is OMStAXWrapper and we test interoperability
    // between ADB and Axiom's OMStAXWrapper.
    private static void testSerializeDeserializeUsingOMStAXWrapper(Object bean, Object expectedResult) throws Exception {
        OMElement omElement = ADBBeanUtil.getOMElement(bean);
        String omElementString = omElement.toStringWithConsume();
        OMElement omElement2 = OMXMLBuilderFactory.createOMBuilder(
                new StringReader(omElementString)).getDocumentElement();
        assertBeanEquals(expectedResult, ADBBeanUtil.parse(bean.getClass(), omElement2.getXMLStreamReader()));
    }
   
View Full Code Here


     * @throws Exception
     */
    public static void assertSerializationFailure(ADBBean bean) throws Exception {
        try {
            OMElement omElement = bean.getOMElement(ADBBeanUtil.getQName(bean.getClass()), OMAbstractFactory.getOMFactory());
            omElement.toStringWithConsume();
            fail("Expected ADBException");
        } catch (ADBException ex) {
            // OK: expected
        }
    }
View Full Code Here

        String topic = getTopic(messageContext);
        OMElement outputElement = null;
        OMElement header = getHeader(messageContext);
        ContextHeaderDocument document = null;
        try {
            document = ContextHeaderDocument.Factory.parse(header.toStringWithConsume());
        } catch (XMLStreamException e) {
            e.printStackTrace();
        } catch (XmlException e) {
            e.printStackTrace();
        }
View Full Code Here

        SOAPHeader header = context.getEnvelope().getHeader();
        OMElement contextHeader = header.getFirstChildWithName(new QName(
                "http://schemas.airavata.apache.org/workflow-execution-context", "context-header"));
        String address = null;
        try {
            ContextHeaderDocument document = ContextHeaderDocument.Factory.parse(contextHeader.toStringWithConsume());
            address = document.getContextHeader().getWorkflowMonitoringContext().getEventPublishEpr();
        } catch (XmlException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
        } catch (XMLStreamException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
View Full Code Here

    private String getTopic(MessageContext context) {
        OMElement contextHeader = getHeader(context);
        String topic = null;
        try {
            ContextHeaderDocument document = ContextHeaderDocument.Factory.parse(contextHeader.toStringWithConsume());
            topic = document.getContextHeader().getWorkflowMonitoringContext().getExperimentId();
        } catch (XmlException e) {
            e.printStackTrace();
        } catch (XMLStreamException e) {
            e.printStackTrace();
View Full Code Here

                                StAXOMBuilder builder = new StAXOMBuilder(reader);
                                outputElement.addChild(builder.getDocumentElement());
                            }
                            // Send notification
                            logger.info("outputMessage: " + outputElement.toString());
                            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
                            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement)outPut));
                        } else {
                            // An implementation of WSIFMessage,
                            // WSIFMessageElement, implements toString(), which
                            // serialize the message XML.
View Full Code Here

        if (topicEl != null) {
            if (topicEl.getChildElements().hasNext()) {
                OMElement widgetTopicOMEl = (OMElement) topicEl.getChildElements().next();
                String widgetTopicString = null;
                try {
                    widgetTopicString = widgetTopicOMEl.toStringWithConsume();
                } catch (XMLStreamException e) {
                    // TODO add with throws
                    e.printStackTrace();
                }
                String[] topicSubstrings = widgetTopicString.split(":");
View Full Code Here

            for (Iterator<OMElement> ite = referenceParametersMap.values().iterator(); ite.hasNext();) {
                OMElement currentReferenceParameter = ite.next();

                try {
                    buffer.append(currentReferenceParameter.toStringWithConsume());
                } catch (XMLStreamException se) {
                    logger.error("unable to convert reference parameter", se);
                }

            }
View Full Code Here

        dateOrDateTimeType.setObject(testObject);

        try {
            OMElement omElement = record2.getOMElement(Record2.MY_QNAME,
                     OMAbstractFactory.getOMFactory());
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM String ==> " + omElementString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            Record2 newRecord2 = Record2.Factory.parse(xmlReader);
            return newRecord2.getElem1().getObject();
        } catch (Exception e) {
View Full Code Here

        FooOpenEnum fooOpenEnum = new FooOpenEnum();
        record1.setElem1(fooOpenEnum);
        try {
            fooOpenEnum.setObject(testObject);
            OMElement omElement = record1.getOMElement(Record1.MY_QNAME, OMAbstractFactory.getOMFactory());
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM String ==> " + omElementString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            Record1 newRecord1 = Record1.Factory.parse(xmlReader);
            return newRecord1.getElem1().getObject();
        } catch (Exception e) {
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.