Package org.springframework.ws.soap

Examples of org.springframework.ws.soap.SoapMessage.writeTo()


    public void properties() throws IOException {
        Map<String, ?> properties = Collections.singletonMap(SOAPMessage.WRITE_XML_DECLARATION, "true");
        ((SaajSoapMessageFactory)messageFactory).setMessageProperties(properties);
        SoapMessage soapMessage = (SoapMessage) messageFactory.createWebServiceMessage();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        soapMessage.writeTo(os);
        String result = os.toString("UTF-8");
        assertTrue("XML declaration not written", result.startsWith("<?xml version=\"1.0\""));
    }

View Full Code Here


        SOAPHeaderElement securityHeader = (SOAPHeaderElement) iterator.next();
        iterator = securityHeader.getChildElements(new QName("http://www.w3.org/2000/09/xmldsig#", "Signature"));
        assertTrue("No signature header", iterator.hasNext());

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        message.writeTo(bos);

        MimeHeaders mimeHeaders = new MimeHeaders();
        mimeHeaders.addHeader("Content-Type", "text/xml");
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
View Full Code Here

        interceptor.setSecurementPassword("Ernie");

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        SoapMessage message = loadSoap11Message("customHeader-soap.xml");
        MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
        message.writeTo(os);
        String document = os.toString("UTF-8");
        assertXpathEvaluatesTo("Header 1 does not exist", "test1", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header1",
                document);
        assertXpathNotExists("Header 2 exist", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header2", document);
View Full Code Here

        SoapHeaderElement element = message.getSoapHeader().addHeaderElement(new QName("http://test", "header2"));
        element.setText("test2");

        os = new ByteArrayOutputStream();
        message.writeTo(os);
        document = os.toString("UTF-8");
        assertXpathEvaluatesTo("Header 1 does not exist", "test1", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header1",
                document);
        assertXpathEvaluatesTo("Header 2 does not exist", "test2", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header2",
                document);
View Full Code Here

                document);
        assertXpathEvaluatesTo("Header 2 does not exist", "test2", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header2",
                document);

        os = new ByteArrayOutputStream();
        message.writeTo(os);
        document = os.toString("UTF-8");
        assertXpathEvaluatesTo("Header 1 does not exist", "test1", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header1",
                document);
        assertXpathEvaluatesTo("Header 2 does not exist", "test2", "/SOAP-ENV:Envelope/SOAP-ENV:Header/test:header2",
                document);
View Full Code Here

        try {
            SoapMessage soapMessage = soapMessageFactory.createWebServiceMessage();
            transformerFactory.newTransformer().transform(new StringSource(payload), soapMessage.getPayloadResult());

            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            soapMessage.writeTo(bos);

            message.setPayload(new String(bos.toByteArray()));

            // Translate SOAP action header if present
            if (message.getHeader(INTERNAL_SOAP_ACTION_HEADER) != null) {
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.