Examples of SOAPFaultDetail


Examples of org.apache.axiom.soap.SOAPFaultDetail

    protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        sw.flush();
        SOAPFaultDetail detail = getDetail();
        if (getDetail() == null) {
            detail = getNewSOAPFaultDetail(this);
            setDetail(detail);
        }
        OMElement faultDetailEnty = new OMElementImpl(
View Full Code Here

Examples of org.apache.axis2.soap.SOAPFaultDetail

    /**
     * If exception detailElement is not there we will return null
     */
    public Exception getException() throws OMException {
        SOAPFaultDetail detail = getDetail();
        if (detail == null) {
            return null;
        }

        OMElement exceptionElement = getDetail().getFirstChildWithName(
View Full Code Here

Examples of org.apache.axis2.soap.SOAPFaultDetail

        SOAPFaultRole faultRole = getRole();
        if (faultRole != null) {
            faultRole.serializeWithCache(omOutput);
        }

        SOAPFaultDetail faultDetail = getDetail();
        if (faultDetail != null) {
            faultDetail.serializeWithCache(omOutput);
        }

        OMSerializerUtil.serializeEndpart(omOutput);
    }
View Full Code Here

Examples of org.apache.ws.commons.soap.SOAPFaultDetail

                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertTrue("SOAP 1.2 :- Role value mismatch",
                    role.getText().trim().equals("ultimateReceiver"));

            iteratorInFault.next();
            SOAPFaultDetail detail = (SOAPFaultDetail) iteratorInFault.next();
            assertTrue("SOAP 1.2 :- Fault detail local name mismatch",
                    detail.getLocalName().equals(
                            SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
            assertTrue("SOAP 1.2 :- Fault detail namespace uri mismatch",
                    detail.getNamespace().getName().equals(
                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            assertTrue("SOAP 1.2 :- Text in detail mismatch",
                    detail.getText().trim().equals("Details of error"));

            Iterator iteratorInDetail = detail.getChildren();

            iteratorInDetail.next();
            OMElement element1 = (OMElement) iteratorInDetail.next();
            assertTrue("SOAP 1.2 :- MaxTime element mismatch",
                    element1.getLocalName().equals("MaxTime"));
            assertTrue("SOAP 1.2 :- MaxTime element namespace mismatch",
                    element1.getNamespace().getName().equals(
                            "http:www.sample.org"));
            assertTrue("SOAP 1.2 :- Text value in MaxTime element mismatch",
                    element1.getText().trim().equals("P5M"));

            Iterator attributeIterator = element1.getAllAttributes();
            OMAttribute attributeInMaxTime = (OMAttribute) attributeIterator.next();
            assertTrue("SOAP 1.2 :- Attribute local name mismatch",
                    attributeInMaxTime.getLocalName().equals("detail"));
            assertTrue("SOAP 1.2 :- Attribute namespace mismatch",
                    attributeInMaxTime.getNamespace().getName().equals(
                            "http:www.sample.org"));
            assertTrue("SOAP 1.2 :- Attribute value mismatch",
                    attributeInMaxTime.getAttributeValue().trim().equals("This is only a test"));

            iteratorInDetail.next();
            OMElement element2 = (OMElement) iteratorInDetail.next();
            assertTrue("SOAP 1.2 :- AveTime element mismatch",
                    element2.getLocalName().equals("AveTime"));
            assertTrue("SOAP 1.2 :- AveTime element namespace mismatch",
                    element2.getNamespace().getName().equals(
                            "http:www.sample.org"));

            Iterator iteratorInAveTimeElement = element2.getChildren();

            iteratorInAveTimeElement.next();
            OMElement element21 = (OMElement) iteratorInAveTimeElement.next();
            assertTrue("SOAP 1.2 :- Time element mismatch",
                    element21.getLocalName().equals("Time"));
            assertTrue("SOAP 1.2 :- Time element namespace mismatch",
                    element21.getNamespace().getName().equals(
                            "http:www.sample.org"));
            assertTrue("SOAP 1.2 :- Text value in Time element mismatch",
                    element21.getText().trim().equals("P3M"));

            XMLStreamReader sopa11Parser = XMLInputFactory.newInstance()
                    .createXMLStreamReader(new StringReader(soap11Message));
            OMXMLParserWrapper soap11Builder = new StAXSOAPModelBuilder(sopa11Parser, null);
            SOAPEnvelope soap11Envelope = (SOAPEnvelope) soap11Builder.getDocumentElement();
//            soap11Envelope.build();
//            writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
//            soap11Envelope.serializeAndConsume(writer);
//        writer.flush();

            assertTrue("SOAP 1.1 :- envelope local name mismatch",
                    soap11Envelope.getLocalName().equals(
                            SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- envelope namespace uri mismatch",
                    soap11Envelope.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            header = soap11Envelope.getHeader();
            assertTrue("SOAP 1.1 :- Header local name mismatch",
                    header.getLocalName().equals(
                            SOAPConstants.HEADER_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- Header namespace uri mismatch",
                    header.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            headerBlock = (SOAPHeaderBlock) header.getFirstElement();
            assertTrue("SOAP 1.1 :- Header block name mismatch",
                    headerBlock.getLocalName().equals("echoOk"));
            assertTrue("SOAP 1.1 :- Header block name space uri mismatch",
                    headerBlock.getNamespace().getName().equals(
                            "http://example.org/ts-tests"));
            assertTrue("SOAP 1.1 :- Headaer block text mismatch",
                    headerBlock.getText().trim().equals("foo"));

            headerBlockAttributes = headerBlock.getAllAttributes();

            mustUnderstandAttribute =
                    (OMAttribute) headerBlockAttributes.next();
            assertTrue("SOAP 1.1 :- Mustunderstand attribute name mismatch",
                    mustUnderstandAttribute.getLocalName().equals(
                            SOAPConstants.ATTR_MUSTUNDERSTAND));
            assertTrue("SOAP 1.1 :- Mustunderstand value mismatch",
                    mustUnderstandAttribute.getAttributeValue().equals(
                            SOAPConstants.ATTR_MUSTUNDERSTAND_1));
            assertTrue(
                    "SOAP 1.1 :- Mustunderstand attribute namespace uri mismatch",
                    mustUnderstandAttribute.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            OMAttribute actorAttribute = (OMAttribute) headerBlockAttributes.next();
            assertTrue("SOAP 1.1 :- Actor attribute name mismatch",
                    actorAttribute.getLocalName().equals(
                            SOAP11Constants.ATTR_ACTOR));
            assertTrue("SOAP 1.1 :- Actor value mismatch",
                    actorAttribute.getAttributeValue().trim().equals(
                            "http://schemas.xmlsoap.org/soap/" +
                    SOAP11Constants.ATTR_ACTOR +
                    "/" +
                    "next"));
            assertTrue("SOAP 1.1 :- Actor attribute namespace uri mismatch",
                    actorAttribute.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            body = soap11Envelope.getBody();
            assertTrue("SOAP 1.1 :- Body local name mismatch",
                    body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- Body namespace uri mismatch",
                    body.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            fault = body.getFault();
            assertTrue("SOAP 1.1 :- Fault namespace uri mismatch",
                    fault.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

            iteratorInFault = fault.getChildren();

            iteratorInFault.next();
            code = (SOAPFaultCode) iteratorInFault.next();
            assertEquals("SOAP Fault code local name mismatch",
                    code.getLocalName(),
                    (SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- Fault code namespace uri mismatch",
                    code.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertEquals("SOAP 1.1 :- Fault code value mismatch", code.getValue().getText().trim(),
                    "env:Sender");

            iteratorInFault.next();
            reason = (SOAPFaultReason) iteratorInFault.next();
            assertTrue("SOAP 1.1 :- Fault string local name mismatch",
                    reason.getLocalName().equals(
                            SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
            assertTrue("SOAP 1.2 :- Fault string namespace uri mismatch",
                    reason.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertTrue("SOAP 1.1 :- Fault string value mismatch",
                    reason.getSOAPText().getText().trim().equals("Sender Timeout"));

            iteratorInFault.next();
            role = (SOAPFaultRole) iteratorInFault.next();
            assertTrue("SOAP 1.1 :- Fault actor local name mismatch",
                    role.getLocalName().equals(
                            SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- Fault actor namespace uri mismatch",
                    role.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertTrue("SOAP 1.1 :- Actor value mismatch",
                    role.getText().trim().equals(
                            "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));

            iteratorInFault.next();
            detail = (SOAPFaultDetail) iteratorInFault.next();
            assertTrue("SOAP 1.1 :- Fault detail local name mismatch",
                    detail.getLocalName().equals(
                            SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
            assertTrue("SOAP 1.1 :- Fault detail namespace uri mismatch",
                    detail.getNamespace().getName().equals(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
            assertTrue("SOAP 1.2 :- Text in detail mismatch",
                    detail.getText().trim().equals("Details of error"));

            iteratorInDetail = detail.getChildren();

            iteratorInDetail.next();
            element1 = (OMElement) iteratorInDetail.next();
            assertTrue("SOAP 1.1 :- MaxTime element mismatch",
                    element1.getLocalName().equals("MaxTime"));
View Full Code Here

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

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(), 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

Examples of org.springframework.ws.soap.SoapFaultDetail

    @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

Examples of org.springframework.ws.soap.SoapFaultDetail

    @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

Examples of org.springframework.ws.soap.SoapFaultDetail

    @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

Examples of org.springframework.ws.soap.SoapFaultDetail

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