Search in sources :

Example 1 with SOAPFactory

use of jakarta.xml.soap.SOAPFactory in project metro-jax-ws by eclipse-ee4j.

the class WsaTubeHelper method createInvalidAddressingHeaderFault.

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);
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) SOAPException(jakarta.xml.soap.SOAPException) SOAPFault(jakarta.xml.soap.SOAPFault) SOAPFactory(jakarta.xml.soap.SOAPFactory)

Example 2 with SOAPFactory

use of jakarta.xml.soap.SOAPFactory in project metro-jax-ws by eclipse-ee4j.

the class WsaTubeHelper method newMapRequiredFault.

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);
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) SOAPException(jakarta.xml.soap.SOAPException) SOAPFault(jakarta.xml.soap.SOAPFault) SOAPFactory(jakarta.xml.soap.SOAPFactory)

Example 3 with SOAPFactory

use of jakarta.xml.soap.SOAPFactory in project metro-jax-ws by eclipse-ee4j.

the class JAXBTest method createFault.

private static SOAPFault createFault() throws Exception {
    SOAPFactory fac = SOAPFactory.newInstance();
    SOAPFault sf = fac.createFault("This is a fault.", new QName("http://schemas.xmlsoap.org/wsdl/soap/http", "Client"));
    Detail d = sf.addDetail();
    SOAPElement de = d.addChildElement(DETAIL1_QNAME);
    de.addAttribute(new QName("", "msg1"), "This is the first detail message.");
    return sf;
}
Also used : QName(javax.xml.namespace.QName) SOAPElement(jakarta.xml.soap.SOAPElement) SOAPFault(jakarta.xml.soap.SOAPFault) SOAPFactory(jakarta.xml.soap.SOAPFactory) Detail(jakarta.xml.soap.Detail)

Example 4 with SOAPFactory

use of jakarta.xml.soap.SOAPFactory in project metro-jax-ws by eclipse-ee4j.

the class SOAPFaultBuilderTest method createFault.

private static SOAPFault createFault(SOAPVersion soapVersion) throws Exception {
    SOAPFactory fac = soapVersion.getSOAPFactory();
    SOAPFault sf = fac.createFault("This is a fault.", soapVersion.faultCodeClient);
    Detail d = sf.addDetail();
    SOAPElement de = d.addChildElement(DETAIL1_QNAME);
    de.addAttribute(new QName("", "msg1"), "This is the first detail message.");
    de = d.addChildElement(DETAIL2_QNAME);
    de.addAttribute(new QName("", "msg2"), "This is the second detail message.");
    return sf;
}
Also used : QName(javax.xml.namespace.QName) SOAPElement(jakarta.xml.soap.SOAPElement) SOAPFault(jakarta.xml.soap.SOAPFault) SOAPFactory(jakarta.xml.soap.SOAPFactory) Detail(jakarta.xml.soap.Detail)

Example 5 with SOAPFactory

use of jakarta.xml.soap.SOAPFactory in project metro-jax-ws by eclipse-ee4j.

the class TestEndpoint method createSFE.

private SOAPFaultException createSFE() {
    try {
        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPFault sf = fac.createFault("Some error message.", new QName("http://www.w3.org/2003/05/soap-envelope", "Receiver"));
        sf.setFaultNode("http://testNode");
        return new SOAPFaultException(sf);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) SOAPException(jakarta.xml.soap.SOAPException) SOAPFault(jakarta.xml.soap.SOAPFault) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException) SOAPFactory(jakarta.xml.soap.SOAPFactory)

Aggregations

SOAPFactory (jakarta.xml.soap.SOAPFactory)5 SOAPFault (jakarta.xml.soap.SOAPFault)5 QName (javax.xml.namespace.QName)5 SOAPException (jakarta.xml.soap.SOAPException)3 WebServiceException (jakarta.xml.ws.WebServiceException)3 Detail (jakarta.xml.soap.Detail)2 SOAPElement (jakarta.xml.soap.SOAPElement)2 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)1