Package org.codehaus.xfire

Examples of org.codehaus.xfire.MessageContext


        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(out, "UTF-8",null);
        writer.writeStartDocument();
        writer.writeStartElement("soap", "Body", Soap12.getInstance().getNamespace());
        writer.setPrefix("soap", Soap12.getInstance().getNamespace());
        writer.writeNamespace("soap", Soap12.getInstance().getNamespace());
        soap12.writeMessage(message, writer, new MessageContext());
        writer.writeEndElement();
        writer.writeEndDocument();
        writer.close();
       
        Document doc = readDocument(out.toString());
        //printNode(doc);
        addNamespace("s", Soap12.getInstance().getNamespace());
        assertValid("//s:SubCode/s:Value[text()='m:NotAvailable']", doc);
        addNamespace("t", "urn:test2");
        assertValid("//s:Detail/t:bah2[text()='bleh']", doc);
        assertValid("//s:Role[text()='http://someuri']", doc);
       
        XMLStreamReader reader = readerForString(out.toString());
        InMessage inMsg = new InMessage(reader);
       
        while (reader.hasNext())
        {
            reader.next();
           
            if (reader.getEventType() == XMLStreamReader.START_ELEMENT
                    && reader.getLocalName().equals("Fault"))
            {
                break;
            }
        }
       
        soap12.readMessage(inMsg, new MessageContext());
       
        assertNotNull(inMsg.getBody());
        assertTrue(inMsg.getBody() instanceof XFireFault);
        XFireFault fault2 = (XFireFault) inMsg.getBody();
       
View Full Code Here


       
        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(out, "UTF-8",null);
        writer.writeStartDocument();
        writer.writeStartElement("soap", "Body", Soap11.getInstance().getNamespace());
        writer.writeNamespace("soap", Soap11.getInstance().getNamespace());
        soap11.writeMessage(message, writer, new MessageContext());
        writer.writeEndElement();
        writer.writeEndDocument();
        writer.close();

        Document doc = readDocument(out.toString());

        addNamespace("s", Soap12.getInstance().getNamespace());
        addNamespace("t", "urn:test2");
        assertValid("//detail/t:bah2[text()='bleh']", doc);
        assertValid("//faultactor[text()='http://someuri']", doc);
       
        XMLStreamReader reader = readerForString(out.toString());
        InMessage inMsg = new InMessage(reader);
       
        soap11.readMessage(inMsg, new MessageContext());
       
        assertNotNull(inMsg.getBody());
        assertTrue(inMsg.getBody() instanceof XFireFault);
        XFireFault fault2 = (XFireFault) inMsg.getBody();
       
View Full Code Here

       
        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(out, "UTF-8",null);
        writer.writeStartDocument();
        writer.writeStartElement("soap", "Body", Soap11.getInstance().getNamespace());
        writer.writeNamespace("soap", Soap11.getInstance().getNamespace());
        soap11.writeMessage(message, writer, new MessageContext());
        writer.writeEndElement();
        writer.writeEndDocument();
        writer.close();

        Document doc = readDocument(out.toString());
View Full Code Here

       
        XMLStreamWriter writer = STAXUtils.createXMLStreamWriter(out, "UTF-8",null);
        writer.writeStartDocument();
        writer.writeStartElement("soap", "Body", Soap12.getInstance().getNamespace());
        writer.writeNamespace("soap", Soap12.getInstance().getNamespace());
        soap11.writeMessage(message, writer, new MessageContext());
        writer.writeEndElement();
        writer.writeEndDocument();
        writer.close();

        Document doc = readDocument(out.toString());
View Full Code Here

        XmlBeansType type = new XmlBeansType(WeatherData.class);
       
        Map nsmap = new HashMap();
        nsmap.put("xsd", SoapConstants.XSD);
       
        MessageContext context = new MessageContext();
        context.setProperty(ReadHeadersHandler.DECLARED_NAMESPACES, nsmap);
       
        type.readObject(new ElementReader(getResourceAsStream("/org/codehaus/xfire/xmlbeans/undeclaredns.xml")),
                        context);
    }
View Full Code Here

        tm.register(type);
       
        Element root = new Element("root");
        JDOMWriter writer = new JDOMWriter(root);
       
        type.writeObject(smallEnum.VALUE1, writer, new MessageContext());
       
        assertEquals("VALUE1", root.getValue());
       
        JDOMReader reader = new JDOMReader(root);
        Object value = type.readObject(reader, new MessageContext());
       
        assertEquals(smallEnum.VALUE1, value);
    }
View Full Code Here

        tm.register(type);
       
        Element root = new Element("root");
        JDOMWriter writer = new JDOMWriter(root);
       
        type.writeObject(new EnumBean(), writer, new MessageContext());

        JDOMReader reader = new JDOMReader(root);
        Object value = type.readObject(reader, new MessageContext());
       
        assertTrue(value instanceof EnumBean);
        EnumBean bean = (EnumBean) value;
        assertNull(bean.getCurrency());
    }
View Full Code Here

        PhaseHandler handler1 = new PhaseHandler(Phase.TRANSPORT);
        PhaseHandler handler2 = new PhaseHandler(Phase.PARSE);
        handlerPipeline.addHandler(handler1);
        handlerPipeline.addHandler(handler2);

        handlerPipeline.invoke(new MessageContext());

        assertTrue(handler1.isInvoked());
        assertTrue(handler2.isInvoked());
    }
View Full Code Here

        phases.add(new Phase(Phase.PARSE, 100));
        phases.add(new Phase(Phase.PRE_DISPATCH, 100));
        phases.add(new Phase(Phase.DISPATCH, 500));
        phases.add(new Phase(Phase.USER, 500));

        MessageContext context = new MessageContext();
        handlerPipeline = new HandlerPipeline(phases);
       
        PauseHandler handler1 = new PauseHandler(Phase.TRANSPORT);
        PhaseHandler handler2 = new PhaseHandler(Phase.PARSE);
        handlerPipeline.addHandler(handler1);
        handlerPipeline.addHandler(handler2);
        context.setInPipeline(handlerPipeline);
       
        handlerPipeline.invoke(context);
        Stack invoked = (Stack) context.getProperty(handlerPipeline.toString());
       
        assertTrue(handler1.isInvoked());
        assertTrue(invoked.contains(handler1));
        assertFalse(handler2.isInvoked());
        assertFalse(invoked.contains(handler2));
       
        context.getCurrentPipeline().resume(context);
       
        assertTrue(handler1.isInvoked());
        assertTrue(invoked.contains(handler1));
        assertTrue(handler2.isInvoked());
        assertTrue(invoked.contains(handler2));
View Full Code Here

    public void testFactoryConfig()
        throws Exception
    {
        String xml = "<root><foo><![CDATA[data]]></foo></root>";

        MessageContext ctx = new MessageContext();
        ctx.setProperty(XFire.STAX_INPUT_FACTORY, MyInputFactory.class.getName());
        ctx.setProperty(XMLInputFactory.IS_COALESCING, "false");
        XMLStreamReader xmlReader = STAXUtils.createXMLStreamReader(new StringReader(xml), ctx);

        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        XMLStreamWriter xmlWriter = STAXUtils.createXMLStreamWriter(outStream, null, null);
        STAXUtils.copy(xmlReader, xmlWriter);
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.MessageContext

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.