Package org.apache.axis2.jaxws.message.util

Examples of org.apache.axis2.jaxws.message.util.Reader2Writer


    }

    protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
            throws XMLStreamException {
        // Create a Reader2Writer converter and get the output as a String
        Reader2Writer r2w = new Reader2Writer(reader);
        return r2w.getAsString();
    }
View Full Code Here


        // The block should not be consumed yet...because the message has not been read
        assertTrue(!block.isConsumed());
       
        // To check that the output is correct, get the String contents of the
        // reader
        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReader());
        String newText = r2w.getAsString();
        TestLogger.logger.debug(newText);
        assertTrue(newText.contains(sampleText));
        assertTrue(newText.contains("soap"));
        assertTrue(newText.contains("Envelope"));
        assertTrue(newText.contains("Body"));
View Full Code Here

        // block should be consumed.
        OMElement om = m.getAsOMElement();
       
        // To check that the output is correct, get the String contents of the
        // reader
        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
        String newText = r2w.getAsString();
        TestLogger.logger.debug(newText);
        assertTrue(newText.contains(sampleText));
        assertTrue(newText.contains("soap"));
        assertTrue(newText.contains("Envelope"));
        assertTrue(newText.contains("Body"));
View Full Code Here

       
        Source outSource = dispatch.invoke(inSource);
       
        // Prepare the response content for checking
        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
        Reader2Writer r2w = new Reader2Writer(reader);
        String response = r2w.getAsString();
       
        assertTrue(response != null);
        assertTrue(request.equals(response));
       
        // Test a second time to verify
        stream = new ByteArrayInputStream(request.getBytes());
        inSource = new StreamSource((InputStream) stream);
       
        outSource = dispatch.invoke(inSource);
       
        // Prepare the response content for checking
        reader = inputFactory.createXMLStreamReader(outSource);
        r2w = new Reader2Writer(reader);
        response = r2w.getAsString();
       
        assertTrue(response != null);
        assertTrue(request.equals(response));
    }
View Full Code Here

        // this should work ok
        dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, "GET");
        Source outSource = dispatch.invoke(null);
       
        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
        Reader2Writer r2w = new Reader2Writer(reader);
        String response = r2w.getAsString();       
        assertEquals(GET_RESPONSE, response);    
       
        // this should fail again
        dispatch.getRequestContext().remove(MessageContext.HTTP_REQUEST_METHOD);
        try {
View Full Code Here

       
        Source outSource = dispatch.invoke(inSource);
       
        // Prepare the response content for checking
        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
        Reader2Writer r2w = new Reader2Writer(reader);
        String response = r2w.getAsString();
       
        assertTrue(response != null);
        assertTrue(request.equals(response));
       
        // Try a second time to verify
        stream = new ByteArrayInputStream(request.getBytes());
        inSource = new StreamSource((InputStream) stream);
       
        outSource = dispatch.invoke(inSource);
       
        // Prepare the response content for checking
        reader = inputFactory.createXMLStreamReader(outSource);
        r2w = new Reader2Writer(reader);
        response = r2w.getAsString();
       
        assertTrue(response != null);
        assertTrue(request.equals(response));
    }
View Full Code Here

            else if(Source.class.isAssignableFrom(res.getClass())){
                Source source = (Source) res;
               
                XMLInputFactory inputFactory = XMLInputFactory.newInstance();
                XMLStreamReader reader = inputFactory.createXMLStreamReader(source);
                Reader2Writer r2w = new Reader2Writer(reader);
                String responseText = r2w.getAsString();

                TestLogger.logger.debug(responseText);
            }
            TestLogger.logger.debug("---------------------------------------------");
        }catch(Exception e){
View Full Code Here

     * @param input
     * @return
     */
    private String createStringFromSource(Source input) throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(input);
        Reader2Writer r2w = new Reader2Writer(reader);
        String text = r2w.getAsString();
        return text;
    }
View Full Code Here

    Source response = dispatch.invoke(srcStream);
    assertNotNull(response);
       
        // Prepare the response content for checking
        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
        Reader2Writer r2w = new Reader2Writer(reader);
        String responseText = r2w.getAsString();
        TestLogger.logger.debug(responseText);
       
        // Check to make sure the content is correct
        assertTrue(!responseText.contains("soap"));
        assertTrue(!responseText.contains("Envelope"));
        assertTrue(!responseText.contains("Body"));
        assertTrue(responseText.contains("echoStringResponse"));    

        // Invoke a second time to verify
        stream = new ByteArrayInputStream(bytes);
        srcStream = new StreamSource((InputStream) stream);
       
        // Invoke the Dispatch<Source>
        TestLogger.logger.debug(">> Invoking sync Dispatch with PAYLOAD mode");
        response = dispatch.invoke(srcStream);
        assertNotNull(response);
       
        // Prepare the response content for checking
        reader = inputFactory.createXMLStreamReader(response);
        r2w = new Reader2Writer(reader);
        responseText = r2w.getAsString();
        TestLogger.logger.debug(responseText);
       
        // Check to make sure the content is correct
        assertTrue(!responseText.contains("soap"));
        assertTrue(!responseText.contains("Envelope"));
View Full Code Here

    StreamSource response = (StreamSource) dispatch.invoke(srcStream);
        assertNotNull(response);

        // Prepare the response content for checking
        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
        Reader2Writer r2w = new Reader2Writer(reader);
        String responseText = r2w.getAsString();
        TestLogger.logger.debug(responseText);
       
        // Check to make sure the content is correct
        assertTrue(responseText.contains("soap"));
        assertTrue(responseText.contains("Envelope"));
        assertTrue(responseText.contains("Body"));
        assertTrue(responseText.contains("echoStringResponse"))
       
        // Invoke a second time to verify
        stream = new ByteArrayInputStream(bytes);
        srcStream = new StreamSource((InputStream) stream);

        TestLogger.logger.debug(">> Invoking sync Dispatch with MESSAGE Mode");
        response = (StreamSource) dispatch.invoke(srcStream);
        assertNotNull(response);

        // Prepare the response content for checking
        reader = inputFactory.createXMLStreamReader(response);
        r2w = new Reader2Writer(reader);
        responseText = r2w.getAsString();
        TestLogger.logger.debug(responseText);
       
        // Check to make sure the content is correct
        assertTrue(responseText.contains("soap"));
        assertTrue(responseText.contains("Envelope"));
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.message.util.Reader2Writer

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.