/** * TODO This is SOAP specific code and should not be in cxf core * @param fault */ private void enrichFault(Fault fault) { if (fault.getCause().getCause() instanceof IOException || fault.getCause() instanceof IOException) { String soap11NS = "http://schemas.xmlsoap.org/soap/envelope/"; String soap12NS = "http://www.w3.org/2003/05/soap-envelope"; QName faultCode = fault.getFaultCode(); //for SoapFault, if it's underlying cause is IOException, //it means something like server is down or can't create //connection, according to soap spec we should set fault as //Server Fault if (faultCode.getNamespaceURI().equals( soap11NS) && faultCode.getLocalPart().equals("Client")) { faultCode = new QName(soap11NS, "Server"); fault.setFaultCode(faultCode); } if (faultCode.getNamespaceURI().equals( soap12NS) && faultCode.getLocalPart().equals("Sender")) { faultCode = new QName(soap12NS, "Receiver"); fault.setFaultCode(faultCode); } } }
/** * TODO This is SOAP specific code and should not be in cxf core * @param fault */ private void enrichFault(Fault fault) { if (fault.getCause().getCause() instanceof IOException || fault.getCause() instanceof IOException) { String soap11NS = "http://schemas.xmlsoap.org/soap/envelope/"; String soap12NS = "http://www.w3.org/2003/05/soap-envelope"; QName faultCode = fault.getFaultCode(); //for SoapFault, if it's underlying cause is IOException, //it means something like server is down or can't create //connection, according to soap spec we should set fault as //Server Fault if (faultCode.getNamespaceURI().equals( soap11NS) && "Client".equals(faultCode.getLocalPart())) { faultCode = new QName(soap11NS, "Server"); fault.setFaultCode(faultCode); } if (faultCode.getNamespaceURI().equals( soap12NS) && "Sender".equals(faultCode.getLocalPart())) { faultCode = new QName(soap12NS, "Receiver"); fault.setFaultCode(faultCode); } } }
/** * TODO This is SOAP specific code and should not be in cxf core * @param fault */ private void enrichFault(Fault fault) { if (fault.getCause().getCause() instanceof IOException || fault.getCause() instanceof IOException) { String soap11NS = "http://schemas.xmlsoap.org/soap/envelope/"; String soap12NS = "http://www.w3.org/2003/05/soap-envelope"; QName faultCode = fault.getFaultCode(); //for SoapFault, if it's underlying cause is IOException, //it means something like server is down or can't create //connection, according to soap spec we should set fault as //Server Fault if (faultCode.getNamespaceURI().equals( soap11NS) && "Client".equals(faultCode.getLocalPart())) { faultCode = new QName(soap11NS, "Server"); fault.setFaultCode(faultCode); } if (faultCode.getNamespaceURI().equals( soap12NS) && "Sender".equals(faultCode.getLocalPart())) { faultCode = new QName(soap12NS, "Receiver"); fault.setFaultCode(faultCode); } } }
/** * TODO This is SOAP specific code and should not be in cxf core * @param fault */ private void enrichFault(Fault fault) { if (fault.getCause().getCause() instanceof IOException || fault.getCause() instanceof IOException) { String soap11NS = "http://schemas.xmlsoap.org/soap/envelope/"; String soap12NS = "http://www.w3.org/2003/05/soap-envelope"; QName faultCode = fault.getFaultCode(); //for SoapFault, if it's underlying cause is IOException, //it means something like server is down or can't create //connection, according to soap spec we should set fault as //Server Fault if (faultCode.getNamespaceURI().equals( soap11NS) && faultCode.getLocalPart().equals("Client")) { faultCode = new QName(soap11NS, "Server"); fault.setFaultCode(faultCode); } if (faultCode.getNamespaceURI().equals( soap12NS) && faultCode.getLocalPart().equals("Sender")) { faultCode = new QName(soap12NS, "Receiver"); fault.setFaultCode(faultCode); } } }
/** * Construct the Action URI. * * @param message the current message * @return the Action URI */ public static AttributedURIType getAction(Message message) { String action = null; LOG.fine("Determining action"); Exception fault = message.getContent(Exception.class); if (fault instanceof Fault && Names.WSA_NAMESPACE_NAME.equals(((Fault)fault).getFaultCode().getNamespaceURI())) { // wsa relevant faults should use the wsa-fault action value action = Names.WSA_DEFAULT_FAULT_ACTION; } else { FaultAction annotation = null; if (fault != null) { annotation = fault.getClass().getAnnotation(FaultAction.class); } if ((annotation != null) && (annotation.value() != null)) { action = annotation.value(); } else { action = getActionFromServiceModel(message, fault); } } if (LOG.isLoggable(Level.FINE)) { LOG.fine("action: " + action); } return action != null ? ContextUtils.getAttributedURI(action) : null; }
/** * Construct the Action URI. * * @param message the current message * @return the Action URI */ public static AttributedURIType getAction(Message message) { String action = null; LOG.fine("Determining action"); Exception fault = message.getContent(Exception.class); if (fault instanceof Fault && Names.WSA_NAMESPACE_NAME.equals(((Fault)fault).getFaultCode().getNamespaceURI())) { // wsa relevant faults should use the wsa-fault action value action = Names.WSA_DEFAULT_FAULT_ACTION; } else { FaultAction annotation = null; if (fault != null) { annotation = fault.getClass().getAnnotation(FaultAction.class); } if ((annotation != null) && (annotation.value() != null)) { action = annotation.value(); } else { action = getActionFromServiceModel(message, fault); } } if (LOG.isLoggable(Level.FINE)) { LOG.fine("action: " + action); } return action != null ? ContextUtils.getAttributedURI(action) : null; }
if (f.getFaultCode().getNamespaceURI().equals(Fault.FAULT_CODE_CLIENT.getNamespaceURI())) { QName fc = f.getFaultCode(); if (Fault.FAULT_CODE_CLIENT.equals(fc)) { fc = v.getSender(); QName fc = f.getFaultCode(); if (Fault.FAULT_CODE_CLIENT.equals(fc)) { fc = v.getSender();
if (f.getFaultCode().getNamespaceURI().equals(Fault.FAULT_CODE_CLIENT.getNamespaceURI())) { QName fc = f.getFaultCode(); if (Fault.FAULT_CODE_CLIENT.equals(fc)) { fc = v.getSender(); QName fc = f.getFaultCode(); if (Fault.FAULT_CODE_CLIENT.equals(fc)) { fc = v.getSender();
private Object[] invoke(SoapRequest request, Exchange exchange, MessageDispatcher dispatcher) { String operation = request.getOperation(); XMLStreamReader xmlBody = getXmlBody(request); try { Map<String, Object> ctx = getInvocationContext(request, dispatcher); return client.invoke(getInvocationOperation(), new Object[] {xmlBody}, ctx, exchange); } catch (SoapFault sf) { throw new SoapFaultException(sf.getFaultCode(), sf.getSubCode(), parseExceptionDetail(sf.getDetail()).orElse(null), sf.getReason(), sf.getNode(), sf.getRole(), sf); } catch (Fault f) { if (f.getMessage().contains("COULD_NOT_READ_XML")) { throw new BadRequestException("Error consuming the operation [" + operation + "], the request body is not a valid XML"); } throw new SoapFaultException(f.getFaultCode(), parseExceptionDetail(f.getDetail()).orElse(null), f); } catch (DispatchingException e) { throw e; } catch (OperationNotFoundException e) { String location = wsdlModel.getLocation(); throw new BadRequestException("The provided [" + operation + "] does not exist in the WSDL file [" + location + "]", e); } catch (Exception e) { throw new SoapServiceException("Unexpected error while consuming the web service operation [" + operation + "]", e); } }