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;
}
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);
}
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;
}
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;
}
Aggregations