Package org.springframework.ws.transport

Examples of org.springframework.ws.transport.TransportInputStream


    }

    private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException {
        MimeHeaders mimeHeaders = new MimeHeaders();
        if (inputStream instanceof TransportInputStream) {
            TransportInputStream transportInputStream = (TransportInputStream) inputStream;
            for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) {
                String headerName = headerNames.next();
                for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) {
                    String headerValue = headerValues.next();
                    StringTokenizer tokenizer = new StringTokenizer(headerValue, ",");
                    while (tokenizer.hasMoreTokens()) {
                        mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim());
                    }
View Full Code Here


        PayloadValidatingInterceptor interceptor = new PayloadValidatingInterceptor();
        interceptor.setSchema(new ClassPathResource("codexws.xsd", getClass()));
        interceptor.afterPropertiesSet();

        Resource resource = new ClassPathResource("axiom.xml", getClass());
        TransportInputStream tis = new MockTransportInputStream(resource.getInputStream());
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        MessageContext context = new DefaultMessageContext(message, messageFactory);
        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid response from interceptor", result);
View Full Code Here

        PayloadValidatingInterceptor interceptor = new PayloadValidatingInterceptor();
        interceptor.setSchema(new ClassPathResource("multipleNamespaces.xsd", getClass()));
        interceptor.afterPropertiesSet();

        Resource resource = new ClassPathResource("multipleNamespaces.xml", getClass());
        TransportInputStream tis = new MockTransportInputStream(resource.getInputStream());
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        MessageContext context = new DefaultMessageContext(message, messageFactory);
        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid response from interceptor", result);
View Full Code Here

        messageFactory.afterPropertiesSet();

        String xml = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body>" +
                "<root xmlns='http://springframework.org/spring-ws'><child /></root>" +
                "</soapenv:Body></soapenv:Envelope>";
        TransportInputStream tis = new MockTransportInputStream(new ByteArrayInputStream(xml.getBytes()));
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);

        StringResult result = new StringResult();
        transformer.transform(message.getPayloadSource(), result);
        transformer.transform(message.getPayloadSource(), result);
View Full Code Here

        messageFactory.afterPropertiesSet();

        String xml = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body>" +
                "<root xmlns='http://springframework.org/spring-ws'><child /></root>" +
                "</soapenv:Body></soapenv:Envelope>";
        TransportInputStream tis = new MockTransportInputStream(new ByteArrayInputStream(xml.getBytes()));
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);

        StringResult result = new StringResult();
        transformer.transform(message.getPayloadSource(), result);
        try {
View Full Code Here

    }

    private static MultiValueMap<String, String> parseMimeHeaders(InputStream inputStream) throws IOException {
        MultiValueMap<String, String> mimeHeaders = new LinkedMultiValueMap<String, String>();
        if (inputStream instanceof TransportInputStream) {
            TransportInputStream transportInputStream = (TransportInputStream) inputStream;
            for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) {
                String headerName = headerNames.next();
                for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName);
                     headerValues.hasNext();) {
                    String headerValue = headerValues.next();
                    StringTokenizer tokenizer = new StringTokenizer(headerValue, ",");
                    while (tokenizer.hasMoreTokens()) {
                        mimeHeaders.add(headerName, tokenizer.nextToken().trim());
View Full Code Here

        Assert.isInstanceOf(TransportInputStream.class, inputStream,
                "AxiomSoapMessageFactory requires a TransportInputStream");
      if (inputFactory == null) {
        inputFactory = createXmlInputFactory();
      }
        TransportInputStream transportInputStream = (TransportInputStream) inputStream;
        String contentType = getHeaderValue(transportInputStream, TransportConstants.HEADER_CONTENT_TYPE);
        if (!StringUtils.hasLength(contentType)) {
            if (logger.isDebugEnabled()) {
                logger.debug("TransportInputStream has no Content-Type header; defaulting to \"" +
                        SoapVersion.SOAP_11.getContentType() + "\"");
View Full Code Here

    public void testCreateSoapMessageNoAttachment() throws Exception {
        InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12.xml");
        Map<String, String> headers = new HashMap<String, String>();
        String soapAction = "\"http://springframework.org/spring-ws/Action\"";
        headers.put(TransportConstants.HEADER_CONTENT_TYPE, "application/soap+xml; action=" + soapAction);
        TransportInputStream tis = new MockTransportInputStream(is, headers);

        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        assertTrue("Not a SoapMessage", message instanceof SoapMessage);
        SoapMessage soapMessage = (SoapMessage) message;
        assertEquals("Invalid soap version", SoapVersion.SOAP_12, soapMessage.getVersion());
View Full Code Here

    @Override
    public void testCreateSoapMessageIllFormedXml() throws Exception {
        InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12-ill-formed.xml");
        Map<String, String> headers = new HashMap<String, String>();
        headers.put(TransportConstants.HEADER_CONTENT_TYPE, "application/soap+xml");
        TransportInputStream tis = new MockTransportInputStream(is, headers);

        messageFactory.createWebServiceMessage(tis);
    }
View Full Code Here

    public void testCreateSoapMessageSwA() throws Exception {
        InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12-attachment.bin");
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Content-Type", "multipart/related;" + "type=\"application/soap+xml\";" +
                "boundary=\"----=_Part_0_11416420.1149699787554\"");
        TransportInputStream tis = new MockTransportInputStream(is, headers);

        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        assertTrue("Not a SoapMessage", message instanceof SoapMessage);
        SoapMessage soapMessage = (SoapMessage) message;
        assertEquals("Invalid soap version", SoapVersion.SOAP_12, soapMessage.getVersion());
View Full Code Here

TOP

Related Classes of org.springframework.ws.transport.TransportInputStream

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.