Search in sources :

Example 46 with WebServiceException

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

the class SwaTestImpl1 method echoAttachmentsWithHeader.

public OutputResponse echoAttachmentsWithHeader(InputRequestWithHeader request, MyHeader header, Holder<DataHandler> attach1, Holder<DataHandler> attach2) throws MyFault {
    System.out.println("Enter echoAttachmentsWithHeader() ......");
    if (header.getMessage().equals("do throw a fault")) {
        System.out.println("Throwing back a fault [MyFault] ......");
        throw new MyFault("This is my fault", new MyFaultType());
    }
    try {
        OutputResponse theResponse = new OutputResponse();
        theResponse.setMimeType1(request.getMimeType1());
        theResponse.setMimeType2(request.getMimeType2());
        theResponse.setResult("ok");
        theResponse.setReason("ok");
        System.out.println("Leave echoAttachmentsWithHeader() ......");
        return theResponse;
    } catch (Exception e) {
        throw new WebServiceException(e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 47 with WebServiceException

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

the class SwaTestImpl1 method getMultipleAttachments.

public void getMultipleAttachments(InputRequestGet request, Holder<OutputResponse> response, Holder<DataHandler> attach1, Holder<DataHandler> attach2) {
    try {
        System.out.println("Enter getMultipleAttachments() ......");
        OutputResponse theResponse = new OutputResponse();
        theResponse.setMimeType1(request.getMimeType1());
        theResponse.setMimeType2(request.getMimeType2());
        theResponse.setResult("ok");
        theResponse.setReason("ok");
        response.value = theResponse;
        DataHandler dh1 = new DataHandler(new URL(request.getUrl1()));
        DataHandler dh2 = new DataHandler(new URL(request.getUrl2()));
        attach1.value = dh1;
        attach2.value = dh2;
        System.out.println("Leave getMultipleAttachments() ......");
    } catch (Exception e) {
        throw new WebServiceException(e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) DataHandler(jakarta.activation.DataHandler) URL(java.net.URL) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 48 with WebServiceException

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

the class SwaTestImpl1 method putMultipleAttachments.

public OutputResponseString putMultipleAttachments(InputRequestPut request, DataHandler attach1, DataHandler attach2) {
    try {
        OutputResponseString theResponse = new OutputResponseString();
        theResponse.setMyString("ok");
        System.out.println("Enter putMultipleAttachments() ......");
        if (attach1 == null) {
            System.err.println("attach1 is null (unexpected)");
            theResponse.setMyString("not ok");
        }
        if (attach2 == null) {
            System.err.println("attach2 is null (unexpected)");
            theResponse.setMyString("not ok");
        }
        System.out.println("Leave putMultipleAttachments() ......");
        return theResponse;
    } catch (Exception e) {
        throw new WebServiceException(e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 49 with WebServiceException

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

the class SwaTestImpl1 method echoAllAttachmentTypes.

public OutputResponseAll echoAllAttachmentTypes(VoidRequest request, Holder<DataHandler> attach1, Holder<DataHandler> attach2, Holder<javax.xml.transform.Source> attach3, Holder<java.awt.Image> attach4, Holder<java.awt.Image> attach5) {
    try {
        System.out.println("Enter echoAllAttachmentTypes() ......");
        OutputResponseAll theResponse = new OutputResponseAll();
        theResponse.setResult("ok");
        theResponse.setReason("ok");
        if (attach1 == null || attach1.value == null) {
            System.err.println("attach1.value is null (unexpected)");
            theResponse.setReason("attach1.value is null (unexpected)");
            theResponse.setResult("not ok");
        }
        if (attach2 == null || attach2.value == null) {
            System.err.println("attach2.value is null (unexpected)");
            if (theResponse.getReason().equals("ok"))
                theResponse.setReason("attach2.value is null (unexpected)");
            else
                theResponse.setReason(theResponse.getReason() + "\nattach2.value is null (unexpected)");
            theResponse.setResult("not ok");
        }
        if (attach3 == null || attach3.value == null) {
            System.err.println("attach3.value is null (unexpected)");
            if (theResponse.getReason().equals("ok"))
                theResponse.setReason("attach3.value is null (unexpected)");
            else
                theResponse.setReason(theResponse.getReason() + "\nattach3.value is null (unexpected)");
            theResponse.setResult("not ok");
        }
        if (attach4 == null || attach4.value == null) {
            System.err.println("attach4.value is null (unexpected)");
            if (theResponse.getReason().equals("ok"))
                theResponse.setReason("attach4.value is null (unexpected)");
            else
                theResponse.setReason(theResponse.getReason() + "\nattach4.value is null (unexpected)");
            theResponse.setResult("not ok");
        }
        if (attach5 == null || attach5.value == null) {
            System.err.println("attach5.value is null (unexpected)");
            if (theResponse.getReason().equals("ok"))
                theResponse.setReason("attach5.value is null (unexpected)");
            else
                theResponse.setReason(theResponse.getReason() + "\nattach5.value is null (unexpected)");
            theResponse.setResult("not ok");
        }
        System.out.println("Leave echoAllAttachmentTypes() ......");
        return theResponse;
    } catch (Exception e) {
        throw new WebServiceException(e.getMessage());
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 50 with WebServiceException

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

the class HelloImpl method claimForm.

public ClaimFormTypeResponse claimForm(ClaimFormTypeRequest data) {
    try {
        validateDataHandler(data.getTotal(), data.getRequest());
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }
    ClaimFormTypeResponse resp = new ClaimFormTypeResponse();
    resp.setTotal(data.getTotal() + 1);
    resp.setResponse(getDataHandler(data.getTotal() + 1));
    return resp;
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException)

Aggregations

WebServiceException (jakarta.xml.ws.WebServiceException)396 QName (javax.xml.namespace.QName)50 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)38 SOAPException (jakarta.xml.soap.SOAPException)35 JAXBException (jakarta.xml.bind.JAXBException)30 IOException (java.io.IOException)30 Node (org.w3c.dom.Node)29 JAXBContext (jakarta.xml.bind.JAXBContext)27 SOAPMessage (jakarta.xml.soap.SOAPMessage)26 XMLStreamException (javax.xml.stream.XMLStreamException)25 Source (javax.xml.transform.Source)23 ProtocolException (jakarta.xml.ws.ProtocolException)20 Dispatch (jakarta.xml.ws.Dispatch)19 MalformedURLException (java.net.MalformedURLException)19 URL (java.net.URL)18 Map (java.util.Map)18 MessageContext (jakarta.xml.ws.handler.MessageContext)17 StreamSource (javax.xml.transform.stream.StreamSource)17 HandlerTracker (fromwsdl.handler.common.HandlerTracker)14 HandlerTracker (handler.handler_processing.common.HandlerTracker)14