Examples of XmlSerializingException


Examples of org.apache.axis2.rmi.exception.XmlSerializingException

                serializeDomElement((Element) node, writer, namespacePrefix);
            } else if (node instanceof Text) {
                textNode = (Text) node;
                writer.writeCharacters(textNode.getNodeValue());
            } else {
                throw new XmlSerializingException("Unknown dom element node found node type ==>"
                        + node.getNodeType());
            }
        }
        writer.writeEndElement();
    }
View Full Code Here

Examples of org.apache.axis2.rmi.exception.XmlSerializingException

                        processedTypeMap.put(object.getClass(), newType);
                        try {
                            newType.populateMetaData(this.configurator, this.processedTypeMap);
                            newType.generateSchema(this.configurator, this.schemaMap);
                        } catch (MetaDataPopulateException e) {
                            new XmlSerializingException("Problem in processing new type", e);
                        } catch (SchemaGenerationException e) {
                            new XmlSerializingException("Problem in processing new type", e);
                        }
                    }
                    type = (Type) processedTypeMap.get(object.getClass());
                    writeTypeAttribute(writer, type.getXmlType().getQname(), namespacePrefix);
                }

                if (type.getXmlType().isSimpleType()) {
                    // this is a know type for us
                    // get the string represenation of this object using converter util class.
                    if (!type.getJavaClass().equals(Object.class)) {
                        writer.writeCharacters(getSimpleTypeStringValue(type, object));
                    }

                } else {
                    // this is a complex type
                    try {

                        AttributeField attributeField;
                        Method getterMethod;
                        Object attributeFieldValue;
                        QName attributeQName;
                        for (Iterator iter = type.getAllAttributeFields().iterator(); iter.hasNext();) {
                            attributeField = (AttributeField) iter.next();
                            getterMethod = attributeField.getGetterMethod();
                            attributeFieldValue = getterMethod.invoke(object, new Object[]{});
                            attributeQName = new QName(attributeField.getNamespace(), attributeField.getName());
                            // calls to write attribute. for attributes we can have only simple types
                            if (attributeFieldValue != null) {
                                writeAttribute(writer,
                                        getSimpleTypeStringValue(attributeField.getType(), attributeFieldValue),
                                        attributeQName,
                                        namespacePrefix);
                            } else if (attributeField.isRequried()) {
                                throw new XmlSerializingException("Attribute value for attribute "
                                        + attributeField.getName() + " is required");
                            }

                        }

                        // write the element fields
                        ElementField elementField;
                        Object elementFieldValue;
                        for (Iterator iter = type.getAllElementFields().iterator(); iter.hasNext();) {
                            elementField = (ElementField) iter.next();
                            getterMethod = elementField.getGetterMethod();
                            elementFieldValue = getterMethod.invoke(object, new Object[]{});
                            serializeElementField(elementFieldValue,
                                    elementField,
                                    writer,
                                    namespacePrefix);

                        }
                    } catch (IllegalAccessException e) {
                        throw new XmlSerializingException("problem with method inovocation " + type.getName());
                    } catch (InvocationTargetException e) {
                        throw new XmlSerializingException("problem with method inovocation " + type.getName());
                    }

                }
            }
            writer.writeEndElement();
View Full Code Here

Examples of org.apache.axis2.rmi.exception.XmlSerializingException

        try {
            Method methodToInvoke = this.simpleTypeHandlerClass.getMethod("convertToString", new Class[]{type.getJavaClass()});
            // these methods are static so use null as the object argument
            return (String) methodToInvoke.invoke(this.simpleTypeHandler, new Object[]{object});
        } catch (NoSuchMethodException e) {
            throw new XmlSerializingException("Can not invoke converter util method convertToString for class "
                    + type.getJavaClass().getName(), e);
        } catch (IllegalAccessException e) {
            throw new XmlSerializingException("Can not invoke converter util method convertToString for class "
                    + type.getJavaClass().getName(), e);
        } catch (InvocationTargetException e) {
            throw new XmlSerializingException("Can not invoke converter util method convertToString for class "
                    + type.getJavaClass().getName(), e);
        }
    }
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.