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

The following examples show how to use javax.xml.soap.SOAPFault#appendFaultSubcode() . 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: WsaTubeHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 2
Source File: WsaTubeHelper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 3
Source File: SOAP12Fault.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 4
Source File: SOAP12Fault.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 5
Source File: WsaTubeHelper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 6
Source File: SOAP12Fault.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 7
Source File: WsaTubeHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) {
    QName subcode = addVer.mapRequiredTag;
    QName subsubcode = addVer.mapRequiredTag;
    String faultstring = addVer.getMapRequiredText();

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 8
Source File: WsaTubeHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 9
Source File: SOAP12Fault.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 10
Source File: WsaTubeHelper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 11
Source File: SOAP12Fault.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 12
Source File: SOAP12Fault.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 13
Source File: WsaTubeHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) {
    QName subcode = addVer.mapRequiredTag;
    QName subsubcode = addVer.mapRequiredTag;
    String faultstring = addVer.getMapRequiredText();

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 14
Source File: WsaTubeHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 15
Source File: SOAP12Fault.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 16
Source File: WsaTubeHelper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) {
    QName subcode = addVer.mapRequiredTag;
    QName subsubcode = addVer.mapRequiredTag;
    String faultstring = addVer.getMapRequiredText();

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 17
Source File: WsaTubeHelper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 18
Source File: SOAP12Fault.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively populate the Subcodes
 */
private void fillFaultSubCodes(SOAPFault fault, SubcodeType subcode) throws SOAPException {
    if(subcode != null){
        fault.appendFaultSubcode(subcode.getValue());
        fillFaultSubCodes(fault, subcode.getSubcode());
    }
}
 
Example 19
Source File: WsaTubeHelper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) {
    QName subcode = addVer.mapRequiredTag;
    QName subsubcode = addVer.mapRequiredTag;
    String faultstring = addVer.getMapRequiredText();

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 20
Source File: AbstractSoapEncoder.java    From arctic-sea with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a SOAPFault element from SOS exception
 *
 * @param soapFault
 *            SOAPFault element
 * @param owsExceptionReport
 *            SOS exception
 *
 * @return SOAP action URI.
 *
 * @throws SOAPException
 *             if an error occurs.
 *
 * @deprecated javax.xml.soap.* is no longer supported from 8.0 because it
 *             was removed from Java
 */
@Deprecated
protected String createSOAPFaultFromExceptionResponse(SOAPFault soapFault, OwsExceptionReport owsExceptionReport)
        throws SOAPException {
    // FIXME: check and fix support for ExceptionReport with multiple
    // exceptions!
    if (!owsExceptionReport.getExceptions()
            .isEmpty()) {
        CodedException firstException = owsExceptionReport.getExceptions()
                .iterator()
                .next();
        if (soapFault.getNamespaceURI()
                .equalsIgnoreCase(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) {
            QName qname = new QName(soapFault.getNamespaceURI(), "Client", soapFault.getPrefix());
            soapFault.setFaultCode(qname);
        } else {
            soapFault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            if (firstException.getCode() != null) {
                soapFault.appendFaultSubcode(new QName(OWSConstants.NS_OWS, firstException.getCode()
                        .toString(), OWSConstants.NS_OWS_PREFIX));
            } else {
                soapFault.appendFaultSubcode(OWSConstants.QN_NO_APPLICABLE_CODE);
            }
        }
        soapFault.addFaultReasonText(SoapHelper.getSoapFaultReasonText(firstException.getCode()), Locale.ENGLISH);
        Detail detail = soapFault.addDetail();
        for (CodedException exception : owsExceptionReport.getExceptions()) {
            createSOAPFaultDetail(detail, exception);
        }
        return getExceptionActionURI(firstException.getCode());
    } else {
        SoapFault fault = new SoapFault();
        fault.setFaultCode(SOAPConstants.SOAP_RECEIVER_FAULT);
        fault.setFaultSubcode(OWSConstants.QN_NO_APPLICABLE_CODE);
        fault.setFaultReason(DEFAULT_FAULT_REASON);
        fault.setLocale(Locale.ENGLISH);
        fault.setDetailText(MISSING_EXCEPTION_DETAIL_TEXT);
        createSOAPFault(soapFault, fault);
        return SosSoapConstants.RESP_ACTION_SOS;
    }
}