if (!soapFault.getNamespaceURI().equals(((SoapFault)ex).getFaultCode().getNamespaceURI()) && SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE .equals(((SoapFault)ex).getFaultCode().getNamespaceURI())) { SAAJUtils.setFaultCode(soapFault, ((SoapFault)ex).getFaultCode()); String role = ((SoapFault)ex).getRole(); if (role != null) {
public String getCodeString(String prefix, String defaultPrefix) { return getFaultCodeString(prefix, defaultPrefix, getFaultCode()); }
SoapFault sf = SoapFault.createFault((Fault)exception, ((SoapMessage)msg).getVersion()); soapFault.setFaultString(sf.getReason()); SAAJUtils.setFaultCode(soapFault, sf.getFaultCode()); if (sf.hasDetails()) { soapFault.addDetail();
public String getCodeString(String prefix, String defaultPrefix) { return getFaultCodeString(prefix, defaultPrefix, getFaultCode()); }
.getVersion()); soapFault.setFaultString(sf.getReason()); SAAJUtils.setFaultCode(soapFault, sf.getFaultCode()); if (sf.hasDetails()) { soapFault.addDetail();
public String toString(Fault f) { SoapFault sf = (SoapFault)f; org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("SEQ_FAULT_MSG", LOG, new Object[] {sf.getReason(), sf.getFaultCode(), sf.getSubCode()}); return msg.toString(); } }
public SoapFaultException(MuleEvent event, SoapFault soapFault, MessageProcessor failingMessageProcessor) { super(CoreMessages.createStaticMessage(soapFault.getMessage()), event, soapFault, failingMessageProcessor); this.faultCode = soapFault.getFaultCode(); this.subCode = soapFault.getSubCode(); this.detail = soapFault.getDetail(); }
String codeString = fault.getCodeString(getFaultCodePrefix(writer, fault.getFaultCode()), defaultPrefix);
String codeString = fault.getCodeString(getFaultCodePrefix(writer, fault.getFaultCode()), defaultPrefix);
private static void updateSoap12FaultCodes(SoapFault f) { //per Soap 1.2 spec, the fault code MUST be one of the 5 values specified in the spec. //Soap 1.1 allows the soap fault code to be arbitrary (recommends the 4 values in the spec, but //explicitely mentions that it can be extended to include additional codes). Soap 1.2 however //requires the use of one of the 5 defined codes. Additional detail or more specific information //can be transferred via the SubCodes. QName fc = f.getFaultCode(); SoapVersion v = Soap12.getInstance(); if (fc.getNamespaceURI().equals(Soap12.SOAP_NAMESPACE) && (fc.equals(v.getReceiver()) || fc.equals(v.getSender()) || fc.equals(v.getMustUnderstand()) || fc.equals(v.getDateEncodingUnknown()) || fc.equals(v.getVersionMismatch()))) { //valid fault codes, don't change anything return; } f.setFaultCode(Soap12.getInstance().getReceiver()); if (f.getSubCodes() == null) { f.setRootSubCode(fc); } else if (!f.getSubCodes().contains(fc)) { f.getSubCodes().add(fc); } } public static SoapFault createFault(Fault f, SoapVersion v) {
private static void updateSoap12FaultCodes(SoapFault f) { //per Soap 1.2 spec, the fault code MUST be one of the 5 values specified in the spec. //Soap 1.1 allows the soap fault code to be arbitrary (recommends the 4 values in the spec, but //explicitely mentions that it can be extended to include additional codes). Soap 1.2 however //requires the use of one of the 5 defined codes. Additional detail or more specific information //can be transferred via the SubCodes. QName fc = f.getFaultCode(); SoapVersion v = Soap12.getInstance(); if (fc.getNamespaceURI().equals(Soap12.SOAP_NAMESPACE) && (fc.equals(v.getReceiver()) || fc.equals(v.getSender()) || fc.equals(v.getMustUnderstand()) || fc.equals(v.getDateEncodingUnknown()) || fc.equals(v.getVersionMismatch()))) { //valid fault codes, don't change anything return; } f.setFaultCode(Soap12.getInstance().getReceiver()); if (f.getSubCodes() == null) { f.setRootSubCode(fc); } else if (!f.getSubCodes().contains(fc)) { f.getSubCodes().add(fc); } } public static SoapFault createFault(Fault f, SoapVersion v) {
writer.writeStartElement(defaultPrefix, "Value", ns); writer.writeCharacters(fault.getCodeString(getFaultCodePrefix(writer, fault.getFaultCode()), defaultPrefix)); writer.writeEndElement();
writer.writeStartElement(defaultPrefix, "Value", ns); writer.writeCharacters(fault.getCodeString(getFaultCodePrefix(writer, fault.getFaultCode()), defaultPrefix)); writer.writeEndElement();
SoapFault expectedValue = getValue(); faultMessageValidator = new PlainTextTestResource(expectedValue.getMessage()); codeValidator = new QNameValidator(expectedValue.getFaultCode()); if (expectedValue.getDetail() != null) detailValidator = new XmlTestResource(expectedValue.getDetail().getOwnerDocument()); codeExchange.getIn().setBody(fault.getFaultCode()); validCode = codeValidator.matches(codeExchange);
if (!soapFault.getNamespaceURI().equals(((SoapFault)ex).getFaultCode().getNamespaceURI()) && SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE .equals(((SoapFault)ex).getFaultCode().getNamespaceURI())) { SAAJUtils.setFaultCode(soapFault, ((SoapFault)ex).getFaultCode()); String role = ((SoapFault)ex).getRole(); if (role != null) {
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); } }
SoapFault sf = SoapFault.createFault((Fault)exception, ((SoapMessage)msg).getVersion()); soapFault.setFaultString(sf.getReason()); SAAJUtils.setFaultCode(soapFault, sf.getFaultCode()); if (sf.hasDetails()) { soapFault.addDetail();
} catch (WebServiceException wse) { SoapFault sf = (SoapFault)wse.getCause(); assertEquals("Server", sf.getFaultCode().getLocalPart());
.getVersion()); soapFault.setFaultString(sf.getReason()); SAAJUtils.setFaultCode(soapFault, sf.getFaultCode()); if (sf.hasDetails()) { soapFault.addDetail();
assertEquals(SOAP_FAULT_CODE, sf.getFaultCode()); SoapFault sf = (SoapFault)cause; assertEquals(expectedMsg, sf.getReason()); assertEquals(SOAP_FAULT_CODE, sf.getFaultCode());