Package org.switchyard

Examples of org.switchyard.Message


    /**
     * {@inheritDoc}
     */
    @Override
    public Message compose(HttpBindingData source, Exchange exchange) throws Exception {
        final Message message = exchange.createMessage();

        getContextMapper().mapFrom(source, exchange.getContext(message));

        QName msgType = getMessageType(exchange);
        message.setContent(source.getBody());
        Object content;
        if ((msgType != null) && (QNameUtil.isJavaMessageType(msgType))) {
            // Hack - the getContent() call triggers a conversion from native content type and the result is set as the new body
            message.setContent(message.getContent(QNameUtil.toJavaMessageType(msgType)));
        }

        return message;
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    @Override
    public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception {
        final Message message = exchange.getMessage();
        if (message != null) {
            Object content = message.getContent();
            if (target instanceof HttpResponseBindingData) {
                Property responseCode = exchange.getContext().getProperty(HttpContextMapper.HTTP_RESPONSE_STATUS);
                if (!((responseCode != null) && responseCode.hasLabel(EndpointLabel.HTTP.label()))) {
                    int status = HttpServletResponse.SC_ACCEPTED;
                    if (exchange.getState() == ExchangeState.FAULT) {
View Full Code Here

           
        }

        @Override
        public void handleMessage(final Exchange exchange) throws HandlerException {
            final Message responseMessage = exchange.createMessage().setContent(_response);
            exchange.send(responseMessage);
        }
View Full Code Here

                    httpResponse.setContentType(new ContentType());
                }
                httpResponse.setBodyFromStream(entity.getContent());
            }
            httpResponse.setStatus(status);
            Message out = _messageComposer.compose(httpResponse, exchange);
            if (httpResponse.getStatus() < 400) {
                exchange.send(out);
            } else {
                exchange.sendFault(out);
            }
View Full Code Here

                        Thread.sleep(10000);
                    } catch (InterruptedException ie) {
                        //Ignore
            }}});
        try {
            Message responseMsg = _consumerService3.operation("sayHello").sendInOut(input);
        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("SocketTimeoutException: Read timed out"));
        }
View Full Code Here

        String output = "<test:sayHelloResponse xmlns:test=\"urn:switchyard-component-soap:test-ws:1.0\">"
                     + "   <return>Hello Magesh! The soapAction received is \"uri:something:that:needs#tobevalid\"</return>"
                     + "</test:sayHelloResponse>";


        Message responseMsg = _consumerService11.operation("sayHello").sendInOut(input);

        String response = toString(responseMsg.getContent(Node.class));
        XMLAssert.assertXMLEqual(output, response);
    }
View Full Code Here

        String output = "<test:sayHelloResponse xmlns:test=\"urn:switchyard-component-soap:test-ws:1.0\">"
                     + "   <return>Hello Magesh! The soapAction received is application/soap+xml; charset=utf-8; action=\"uri:soap12:that:needs#tobevalid\"</return>"
                     + "</test:sayHelloResponse>";


        Message responseMsg = _consumerService12.operation("sayHello").sendInOut(input);

        String response = toString(responseMsg.getContent(Node.class));
        XMLAssert.assertXMLEqual(output, response);
    }
View Full Code Here

                        + "      <message>Looks like you did not specify a name!</message>"
                        + "      <errorcode>1000</errorcode>"
                        + "   </detail>"
                        + "</SOAP-ENV:Fault>";

        Message responseMsg = _consumerService11.operation("sayHello").sendInOut(input);
        String response = toString(responseMsg.getContent(Node.class));
        XMLAssert.assertXMLEqual(output, response);
    }
View Full Code Here

                        +    "<detail>"
                        +    faultString
                        +    "</detail>"
                        + "</SOAP-ENV:Fault>";

        Message responseMsg = _consumerService11.operation("sayHello").sendInOut(input);
        String response = toString(responseMsg.getContent(Node.class));
        XMLAssert.assertXMLEqual(output, response);
    }
View Full Code Here

            SecurityContext securityContext = _securityContextManager.getContext(exchange);
            securityContext.getCredentials().addAll(credentials);
            securityContext.getCredentials().addAll(soapBindingData.extractCredentials());
            _securityContextManager.setContext(exchange, securityContext);

            Message message;
            try {
                message = _messageComposer.compose(soapBindingData, exchange);
            } catch (Exception e) {
                throw e instanceof SOAPException ? (SOAPException)e : new SOAPException(e);
            }
View Full Code Here

TOP

Related Classes of org.switchyard.Message

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.