private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) { if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) { Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService() .getServiceInfos().get(0), message.getExchange().getBus()); Detail d = fault.getDetail(); try { validateFaultDetail(d, schema, bop); } catch (Exception e) { throw new SoapFault(e.getMessage(), e, message.getVersion().getReceiver()); } //We validated what we can from a fault standpoint message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE); } }
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; }
/** * Create a SoapFault. * * @param localName the fault local name * @param prefix the fault prefix * @param namespace the fault namespace * @param reason the fault reason * @return a new SoapFault */ private SoapFault createSOAPFaut(String localName, String namespace, String reason) { return new SoapFault(reason, new QName(namespace, localName)); }
public static SoapFault getFault(AuthzException e) { String reason = ""; if (e instanceof AuthzOperationalException) { reason = AuthzOperationalException.BRIEF_DESC; } else if (e instanceof AuthzDeniedException) { reason = AuthzDeniedException.BRIEF_DESC; } else if (e instanceof AuthzPermittedException) { reason = AuthzPermittedException.BRIEF_DESC; } SoapFault fault = new SoapFault(reason, e, new QName("Authz")); return fault; }
/** * Create a SoapFault. * * @param localName the fault local name * @param prefix the fault prefix * @param namespace the fault namespace * @param reason the fault reason * @return a new SoapFault */ private SoapFault createSOAPFaut(String localName, String namespace, String reason) { return new SoapFault(reason, new QName(namespace, localName)); }
@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); }
@Override public boolean validate(Representation representation, Representation oldRepresentation) { try { validator.validate(new DOMSource((Node) representation.getAny())); } catch (SAXException ex) { return false; } catch (IOException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } return true; }
public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) { try { this.resourceTransformer = resourceTransformer; SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) { try { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) { try { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) { try { this.resourceTransformer = resourceTransformer; SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSLTResourceTransformer(Source xsl, ResourceValidator validator) { this.validator = validator; try { templates = TransformerFactory.newInstance().newTemplates(xsl); } catch (TransformerConfigurationException e) { LOG.severe(e.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
throw new SoapFault("Error creating SOAPMessage", e, message.getVersion().getSender());
@Override public ResourceTypeIdentifierResult identify(Representation representation) { try { validator.validate(new DOMSource((Node) representation.getAny())); } catch (SAXException ex) { return new ResourceTypeIdentifierResult(false, resourceTransformer); } catch (IOException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } return new ResourceTypeIdentifierResult(true, resourceTransformer); }
private String getAction(SoapMessage msg, SoapVersion version) { String action = (String)getOption(ConfigurationConstants.ACTION); if (action == null) { action = (String)msg.get(ConfigurationConstants.ACTION); } if (action == null && !ignoreActions) { LOG.warning("No security action was defined!"); throw new SoapFault("No security action was defined!", version.getReceiver()); } return action; }
private String getAction(SoapMessage msg, SoapVersion version) { String action = (String)getOption(ConfigurationConstants.ACTION); if (action == null) { action = (String)msg.get(ConfigurationConstants.ACTION); } if (action == null && !ignoreActions) { LOG.warning("No security action was defined!"); throw new SoapFault("No security action was defined!", version.getReceiver()); } return action; }
@Override public void handleFault(SoapMessage msg) { Set<QName> unknowns = CastUtils.cast((Set<?>)msg.get(MustUnderstandInterceptor.UNKNOWNS)); if (msg.getExchange().getBindingOperationInfo() == null && unknowns != null && !unknowns.isEmpty()) { //per jaxws spec, if there are must understands that we didn't understand, but couldn't map //to an operation either, we need to throw the mustunderstand fault, not the one related to //an unknown operation msg.setContent(Exception.class, new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, unknowns), msg.getVersion().getMustUnderstand())); } }
@Override public void handleFault(SoapMessage msg) { Set<QName> unknowns = CastUtils.cast((Set<?>)msg.get(MustUnderstandInterceptor.UNKNOWNS)); if (msg.getExchange().getBindingOperationInfo() == null && unknowns != null && !unknowns.isEmpty()) { //per jaxws spec, if there are must understands that we didn't understand, but couldn't map //to an operation either, we need to throw the mustunderstand fault, not the one related to //an unknown operation msg.setContent(Exception.class, new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, unknowns), msg.getVersion().getMustUnderstand())); } }
Fault createSoap12Fault(JMSFault jmsFault) { SoapFault fault = new SoapFault(jmsFault.getReason(), jmsFault.isSender() ? version.getSender() : version.getReceiver()); QName subCode = jmsFault.getSubCode(); fault.setSubCode(subCode); Object detail = jmsFault.getDetail(); if (null == detail) { return fault; } setDetail(fault, detail); return fault; }
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; }