Package org.codehaus.xfire.exchange

Examples of org.codehaus.xfire.exchange.InMessage


        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();
       
        assertEquals(fault.getMessage(), fault2.getMessage());
        assertEquals(fault.getSubCode(), fault2.getSubCode());
        assertEquals(fault.getFaultCode(), fault2.getFaultCode());
       
View Full Code Here


        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();
       
        assertEquals(XFireFault.SOAP11_SERVER, fault2.getFaultCode());
        assertEquals(fault.getMessage(), fault2.getMessage());
       
        assertNotNull(fault.getDetail().getChild("bah2", Namespace.getNamespace("urn:test2")));
View Full Code Here

        db.setEntityResolver(new NullResolver());
        doc = STAXUtils.read(db, reader, false);
       
        WSS4JInHandler inHandler = new WSS4JInHandler();

        InMessage inmsg = new InMessage();
        inmsg.setProperty(DOMInHandler.DOM_MESSAGE, doc);

        ctx.setCurrentMessage(inmsg);
        inHandler.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
        inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE, "META-INF/xfire/insecurity.properties");
View Full Code Here

    {
        OutMessage msg = new OutMessage("http://localhost:8081/PictureService");
        msg.setBody(STAXUtils.createXMLStreamReader(getResourceAsReader("GetPicture.xml")));
       
        // MTOM shouldn't work locally, but things should still work...
        InMessage res = invokeService(msg, HttpTransport.HTTP_BINDING);

        Attachments atts = res.getAttachments();
        Iterator parts = atts.getParts();
        assertTrue(parts.hasNext());
        Attachment att = (Attachment) parts.next();
       
        Document response = (Document) res.getProperty(RESPONSE);
        addNamespace("m", "http://xfire.codehaus.org/mtom");
        addNamespace("xop", "http://www.w3.org/2004/08/xop/include");
        assertValid("//s:Body/m:GetPictureResponse/m:image/xop:Include", response);
    }
View Full Code Here

        MessageContext ctx = new MessageContext();
        ctx.setXFire(xfire);
        ctx.setService(service);
        ctx.setProperty(Channel.BACKCHANNEL_URI, out);
        ctx.setExchange(new org.codehaus.xfire.exchange.MessageExchange(ctx));
        InMessage msg = new InMessage();
        ctx.getExchange().setInMessage(msg);
        if (exchange.getOperation() != null) {
            OperationInfo op = service.getServiceInfo().getOperation(exchange.getOperation().getLocalPart());
            if (op != null) {
                ctx.getExchange().setOperation(op);
            }
        }
        ctx.setCurrentMessage(msg);
        NormalizedMessage in = exchange.getMessage("in");
        msg.setXMLStreamReader(getXMLStreamReader(in.getContent()));
        if (in.getAttachmentNames() != null && in.getAttachmentNames().size() > 0) {
            JavaMailAttachments attachments = new JavaMailAttachments();
            for (Iterator it = in.getAttachmentNames().iterator(); it.hasNext();) {
                String name = (String) it.next();
                DataHandler dh = in.getAttachment(name);
                attachments.addPart(new SimpleAttachment(name, dh));
            }
            msg.setAttachments(attachments);
        }
        EndpointDeliveryChannel.setEndpoint(endpoint);
        JBIContext.setMessageExchange(exchange);
        if (isInAndOut(exchange)) {
            // TODO ?
View Full Code Here

                        XFireFault xfireFault = new XFireFault(str, XFireFault.RECEIVER);
                        xfireFault.getDetail().addContent(e);
                        throw xfireFault;
                    } else if (me.getMessage("out") != null) {
                        Source outSrc = me.getMessage("out").getContent();
                        InMessage inMessage = new InMessage(getTransformer().toXMLStreamReader(outSrc), getUri());
                        getEndpoint().onReceive(context, inMessage);
                        me.setStatus(ExchangeStatus.DONE);
                        channel.send(me);
                    }
                }
View Full Code Here

            Channel c = t.createChannel();
            MessageContext ctx = new MessageContext();
            ctx.setXFire(xfire);
            ctx.setService(service);
            ctx.setProperty(Channel.BACKCHANNEL_URI, out);
            InMessage msg = new InMessage();
            XMLStreamReader xmlStreamReader = null;
            try {
                xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(in.getContent());
            } catch (Exception e) {
                // ignore, as this method is not mandatory in stax
            }
            if (xmlStreamReader == null) {
                ByteArrayOutputStream buffer = new ByteArrayOutputStream();
                TransformerFactory.newInstance().newTransformer().transform(in.getContent(), new StreamResult(buffer));
                xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(buffer.toByteArray()));
            }
            msg.setXMLStreamReader(xmlStreamReader);
            c.receive(ctx, msg);
           
            // Set response or DONE status
            if (isInAndOut(me)) {
                NormalizedMessage outMsg = me.createMessage();
View Full Code Here

            public String getPhase() {
                return Phase.PARSE;
            }

            public void invoke(MessageContext context) throws Exception {
                InMessage message = context.getInMessage();
                XMLStreamReader reader = message.getXMLStreamReader();
                while (reader.hasNext()) {
                    int event = reader.next();
                    switch (event)
                    {
                        case XMLStreamReader.START_DOCUMENT:
                            String encoding = reader.getCharacterEncodingScheme();
                            message.setEncoding(encoding);
                            break;
                        case XMLStreamReader.END_DOCUMENT:
                            return;
                        case XMLStreamReader.START_ELEMENT:
                            return;
View Full Code Here

            {
                fail(messageExchange, new JBIException("Could not get source as XMLStreamReader."));
                return;
            }
           
            InMessage in = new InMessage(reader, "");
            MessageContext context = new MessageContext();
            context.setXFire(xfire);
            context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));

            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
View Full Code Here

    protected void process(MessageExchange messageExchange, NormalizedMessage nm)
            throws MessagingException {
        try {
            XMLStreamReader reader = marshaller.createStreamReader(nm);

            InMessage in = new InMessage(reader, "");
            MessageContext context = new MessageContext();
            context.setXFire(xfire);
            context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));

            Transport transport =
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.exchange.InMessage

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.