Package org.springframework.ws.soap

Examples of org.springframework.ws.soap.SoapMessage


    String xml = xmlBuilder.toString();
    String actual = String.format(xml, "1");
    DOMResult result = new DOMResult();
    TransformerHelper transformerHelper = new TransformerHelper();
    transformerHelper.transform(new StringSource(actual), result);
        SoapMessage message = createMock(SoapMessage.class);
        expect(message.getDocument()).andReturn((Document)result.getNode()).once();
        replay(message);

        String expected = String.format(xml, "2");
        SoapEnvelopeDiffMatcher matcher = new SoapEnvelopeDiffMatcher(new StringSource(expected));
        matcher.match(message);
View Full Code Here


    }

    @Test
    public void testValidateCertificate() throws Exception {
        SoapMessage message = loadSoap11Message("signed-soap.xml");

        MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
        interceptor.validateMessage(message, messageContext);
        Object result = getMessage(message);
        assertNotNull("No result returned", result);
View Full Code Here

                getDocument(message));
    }

    @Test
    public void testValidateCertificateWithSignatureConfirmation() throws Exception {
        SoapMessage message = loadSoap11Message("signed-soap.xml");
        MessageContext messageContext = getSoap11MessageContext(message);
        interceptor.setEnableSignatureConfirmation(true);
        interceptor.validateMessage(message, messageContext);
        WebServiceMessage response = messageContext.getResponse();
        interceptor.secureMessage(message, messageContext);
View Full Code Here

    public void testSignResponse() throws Exception {
        interceptor.setSecurementActions("Signature");
        interceptor.setEnableSignatureConfirmation(false);
        interceptor.setSecurementPassword("123456");
        interceptor.setSecurementUsername("rsaKey");
        SoapMessage message = loadSoap11Message("empty-soap.xml");
        MessageContext messageContext = getSoap11MessageContext(message);

        // interceptor.setSecurementSignatureKeyIdentifier("IssuerSerial");

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

    public void testSignResponseWithSignatureUser() throws Exception {
        interceptor.setSecurementActions("Signature");
        interceptor.setEnableSignatureConfirmation(false);
        interceptor.setSecurementPassword("123456");
        interceptor.setSecurementSignatureUser("rsaKey");
        SoapMessage message = loadSoap11Message("empty-soap.xml");
        MessageContext messageContext = getSoap11MessageContext(message);

        interceptor.secureMessage(message, messageContext);

        Document document = getDocument(message);
View Full Code Here

    @Test(expected = AssertionError.class)
    public void noPayload() throws Exception {
        PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource("<message/>"));
        MessageFactory messageFactory = MessageFactory.newInstance();
        SoapMessage soapMessage = new SaajSoapMessage(messageFactory.createMessage());

        matcher.createDiff(soapMessage);
    }
View Full Code Here

public class FaultEndpoint implements MessageEndpoint {

    @Override
    public void invoke(MessageContext messageContext) throws Exception {
        SoapMessage response = (SoapMessage) messageContext.getResponse();
        response.getSoapBody().addServerOrReceiverFault("Something went wrong", Locale.ENGLISH);
    }
View Full Code Here

    }

    @Test
    public void testValidateUsernameTokenPlainText() throws Exception {
        EndpointInterceptor interceptor = prepareInterceptor("UsernameToken", true, false);
        SoapMessage message = loadSoap11Message("usernameTokenPlainText-soap.xml");
        MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
        interceptor.handleRequest(messageContext, null);
        assertValidateUsernameToken(message);

        // test clean up
View Full Code Here

      interceptor.setSecurementUsername("Bert");
      interceptor.setSecurementPassword("Ernie");
      interceptor.setSecurementPasswordType(WSConstants.PW_DIGEST);


      SoapMessage message = loadSoap11Message("empty-soap.xml");
        MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
      interceptor.handleRequest(messageContext);

        interceptor = prepareInterceptor("UsernameToken", true, true);
        interceptor.handleRequest(messageContext, null);
View Full Code Here

                new SoapEndpointInvocationChain(new Object(), new SoapEndpointInterceptor[]{interceptorMock});

        boolean result = dispatcher.handleRequest(chain, context);
        Assert.assertFalse("Header understood", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        SoapBody responseBody = response.getSoapBody();
        Assert.assertTrue("Response body has no fault", responseBody.hasFault());
        Soap12Fault fault = (Soap12Fault) responseBody.getFault();
        Assert.assertEquals("Invalid fault code", new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand"),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string", SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING,
                fault.getFaultReasonText(Locale.ENGLISH));
        SoapHeader responseHeader = response.getSoapHeader();
        Iterator<SoapHeaderElement> iterator = responseHeader.examineAllHeaderElements();
        Assert.assertTrue("Response header has no elements", iterator.hasNext());
        SoapHeaderElement headerElement = iterator.next();
        Assert.assertEquals("No NotUnderstood header",
                new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "NotUnderstood"), headerElement.getName());
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.