Examples of Fault


Examples of org.apache.cxf.interceptor.Fault

        } else if (source instanceof Node) {
            u.marshal(mObj, (Node)source);
        } else if (source instanceof XMLEventWriter) {
            u.marshal(mObj, (XMLEventWriter)source);
        } else {
            throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

        } else if (source instanceof OutputStream) {
            return StaxUtils.createXMLStreamWriter((OutputStream)source);
        } else if (source instanceof Node) {
            return new W3CDOMStreamWriter((Element)source);
        }
        throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                                           MessagePartInfo part) {
        Class<?> clazz = part != null ? (Class<?>)part.getTypeClass() : null;
        try {
            writeObject(marshaller, source, newJAXBElement(part.getElementQName(), clazz, null));
        } catch (JAXBException e) {
            throw new Fault(new Message("MARSHAL_ERROR", LOG, e.getMessage()), e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                .unmarshal((XMLStreamReader)source);
        } else if (source instanceof XMLEventReader) {
            obj = unmarshalWithClass ? u.unmarshal((XMLEventReader)source, clazz) : u
                .unmarshal((XMLEventReader)source);
        } else if (source == null) {
            throw new Fault(new Message("UNKNOWN_SOURCE", LOG, "null"));
        } else {
            throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
        }
        return unwrap ? getElementValue(obj) : obj;
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                throw (Fault)ex;
            }
            if (ex instanceof javax.xml.bind.UnmarshalException) {
                javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
                if (unmarshalEx.getLinkedException() != null) {
                    throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
                                            unmarshalEx.getLinkedException().getMessage()), ex);
                } else {
                    throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
                                                unmarshalEx.getMessage()), ex);                   
                }
            }
            throw new Fault(new Message("UNMARSHAL_ERROR", LOG, ex.getMessage()), ex);
        }       
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

            if (source instanceof XMLStreamReader) {
                reader = (XMLStreamReader)source;
            } else if (source instanceof Element) {
                reader = StaxUtils.createXMLStreamReader((Element)source);
            } else {
                throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
            }
            while (reader.getName().equals(elName)) {
                JAXBElement<?> type = u.unmarshal(reader, clazz);
                if (type != null) {
                    ret.add(type.getValue());
                }
                while (reader.getEventType() != XMLStreamConstants.START_ELEMENT
                    && reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                    reader.nextTag();
                }
            }
            return ret;
        } catch (Fault ex) {
            throw ex;
        } catch (Exception ex) {
            if (ex instanceof javax.xml.bind.UnmarshalException) {
                javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
                throw new Fault(new Message("UNMARSHAL_ERROR", LOG, unmarshalEx.getLinkedException()
                    .getMessage()), ex);
            } else {
                throw new Fault(new Message("UNMARSHAL_ERROR", LOG, ex.getMessage()), ex);
            }
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

    public void handleMessage(Message message) throws Fault {
        XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
        try {
            setSchemaInMessage(message, xmlReader);
        } catch (XMLStreamException e) {
            throw new Fault(new org.apache.cxf.common.i18n.Message("SCHEMA_ERROR", LOG),
                            e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

    }

    @Test
    public void testFaultToSoapFault() throws Exception {
        Exception ex = new Exception();
        Fault fault = new Fault(ex, Fault.FAULT_CODE_CLIENT);
        verifyFaultToSoapFault(fault, null, true, Soap11.getInstance());
        verifyFaultToSoapFault(fault, null, true, Soap12.getInstance());
       
        fault = new Fault(ex, Fault.FAULT_CODE_SERVER);
        verifyFaultToSoapFault(fault, null, false, Soap11.getInstance());
        verifyFaultToSoapFault(fault, null, false, Soap12.getInstance());
       
        fault.setMessage("fault-one");
        verifyFaultToSoapFault(fault, "fault-one", false, Soap11.getInstance());

        ex = new Exception("fault-two");
        fault = new Fault(ex, Fault.FAULT_CODE_CLIENT);
        verifyFaultToSoapFault(fault, "fault-two", true, Soap11.getInstance());
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

            el = schemaInfo.getElementByQName(qn);
            if (el == null) {
                createXsElement(schemaInfo.getSchema(), part, typeName, schemaInfo);

            } else if (!typeName.equals(el.getSchemaTypeName())) {
                throw new Fault(new Message("CANNOT_CREATE_ELEMENT", LOG,
                                            qn, typeName, el.getSchemaTypeName()));
            }
            return;
        }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

        if (cls != cl2) {
            QName name = (QName)fault.getProperty("elementName");
            part.setElementQName(name);
            JAXBBeanInfo beanInfo = getBeanInfo(cls);
            if (beanInfo == null) {
                throw new Fault(new Message("NO_BEAN_INFO", LOG, cls.getName()));
            }
            SchemaInfo schemaInfo = serviceInfo.getSchema(part.getElementQName().getNamespaceURI());
            if (schemaInfo != null
                && !isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.