Package org.springframework.ws.soap

Examples of org.springframework.ws.soap.SoapMessage


        JmsSenderConnection connection = null;
        try {
            URI uri = new URI("jms:SenderRequestQueue?deliveryMode=NON_PERSISTENT");
            connection = (JmsSenderConnection) messageSender.createConnection(uri);
            connection.setPostProcessor(processor);
            SoapMessage soapRequest = new SaajSoapMessage(messageFactory.createMessage());
            connection.send(soapRequest);

            BytesMessage request = (BytesMessage) jmsTemplate.receive();
            assertNotNull("No message received", request);
            assertTrue("Message not processed", request.getBooleanProperty("processed"));
View Full Code Here


    @Test
    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

    doTestSkipValidation("noSecurityHeader-soap.xml");
  }
 

  private void doTestSkipValidation(String fileName) throws Exception {
    SoapMessage message = loadSaajMessage(fileName);
    MessageContext messageContext = new DefaultMessageContext(message,
        soapMessageFactory);
    assertTrue("handeRequest result must be true", interceptor
        .handleRequest(messageContext, null));
   
View Full Code Here

    }

  @Override
  protected void doWithMessage(WebServiceMessage message) throws IOException {
    assertTrue("Message created with factory is not a SOAP message", message instanceof SoapMessage);
        SoapMessage soapMessage = (SoapMessage) message;
    try {
      DOMResult result = new DOMResult();
            transformerHelper.transform(soapEnvelope, result);
            soapMessage.setDocument((Document) result.getNode());
        }
        catch (TransformerException ex) {
            fail("Could not transform request SOAP envelope to message: " + ex.getMessage());
        }   
  }
View Full Code Here

        server.expect(soapHeader(soapHeaderName));

        template.sendSourceAndReceiveToResult(new StringSource("<request xmlns='http://example.com'/>"),
                new WebServiceMessageCallback() {
                    public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
                        SoapMessage soapMessage = (SoapMessage) message;
                        soapMessage.getSoapHeader().addHeaderElement(soapHeaderName);
                    }
                }, new StringResult());
    }
View Full Code Here

    @Test
    public void testAddCertificate() throws Exception {

        interceptor.setSecurementPassword("123456");
        interceptor.setSecurementUsername("rsaKey");
        SoapMessage message = loadSoap11Message("empty-soap.xml");
        MessageContext messageContext = getSoap11MessageContext(message);

        interceptor.setSecurementSignatureKeyIdentifier("DirectReference");

        interceptor.secureMessage(message, messageContext);
View Full Code Here

    protected void doWithResponse(URI uri, WebServiceMessage request, WebServiceMessage response) throws IOException {
        if (!(response instanceof SoapMessage)) {
            fail("Response is not a SOAP message");
            return;
        }
        SoapMessage soapResponse = (SoapMessage) response;
        SoapBody responseBody = soapResponse.getSoapBody();
        if (responseBody == null) {
            fail("SOAP message [" + response + "] does not contain SOAP body");
        }
        addSoapFault(responseBody);
    }
View Full Code Here

    @Test
    public void testAddTimestamp() throws Exception {
        Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
        interceptor.setSecurementActions("Timestamp");
        interceptor.afterPropertiesSet();
        SoapMessage message = loadSoap11Message("empty-soap.xml");
        MessageContext context = getSoap11MessageContext(message);
        interceptor.secureMessage(message, context);
        Document document = getDocument(message);
        assertXpathExists("timestamp header not found",
                "/SOAP-ENV:Envelope/SOAP-ENV:Header/wsse:Security/wsu:Timestamp", document);
View Full Code Here

    @Test
    public void testValidateTimestamp() throws Exception {
        Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
        interceptor.setValidationActions("Timestamp");
        interceptor.afterPropertiesSet();
        SoapMessage message = getMessageWithTimestamp();

        MessageContext context = new DefaultMessageContext(message, getSoap11MessageFactory());
        interceptor.validateMessage(message, context);
        assertXpathNotExists("Security Header not removed", "/SOAP-ENV:Envelope/SOAP-ENV:Header/wsse:Security",
                getDocument(message));
View Full Code Here

    @Test(expected = WsSecurityValidationException.class)
    public void testValidateTimestampWithExpiredTtl() throws Exception {
        Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
        interceptor.setValidationActions("Timestamp");
        interceptor.afterPropertiesSet();
        SoapMessage message = loadSoap11Message("expiredTimestamp-soap.xml");
        MessageContext context = new DefaultMessageContext(message, getSoap11MessageFactory());
        interceptor.validateMessage(message, context);
    }
View Full Code Here

TOP

Related Classes of org.springframework.ws.soap.SoapMessage

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.