Package org.springframework.ws.soap

Examples of org.springframework.ws.soap.SoapFaultDetail


        if (messageContext.getResponse() instanceof SoapMessage) {
            SoapMessage response = (SoapMessage) messageContext.getResponse();
            SoapBody body = response.getSoapBody();
            SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale());
            if (getAddValidationErrorDetail()) {
                SoapFaultDetail detail = fault.addFaultDetail();
                for (ObjectError objectError : errors.getAllErrors()) {
                    String msg = messageSource.getMessage(objectError, getFaultLocale());
                    SoapFaultDetailElement detailElement = detail.addFaultDetailElement(getDetailElementName());
                    detailElement.addText(msg);
                }
            }
        }
        return false;
View Full Code Here


        if (messageContext.getResponse() instanceof SoapMessage) {
            SoapMessage response = (SoapMessage) messageContext.getResponse();
            SoapBody body = response.getSoapBody();
            SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale());
            if (getAddValidationErrorDetail()) {
                SoapFaultDetail detail = fault.addFaultDetail();
                for (SAXParseException error : errors) {
                    SoapFaultDetailElement detailElement = detail.addFaultDetailElement(getDetailElementName());
                    detailElement.addText(error.getMessage());
                }
            }
        }
        return false;
View Full Code Here

    @Test
    public void testGetDetailEntriesWorksWithWhitespaceNodes() throws Exception {
        SoapFault fault = failingMessage.getSoapBody().getFault();
        Assert.assertNotNull("Fault is null", fault);
        Assert.assertNotNull("Fault detail is null", fault.getFaultDetail());
        SoapFaultDetail detail = fault.getFaultDetail();
        Assert.assertTrue("No next detail entry present", detail.getDetailEntries().hasNext());
        detail.getDetailEntries().next();

    }
View Full Code Here

    @Test
    public void testGetDetailEntriesWorksWithoutWhitespaceNodes() throws Exception {
        SoapFault fault = succeedingMessage.getSoapBody().getFault();
        Assert.assertNotNull("Fault is null", fault);
        Assert.assertNotNull("Fault detail is null", fault.getFaultDetail());
        SoapFaultDetail detail = fault.getFaultDetail();
        Assert.assertTrue("No next detail entry present", detail.getDetailEntries().hasNext());
        detail.getDetailEntries().next();
    }
View Full Code Here

    @Test
    public void testAddFaultWithDetail() throws Exception {
        QName faultCode = new QName("http://www.springframework.org", "fault", "spring");
        String faultString = "faultString";
        SoapFault fault = ((Soap11Body) soapBody).addFault(faultCode, faultString, null);
        SoapFaultDetail detail = fault.addFaultDetail();
        QName detailName = new QName("http://www.springframework.org", "detailEntry", "spring");
        SoapFaultDetailElement detailElement1 = detail.addFaultDetailElement(detailName);
        StringSource detailContents = new StringSource("<detailContents xmlns='namespace'/>");
        transformer.transform(detailContents, detailElement1.getResult());
        SoapFaultDetailElement detailElement2 = detail.addFaultDetailElement(detailName);
        detailContents = new StringSource("<detailContents xmlns='namespace'/>");
        transformer.transform(detailContents, detailElement2.getResult());
        assertPayloadEqual(
                "<SOAP-ENV:Fault xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:spring='http://www.springframework.org'>" +
                        "<faultcode>spring:fault</faultcode>" + "<faultstring>" + faultString + "</faultstring>" +
View Full Code Here

    @Test
    public void testAddFaultWithDetailResult() throws Exception {
        SoapFault fault = ((Soap11Body) soapBody)
                .addFault(new QName("namespace", "localPart", "prefix"), "Fault", null);
        SoapFaultDetail detail = fault.addFaultDetail();
        transformer.transform(new StringSource("<detailContents xmlns='namespace'/>"), detail.getResult());
        transformer.transform(new StringSource("<detailContents xmlns='namespace'/>"), detail.getResult());
        assertPayloadEqual("<SOAP-ENV:Fault xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>" +
                "<faultcode xmlns:prefix='namespace'>prefix:localPart</faultcode>" +
                "<faultstring>Fault</faultstring>" + "<detail>" + "<detailContents xmlns='namespace'/>" +
                "<detailContents xmlns='namespace'/>" + "</detail></SOAP-ENV:Fault>");
    }
View Full Code Here

    }

    @Test
    public void testAddFaultWithDetail() throws Exception {
        SoapFault fault = soapBody.addServerOrReceiverFault("faultString", Locale.ENGLISH);
        SoapFaultDetail detail = fault.addFaultDetail();
        SoapFaultDetailElement detailElement =
                detail.addFaultDetailElement(new QName("namespace", "localPart", "prefix"));
        StringSource detailContents = new StringSource("<detailContents xmlns='namespace'/>");
        transformer.transform(detailContents, detailElement.getResult());
        StringResult result = new StringResult();
        transformer.transform(fault.getSource(), result);
        assertXMLEqual("Invalid source for body",
View Full Code Here

    }

    @Test
    public void testAddFaultWithDetailResult() throws Exception {
        SoapFault fault = soapBody.addServerOrReceiverFault("faultString", Locale.ENGLISH);
        SoapFaultDetail detail = fault.addFaultDetail();
        transformer.transform(new StringSource("<detailContents xmlns='namespace'/>"), detail.getResult());
        transformer.transform(new StringSource("<detailContents xmlns='namespace'/>"), detail.getResult());
        StringResult result = new StringResult();
        transformer.transform(fault.getSource(), result);
        assertXMLEqual("Invalid source for body",
                "<soapenv:Fault xmlns:soapenv='http://www.w3.org/2003/05/soap-envelope'>" +
                        "<soapenv:Code><soapenv:Value>" + soapBody.getName().getPrefix() + ":Receiver</soapenv:Value>" +
View Full Code Here

TOP

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

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.