Package org.apache.servicemix.soap.core

Examples of org.apache.servicemix.soap.core.MessageImpl


public class StaxInInterceptorTest extends TestCase {

    private StaxInInterceptor interceptor = new StaxInInterceptor();
   
    public void testNullInput() {
        Message msg = new MessageImpl();
        interceptor.handleMessage(msg);
        assertNull(msg.getContent(XMLStreamReader.class));
    }
View Full Code Here


        interceptor.handleMessage(msg);
        assertNull(msg.getContent(XMLStreamReader.class));
    }
   
    public void testValidInput() throws Exception {
        Message msg = new MessageImpl();
        InputStream is = new ByteArrayInputStream("<hello/>".getBytes());
        msg.setContent(InputStream.class, is);
        interceptor.handleMessage(msg);
        XMLStreamReader reader = msg.getContent(XMLStreamReader.class);
        assertNotNull(reader);
        assertEquals(new QName("hello"), reader.getName());
    }
View Full Code Here

public class DomInInterceptorTest extends TestCase {

    private DomInInterceptor interceptor = new DomInInterceptor();
   
    public void testNullInput() {
        Message msg = new MessageImpl();
        interceptor.handleMessage(msg);
        assertNull(msg.getContent(Document.class));
    }
View Full Code Here

        interceptor.handleMessage(msg);
        assertNull(msg.getContent(Document.class));
    }
   
    public void testValidInput() throws Exception {
        Message msg = new MessageImpl();
        InputStream is = new ByteArrayInputStream("<hello/>".getBytes());
        msg.setContent(InputStream.class, is);
        interceptor.handleMessage(msg);
        Document doc = msg.getContent(Document.class);
        assertNotNull(doc);
        assertEquals("hello", doc.getDocumentElement().getLocalName());
    }
View Full Code Here

        wsdlMessage.setName(new QName("urn:test", "message"));
        wsdlOperation.setInput(wsdlMessage);

        String input = "<hello />";
       
        Message message = new MessageImpl();
        message.put(Operation.class, wsdlOperation);
        XMLStreamReader reader = StaxUtil.createReader(new ByteArrayInputStream(input.getBytes()));
        reader.nextTag();
        message.setContent(XMLStreamReader.class, reader);
       
        JbiInWsdl1Interceptor interceptor = new JbiInWsdl1Interceptor(true);
        interceptor.handleMessage(message);
        Source source = message.getContent(Source.class);
        assertNotNull(source);
        Document doc = DomUtil.parse(source);
        Element root = doc.getDocumentElement();
        assertEquals(JbiConstants.WSDL11_WRAPPER_NAMESPACE, root.getNamespaceURI());
        assertEquals(JbiConstants.WSDL11_WRAPPER_MESSAGE_LOCALNAME, root.getLocalName());
View Full Code Here

    public AbstractBinding() {
        operations = new HashMap<QName, T>();
    }
   
    public Message createMessage() {
        Message in = new MessageImpl();
        in.put(Binding.class, this);
        return in;
    }
View Full Code Here

        in.put(Binding.class, this);
        return in;
    }
   
    public Message createMessage(Message request) {
        Message out = new MessageImpl();
        out.put(Binding.class, this);
        out.put(Operation.class, request.get(Operation.class));
        return out;
    }
View Full Code Here

    public void testGetPerson() throws Exception {
        PhaseInterceptorChain phaseIn = new PhaseInterceptorChain();
        phaseIn.add(binding.getInterceptors(Phase.ServerIn));
       
        Message message = new MessageImpl();
        message.put(Binding.class, binding);
        message.put(MessageExchangeFactory.class, new MockExchangeFactory());
        message.getTransportHeaders().put(HttpConstants.REQUEST_URI, "http://localhost:8192/person/312?code=abc");
        message.getTransportHeaders().put(HttpConstants.REQUEST_METHOD, HttpConstants.METHOD_GET);
       
        phaseIn.doIntercept(message);

        MessageExchange me = message.getContent(MessageExchange.class);
        NormalizedMessage nm = message.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
View Full Code Here

   
    public void testUpdatePerson() throws Exception {
        PhaseInterceptorChain phaseIn = new PhaseInterceptorChain();
        phaseIn.add(binding.getInterceptors(Phase.ServerIn));
       
        Message message = new MessageImpl();
        message.put(Binding.class, binding);
        message.put(MessageExchangeFactory.class, new MockExchangeFactory());
        message.getTransportHeaders().put(HttpConstants.REQUEST_URI, "http://localhost:8192/person/312");
        message.getTransportHeaders().put(HttpConstants.REQUEST_METHOD, HttpConstants.METHOD_POST);
        message.setContent(InputStream.class, new ByteArrayInputStream("ssn=321&name=Nodet".getBytes()));
       
        phaseIn.doIntercept(message);

        MessageExchange me = message.getContent(MessageExchange.class);
        NormalizedMessage nm = message.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
View Full Code Here

   
    public void testAddPerson() throws Exception {
        PhaseInterceptorChain phaseIn = new PhaseInterceptorChain();
        phaseIn.add(binding.getInterceptors(Phase.ServerIn));
       
        Message message = new MessageImpl();
        message.put(Binding.class, binding);
        message.put(MessageExchangeFactory.class, new MockExchangeFactory());
        message.getTransportHeaders().put(HttpConstants.REQUEST_URI, "http://localhost:8192/person/312");
        message.getTransportHeaders().put(HttpConstants.REQUEST_METHOD, HttpConstants.METHOD_PUT);
        message.setContent(InputStream.class, new ByteArrayInputStream("ssn=321&name=Nodet".getBytes()));
       
        phaseIn.doIntercept(message);

        MessageExchange me = message.getContent(MessageExchange.class);
        NormalizedMessage nm = message.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
View Full Code Here

TOP

Related Classes of org.apache.servicemix.soap.core.MessageImpl

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.