private void validatePossibleFault(Message message, BindingOperationInfo bop, Node ds) { Element el = DOMUtils.getFirstElement(ds); if (!"Fault".equals(el.getLocalName())) { return; } message.put(Message.RESPONSE_CODE, 500); el = DOMUtils.getFirstElement(el); while (el != null && !"detail".equals(el.getLocalName())) { el = DOMUtils.getNextElement(el); } if (el != null) { Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService() .getServiceInfos().get(0), message.getExchange().getBus()); try { validateFaultDetail(el, schema, bop); } catch (Exception e) { throw new Fault(e); } //We validated what we can from a fault standpoint message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE); } } private void validateFaultDetail(Element detail, Schema schema, BindingOperationInfo bop) throws Exception {
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); } }
public static Service getService(Exchange exchange) { return exchange.getService(); }
public static Service getService(Exchange exchange) { return exchange.getService(); }
public static Service getService(Exchange exchange) { return exchange.getService(); }
public static Service getService(Exchange exchange) { return exchange.getService(); }
throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_INVOKE", BUNDLE), e); Service service = message.getExchange().getService();
public void handleMessage(SoapMessage message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo bop = ex.getBindingOperationInfo(); if (bop == null) { return; } if (bop.isUnwrapped()) { bop = bop.getWrappedOperation(); } boolean client = isRequestor(message); BindingMessageInfo bmi = client ? bop.getInput() : bop.getOutput(); if (bmi == null) { return; } SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class); if (sbi == null || sbi.getAttachments() == null || sbi.getAttachments().isEmpty()) { Service s = ex.getService(); DataBinding db = s.getDataBinding(); if (db instanceof JAXBDataBinding && hasSwaRef((JAXBDataBinding) db)) { setupAttachmentOutput(message); } return; } processAttachments(message, sbi); } protected void processAttachments(SoapMessage message, SoapBodyInfo sbi) {
public static List<ClassResourceInfo> getRootResources(Message message) { Service service = message.getExchange().getService(); return ((JAXRSServiceImpl)service).getClassResourceInfos(); }
public static void convertObjectToSource(Message message) { List<Object> content = CastUtils.cast(message.getContent(List.class)); if (content == null || content.size() < 1) { // nothing to convert return; } // only supporting the wrapped style for now (one pojo <-> one source) Object object = content.get(0); DataWriter<OutputStream> writer = message.getExchange().getService().getDataBinding().createWriter(OutputStream.class); LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); writer.write(object, bos); content.set(0, new StreamSource(bos.createInputStream())); }
protected Method getTargetMethod(Message m) { BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName()); return md.getMethod(bop); }
public static void convertObjectToSource(Message message) { List<Object> content = CastUtils.cast(message.getContent(List.class)); if (content == null || content.size() < 1) { // nothing to convert return; } // only supporting the wrapped style for now (one pojo <-> one source) Object object = content.get(0); DataWriter<OutputStream> writer = message.getExchange().getService().getDataBinding().createWriter(OutputStream.class); LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); writer.write(object, bos); content.set(0, new StreamSource(bos.createInputStream())); }
private void setSchemaInMessage(Message message, XMLStreamReader reader) throws XMLStreamException { if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.IN, message)) { try { WoodstoxValidationImpl mgr = new WoodstoxValidationImpl(); if (mgr.canValidate()) { mgr.setupValidation(reader, message.getExchange().getEndpoint(), message.getExchange().getService().getServiceInfos().get(0)); } } catch (Throwable t) { //likely no MSV or similar LOG.log(Level.FINE, "Problem initializing MSV validation", t); } } } }
private void setSchemaInMessage(Message message, XMLStreamWriter writer) throws XMLStreamException { if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) { try { WoodstoxValidationImpl mgr = new WoodstoxValidationImpl(); if (mgr.canValidate()) { mgr.setupValidation(writer, message.getExchange().getEndpoint(), message.getExchange().getService().getServiceInfos().get(0)); } } catch (Throwable t) { //likely no MSV or similar LOG.log(Level.FINE, "Problem initializing MSV validation", t); } } } }
protected Method getTargetMethod(Message m) { BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); if (bop != null) { MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName()); return md.getMethod(bop); } Method method = (Method)m.get("org.apache.cxf.resource.method"); if (method != null) { return method; } throw new AccessDeniedException("Method is not available : Unauthorized"); }
protected Method getTargetMethod(Message m) { BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); if (bop != null) { MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName()); return md.getMethod(bop); } Method method = (Method)m.get("org.apache.cxf.resource.method"); if (method != null) { return method; } throw new AccessDeniedException("Method is not available : Unauthorized"); }
protected Method getTargetMethod(Message m) { BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); if (bop != null) { MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName()); return md.getMethod(bop); } Method method = (Method)m.get("org.apache.cxf.resource.method"); if (method != null) { return method; } throw new AccessDeniedException("Method is not available : Unauthorized"); }
protected Method getTargetMethod(Message m) { BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); if (bop != null) { MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName()); return md.getMethod(bop); } Method method = (Method)m.get("org.apache.cxf.resource.method"); if (method != null) { return method; } throw new AccessDeniedException("Method is not available : Unauthorized"); }
private void noteService() { MessageContext ctx = injectedContext.getMessageContext(); WrappedMessageContext wmc = (WrappedMessageContext) ctx; org.apache.cxf.message.Message msg = wmc.getWrappedMessage(); service = msg.getExchange().getService(); }
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); } }