Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        StreamSource streamSourceReq = new StreamSource(is);
        assertNotNull(streamSourceReq);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
        StreamSource streamSourceReq1 = new StreamSource(is1);
        assertNotNull(streamSourceReq1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
        StreamSource streamSourceReq2 = new StreamSource(is2);
        assertNotNull(streamSourceReq2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
        StreamSource streamSourceReq3 = new StreamSource(is3);
        assertNotNull(streamSourceReq3);
       
       
   

        Dispatch<StreamSource> disp = service.createDispatch(portName,
                                                            StreamSource.class, Service.Mode.MESSAGE);
        StreamSource streamSourceResp = disp.invoke(streamSourceReq);
        assertNotNull(streamSourceResp);
        String expected = "Hello TestSOAPInputMessage";
        checkStreamSource(expected, streamSourceResp);
       
        disp.invokeOneWay(streamSourceReq1);
       
        Response response = disp.invokeAsync(streamSourceReq2);
        StreamSource streamSourceResp2 = (StreamSource)response.get();
        assertNotNull(streamSourceResp2);
        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
        checkStreamSource(expected3, streamSourceResp3);

    }
View Full Code Here


        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
        StreamSource streamSourceReq = new StreamSource(is);
        assertNotNull(streamSourceReq);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq1.xml");
        StreamSource streamSourceReq1 = new StreamSource(is1);
        assertNotNull(streamSourceReq1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq2.xml");
        StreamSource streamSourceReq2 = new StreamSource(is2);
        assertNotNull(streamSourceReq2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq3.xml");
        StreamSource streamSourceReq3 = new StreamSource(is3);
        assertNotNull(streamSourceReq3);

        Dispatch<StreamSource> disp = service.createDispatch(portName,
                                                            StreamSource.class, Service.Mode.PAYLOAD);
        StreamSource streamSourceResp = disp.invoke(streamSourceReq);
        assertNotNull(streamSourceResp);
        String expected = "Hello TestSOAPInputMessage";
        checkStreamSource(expected, streamSourceResp);
       
        disp.invokeOneWay(streamSourceReq1);
       
        Response response = disp.invokeAsync(streamSourceReq2);
        StreamSource streamSourceResp2 = (StreamSource)response.get();
        assertNotNull(streamSourceResp2);
        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
        checkStreamSource(expected3, streamSourceResp3);

    }
View Full Code Here

        if (aXmlInput instanceof Node) {
            // aXmlInput is a DOM object
            tXmlSource = new DOMSource((Node)aXmlInput);
        } else if (aXmlInput instanceof InputStream) {
            // aXmlInput is a InputStream (XML byte stream)
            tXmlSource = new StreamSource((InputStream)aXmlInput);
        } else if (aXmlInput instanceof Reader) {
            // aXmlInput is a Reader (XML character stream)
            tXmlSource = new StreamSource((Reader)aXmlInput);
        } else if (aXmlInput instanceof String) {
            // aXmlInput is an URL (conforming to the URI syntax)
            tXmlSource = new StreamSource((String)aXmlInput);
        } else {
            throw new IllegalArgumentException("HTMLwithXSLBuilder2::transform : Illegal argument for XML input");
        }

        if (aXslInput instanceof Node) {
            tXslSource = new DOMSource((Node)aXslInput);
        } else if (aXslInput instanceof InputStream) {
            tXslSource = new StreamSource((InputStream)aXslInput);
        } else if (aXslInput instanceof Reader) {
            tXslSource = new StreamSource((Reader)aXslInput);
        } else if (aXslInput instanceof String) {
            tXslSource = new StreamSource((String)aXslInput);
        } else {
            throw new IllegalArgumentException("HTMLwithXSLBuilder2::transform : Illegal argument for XSL input");
        }

        if (aHtmlOutput instanceof Node) {
View Full Code Here

      {
        XMLHelper.setTransformerProperties();

        TransformerFactory tFactory = TransformerFactory.newInstance();
        transformer = tFactory
            .newTransformer(new StreamSource(xslFile));
        mTransformers.put(Thread.currentThread().getName() + xslFile,
            transformer);
      }
    }
    catch (TransformerConfigurationException e)
View Full Code Here

  protected String transformXML(String xmlOld, String xslFile, Message message)
      throws XException
  {
    String xmlNew = null;
    StringReader source = new StringReader(xmlOld);
    StreamSource streamSource = new StreamSource(source);
    StringWriter result = new StringWriter();
    StreamResult streamResult = new StreamResult(result);

    try
    {
View Full Code Here

      {
        XMLHelper.setTransformerProperties();

        TransformerFactory tFactory = TransformerFactory.newInstance();
        transformer = tFactory
            .newTransformer(new StreamSource(xslFile));
        mTransformers.put(Thread.currentThread().getName() + xslFile,
            transformer);
      }
    }
    catch (TransformerConfigurationException e)
View Full Code Here

               
            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                src.writeTo(baos);
                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                obj = new StreamSource(bais);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }      
        return obj;       
View Full Code Here

                ((DOMSource)obj).setNode(doc);         
            } else if (SAXSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                InputSource inputSource = new InputSource(getSOAPBodyStream(doc));
                obj = new SAXSource(inputSource);
            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                obj = new StreamSource(getSOAPBodyStream(doc));
            } else if (Object.class.isAssignableFrom(callback.getSupportedFormats()[0])) {          
                JAXBContext context = callback.getJAXBContext();
                Unmarshaller u = context.createUnmarshaller();
                return u.unmarshal(doc);                   
            }
View Full Code Here

        context = JAXBEncoderDecoder.createJAXBContextForClass(Greeter.class);
        Method method = SOAPMessageUtil.getMethod(Greeter.class, "greetMe");
        wrapperAnnotation = method.getAnnotation(RequestWrapper.class);
       
        InputStream is =  getClass().getResourceAsStream("resources/StringStruct.xsd");
        StreamSource schemaSource = new StreamSource(is);
        assertNotNull(schemaSource);
        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        schema = factory.newSchema(schemaSource);
        assertNotNull(schema);
    }
View Full Code Here

            } else if (SAXSource.class.isAssignableFrom(obj.getClass())) {
                SAXSource saxSource = (SAXSource)obj;
                Document doc = getDocBuilder().parse(saxSource.getInputSource());
                dest.addDocument(doc);
            } else if (StreamSource.class.isAssignableFrom(obj.getClass())) {
                StreamSource streamSource = (StreamSource)obj;
                Document doc = getDocBuilder().parse(streamSource.getInputStream());
                dest.addDocument(doc);
            } else if (Object.class.isAssignableFrom(obj.getClass())) {
               
                JAXBContext context = callback.getJAXBContext();
               
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamSource

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.