Search in sources :

Example 1 with DispatchException

use of com.sun.xml.ws.wsdl.DispatchException in project metro-jax-ws by eclipse-ee4j.

the class TieHandler method createResponse.

public Message createResponse(JavaCallInfo call) {
    Message responseMessage;
    if (call.getException() == null) {
        responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
    } else {
        Throwable e = call.getException();
        Throwable serviceException = getServiceException(e);
        if (e instanceof InvocationTargetException || serviceException != null) {
            // if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
            if (serviceException != null) {
                // Service specific exception
                LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
            } else {
                Throwable cause = e.getCause();
                if (cause instanceof ProtocolException) {
                    // Application code may be throwing it intentionally
                    LOGGER.log(Level.FINE, cause.getMessage(), cause);
                } else {
                    // Probably some bug in application code
                    LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                }
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
            }
        } else if (e instanceof DispatchException) {
            responseMessage = ((DispatchException) e).fault;
        } else {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
        }
    }
    return responseMessage;
}
Also used : ProtocolException(jakarta.xml.ws.ProtocolException) Message(com.sun.xml.ws.api.message.Message) JAXBMessage(com.sun.xml.ws.message.jaxb.JAXBMessage) DispatchException(com.sun.xml.ws.wsdl.DispatchException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with DispatchException

use of com.sun.xml.ws.wsdl.DispatchException in project metro-jax-ws by eclipse-ee4j.

the class SEIInvokerTube method processRequest.

/**
 * This binds the parameters for SEI endpoints and invokes the endpoint method. The
 * return value, and response Holder arguments are used to create a new {@link Message}
 * that traverses through the Pipeline to transport.
 */
@NotNull
public NextAction processRequest(@NotNull Packet req) {
    JavaCallInfo call = model.getDatabinding().deserializeRequest(req);
    if (call.getException() == null) {
        try {
            if (req.getMessage().isOneWay(model.getPort()) && req.transportBackChannel != null) {
                req.transportBackChannel.close();
            }
            Object ret = getInvoker(req).invoke(req, call.getMethod(), call.getParameters());
            call.setReturnValue(ret);
        } catch (Exception e) {
            call.setException(e);
        }
    } else if (call.getException() instanceof DispatchException) {
        DispatchException e = (DispatchException) call.getException();
        return doReturnWith(req.createServerResponse(e.fault, model.getPort(), null, binding));
    }
    Packet res = (Packet) model.getDatabinding().serializeResponse(call);
    res = req.relateServerResponse(res, req.endpoint.getPort(), model, req.endpoint.getBinding());
    assert res != null;
    return doReturnWith(res);
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) JavaCallInfo(com.oracle.webservices.api.databinding.JavaCallInfo) DispatchException(com.sun.xml.ws.wsdl.DispatchException) DispatchException(com.sun.xml.ws.wsdl.DispatchException) InvocationTargetException(java.lang.reflect.InvocationTargetException) NotNull(com.sun.istack.NotNull)

Example 3 with DispatchException

use of com.sun.xml.ws.wsdl.DispatchException in project metro-jax-ws by eclipse-ee4j.

the class DatabindingImpl method deserializeRequest.

public JavaCallInfo deserializeRequest(Packet req) {
    com.sun.xml.ws.api.databinding.JavaCallInfo call = new com.sun.xml.ws.api.databinding.JavaCallInfo();
    try {
        JavaMethodImpl wsdlOp = resolveJavaMethod(req);
        TieHandler tie = wsdlOpMap.get(wsdlOp);
        call.setMethod(tie.getMethod());
        Object[] args = tie.readRequest(req.getMessage());
        call.setParameters(args);
    } catch (DispatchException e) {
        call.setException(e);
    }
    return call;
}
Also used : JavaMethodImpl(com.sun.xml.ws.model.JavaMethodImpl) DispatchException(com.sun.xml.ws.wsdl.DispatchException) JavaCallInfo(com.oracle.webservices.api.databinding.JavaCallInfo) TieHandler(com.sun.xml.ws.server.sei.TieHandler)

Example 4 with DispatchException

use of com.sun.xml.ws.wsdl.DispatchException in project metro-jax-ws by eclipse-ee4j.

the class DatabindingImpl method serializeResponse.

@Override
public Packet serializeResponse(JavaCallInfo call) {
    Method method = call.getMethod();
    Message message = null;
    if (method != null) {
        TieHandler th = tieHandlers.get(method);
        if (th != null) {
            return th.serializeResponse(call);
        }
    }
    if (call.getException() instanceof DispatchException) {
        message = ((DispatchException) call.getException()).fault;
    }
    Packet p = (Packet) packetFactory.createContext(message);
    p.setState(Packet.State.ServerResponse);
    return p;
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Message(com.sun.xml.ws.api.message.Message) Method(java.lang.reflect.Method) DispatchException(com.sun.xml.ws.wsdl.DispatchException) TieHandler(com.sun.xml.ws.server.sei.TieHandler)

Aggregations

DispatchException (com.sun.xml.ws.wsdl.DispatchException)4 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)2 Message (com.sun.xml.ws.api.message.Message)2 Packet (com.sun.xml.ws.api.message.Packet)2 TieHandler (com.sun.xml.ws.server.sei.TieHandler)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 NotNull (com.sun.istack.NotNull)1 JAXBMessage (com.sun.xml.ws.message.jaxb.JAXBMessage)1 JavaMethodImpl (com.sun.xml.ws.model.JavaMethodImpl)1 ProtocolException (jakarta.xml.ws.ProtocolException)1 Method (java.lang.reflect.Method)1