Java Code Examples for javax.xml.soap.SOAPFault#getDetail()

The following examples show how to use javax.xml.soap.SOAPFault#getDetail() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SOAP12Fault.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 2
Source File: MessageModeOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) {
    if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) {
        Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService()
                                                         .getServiceInfos().get(0),
                                                     message.getExchange().getBus());
        Detail d = fault.getDetail();
        try {
            validateFaultDetail(d, schema, bop);
        } catch (Exception e) {
            throw new SoapFault(e.getMessage(), e, message.getVersion().getReceiver());
        }

        //We validated what we can from a fault standpoint
        message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
    }
}
 
Example 3
Source File: SOAP12Fault.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 4
Source File: MapUDDIv2Tov3.java    From juddi with Apache License 2.0 6 votes vote down vote up
private static List<Result> MapFault(SOAPFault result) {
        List<Result> r = new ArrayList<Result>();
        if (result == null) {
                return r;
        }
        if (result.getDetail() != null) {
                while (result.getDetail().getDetailEntries().hasNext()) {
                        Object next = result.getDetail().getDetailEntries().next();
                        if (next instanceof DispositionReport) {

                                DispositionReport z = (DispositionReport) next;
                                r.addAll(MapResult(z.getFaultInfo().getResult()));

                        }
                        logger.warn("unable to parse fault detail, type:" + next.getClass().getCanonicalName() + " " + next.toString());
                }
        }
        return r;
}
 
Example 5
Source File: SOAP12Fault.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 6
Source File: SOAP12Fault.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 7
Source File: SOAP12Fault.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 8
Source File: SOAP12Fault.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 9
Source File: SOAP12Fault.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 10
Source File: SOAP12Fault.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
        fillFaultSubCodes(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 11
Source File: SOAP11Fault.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 12
Source File: SOAP11Fault.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 13
Source File: SOAP11Fault.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 14
Source File: SOAP11Fault.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 15
Source File: SOAP11Fault.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 16
Source File: SOAP11Fault.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 17
Source File: SOAP11Fault.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 18
Source File: SOAP11Fault.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
SOAP11Fault(SOAPFault fault) {
    this.faultcode = fault.getFaultCodeAsQName();
    this.faultstring = fault.getFaultString();
    this.faultactor = fault.getFaultActor();
    if (fault.getDetail() != null) {
        detail = new DetailType();
        Iterator iter = fault.getDetail().getDetailEntries();
        while(iter.hasNext()){
            Element fd = (Element)iter.next();
            detail.getDetails().add(fd);
        }
    }
}
 
Example 19
Source File: HWSoapMessageDocProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
public SOAPMessage invoke(SOAPMessage request) {
    QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
    if (qn == null) {
        throw new RuntimeException("No Operation Name");
    }

    SOAPMessage response = null;
    SOAPBody body = null;
    try {
        body = SAAJUtils.getBody(request);
    } catch (SOAPException e) {
        return null;
    }
    Node n = body.getFirstChild();

    while (n.getNodeType() != Node.ELEMENT_NODE) {
        n = n.getNextSibling();
    }
    if (n.getLocalName().equals(sayHi.getLocalPart())) {
        response = sayHiResponse;
    } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
        Element el = DOMUtils.getFirstElement(n);
        String v = DOMUtils.getContent(el);
        if (v.contains("Return sayHi")) {
            response = sayHiResponse;
        } else if (v.contains("exceed maxLength")) {
            response = greetMeResponseExceedMaxLengthRestriction;
        } else if (v.contains("throwFault")) {
            try {
                SOAPFactory f = SOAPFactory.newInstance();
                SOAPFault soapFault = f.createFault();

                soapFault.setFaultString("Test Fault String ****");

                Detail detail = soapFault.addDetail();
                detail = soapFault.getDetail();

                QName qName = new QName("http://www.Hello.org/greeter", "TestFault", "ns");
                DetailEntry de = detail.addDetailEntry(qName);

                qName = new QName("http://www.Hello.org/greeter", "ErrorCode", "ns");
                SOAPElement errorElement = de.addChildElement(qName);
                errorElement.setTextContent("errorcode");
                throw new SOAPFaultException(soapFault);
            } catch (SOAPException ex) {
                //ignore
            }

        } else {
            response = greetMeResponse;
        }
    }
    return response;
}
 
Example 20
Source File: HWDOMSourcePayloadProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
public DOMSource invoke(DOMSource request) {
    QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
    if (qn == null) {
        throw new RuntimeException("No Operation Name");
    }

    DOMSource response = new DOMSource();

    Node n = request.getNode();
    if (n instanceof Document) {
        n = ((Document)n).getDocumentElement();
    }
    if (n.getLocalName().equals(sayHi.getLocalPart())) {
        response.setNode(sayHiResponse);
    } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
        Element el = DOMUtils.getFirstElement(n);
        String s = DOMUtils.getContent(el);
        if ("throwFault".equals(s.trim())) {
            try {
                SOAPFactory f = SOAPFactory.newInstance();
                SOAPFault soapFault = f.createFault();

                soapFault.setFaultString("Test Fault String ****");

                Detail detail = soapFault.addDetail();
                detail = soapFault.getDetail();

                QName qName = new QName("http://www.Hello.org/greeter", "TestFault", "ns");
                DetailEntry de = detail.addDetailEntry(qName);

                qName = new QName("http://www.Hello.org/greeter", "ErrorCode", "ns");
                SOAPElement errorElement = de.addChildElement(qName);
                errorElement.setTextContent("errorcode");

                throw new SOAPFaultException(soapFault);
            } catch (SOAPException e) {
                e.printStackTrace();
            }
        }

        response.setNode(greetMeResponse);
    }
    return response;
}