Java Code Examples for org.apache.cxf.binding.soap.SoapFault#setDetail()
The following examples show how to use
org.apache.cxf.binding.soap.SoapFault#setDetail() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractJAXWSMethodInvoker.java From cxf with Apache License 2.0 | 6 votes |
@Override protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) { //map the JAX-WS faults SOAPFaultException sfe = findSoapFaultException(ex); if (sfe != null) { SoapFault fault = new SoapFault(sfe.getFault().getFaultString(), ex, sfe.getFault().getFaultCodeAsQName()); fault.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { fault.setDetail(sfe.getFault().getDetail()); } return fault; } return super.createFault(ex, m, params, checked); }
Example 2
Source File: HandlerChainInvoker.java From cxf with Apache License 2.0 | 5 votes |
private SoapFault mapSoapFault(SOAPFaultException sfe) { SoapFault sf = new SoapFault(sfe.getFault().getFaultString(), sfe, sfe.getFault().getFaultCodeAsQName()); sf.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { sf.setDetail(sfe.getFault().getDetail()); } return sf; }
Example 3
Source File: SoapFaultFactory.java From cxf with Apache License 2.0 | 5 votes |
void setDetail(SoapFault fault, Object detail, EncoderDecoder codec) throws Exception { String name = fault.getSubCode().getLocalPart(); Element element = null; if (RMConstants.INVALID_ACKNOWLEDGMENT_FAULT_CODE.equals(name)) { element = codec.encodeSequenceAcknowledgement((SequenceAcknowledgement)detail); } else if (!RMConstants.CREATE_SEQUENCE_REFUSED_FAULT_CODE.equals(name) && !RMConstants.WSRM_REQUIRED_FAULT_CODE.equals(name)) { element = codec.encodeIdentifier((Identifier)detail); } fault.setDetail(element); }
Example 4
Source File: Soap11FaultInInterceptor.java From cxf with Apache License 2.0 | 5 votes |
public static SoapFault unmarshalFault(SoapMessage message, XMLStreamReader reader) { String exMessage = ""; QName faultCode = null; String role = null; Element detail = null; String lang = null; try { while (reader.nextTag() == XMLStreamConstants.START_ELEMENT) { if ("faultcode".equals(reader.getLocalName())) { faultCode = StaxUtils.readQName(reader); } else if ("faultstring".equals(reader.getLocalName())) { lang = reader.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"); exMessage = reader.getElementText(); } else if ("faultactor".equals(reader.getLocalName())) { role = reader.getElementText(); } else if ("detail".equals(reader.getLocalName())) { //XMLStreamReader newReader = new DepthXMLStreamReader(reader); detail = StaxUtils.read(reader).getDocumentElement(); } } } catch (XMLStreamException e) { throw new SoapFault("Could not parse message.", e, message.getVersion().getSender()); } // if the fault's content is invalid and faultCode is not found, blame the receiver if (faultCode == null) { faultCode = Soap11.getInstance().getReceiver(); exMessage = new Message("INVALID_FAULT", LOG).toString(); } SoapFault fault = new SoapFault(exMessage, faultCode); fault.setDetail(detail); fault.setRole(role); if (!StringUtils.isEmpty(lang)) { fault.setLang(lang); } return fault; }