Examples of ParsedEntityReaderFactory


Examples of org.apache.axis2.jaxws.message.factory.ParsedEntityReaderFactory

         * 1) Use the the parser to fetch the inputStream
         * 2) Use the inputStream to create a DataSource, delay reading of content as much as you can.
         * 3) Use the OMFactory to create OMSourcedElement, OMSourcedElement is backed by ParsedEntityDataSource.
         */
        try{
            ParsedEntityReaderFactory perf = (ParsedEntityReaderFactory)FactoryRegistry.getFactory(ParsedEntityReaderFactory.class);
            ParsedEntityReader entityReader = perf.getParsedEntityReader();
            if (log.isDebugEnabled()) {
                log.debug("ParsedEntityReader = " + entityReader);
            }
            //Do not user custom builder if Parser does not have ability to read sub content.
            if(!entityReader.isParsedEntityStreamAvailable()){
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.ParsedEntityReaderFactory

    public void testOMElementDispatchWithParsedEntityReader() throws Exception {
       
        // Subsitute a ParsedEntityReader that will provide the
        // payload InputStream.  This simulates parsers that provide this
        // feature.
        ParsedEntityReaderFactory factory = (ParsedEntityReaderFactory)
        FactoryRegistry.getFactory(ParsedEntityReaderFactory.class);
        ParsedEntityReader per = new ParsedEntityReaderTest();
        factory.setParsetEntityReader(per);
       
        try {
            // Create the JAX-WS client needed to send the request
            Service service = Service.create(QNAME_SERVICE);
            service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING, URL_ENDPOINT);
            Dispatch<OMElement> dispatch = service.createDispatch(
                    QNAME_PORT, OMElement.class, Mode.MESSAGE);

            // Create the OMElement object with the payload contents.  Since
            // we're in PAYLOAD mode, we don't have to worry about the envelope.
            StringReader sr = new StringReader(sampleEnvelope);
            XMLStreamReader inputReader = inputFactory.createXMLStreamReader(sr);
            StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inputReader, null);
            SOAPEnvelope soap12Envelope = (SOAPEnvelope) builder.getDocumentElement();


            // Invoke
            OMElement response = dispatch.invoke(soap12Envelope);
           

            SOAPEnvelope responseEnv = (SOAPEnvelope) response;
            SOAPBody responseBody = responseEnv.getBody();
            OMElement payload = responseBody.getFirstElement();

            // At this point, the payload should be an OMSourcedElement
            // that was created from the ParsedEntityReader's stream
            assertTrue(payload instanceof OMSourcedElement);


            // Check to make sure the contents of the message are correct
            String responseText = payload.toStringWithConsume();
            assertTrue(responseText.contains("TEST RESPONSE"));
        } finally {
           
            // Uninstall the Test ParsedEntityReader
            factory.setParsetEntityReader(null);
        }
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.ParsedEntityReaderFactory

        table.put(ExecutorFactory.class, new JAXWSExecutorFactory());
        table.put(ServiceInstanceFactory.class, new ServiceInstanceFactoryImpl());
        table.put(InvocationControllerFactory.class, new InvocationControllerFactoryImpl());
        table.put(HandlerPreInvokerFactory.class, new HandlerPreInvokerFactoryImpl());
        table.put(HandlerPostInvokerFactory.class, new HandlerPostInvokerFactoryImpl());
        table.put(ParsedEntityReaderFactory.class, new ParsedEntityReaderFactory());
        // register the implementation responsible for both WebServiceContext
        // injection and the updating of the WebServiceContext instances that
        // have already been injected, we will register these by two different
        // classes because it is possible that the implementation is in different
        // classes
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.