Search in sources :

Example 1 with BeanMarshaller

use of com.evolveum.midpoint.prism.marshaller.BeanMarshaller in project midpoint by Evolveum.

the class MiscSchemaUtil method serializeFaultMessage.

// TODO some better place
public static void serializeFaultMessage(Detail detail, FaultMessage faultMessage, PrismContext prismContext, Trace logger) {
    try {
        BeanMarshaller marshaller = ((PrismContextImpl) prismContext).getBeanMarshaller();
        // TODO
        XNode faultMessageXnode = marshaller.marshall(faultMessage.getFaultInfo());
        RootXNode xroot = new RootXNode(SchemaConstants.FAULT_MESSAGE_ELEMENT_NAME, faultMessageXnode);
        xroot.setExplicitTypeDeclaration(true);
        QName faultType = prismContext.getSchemaRegistry().determineTypeForClass(faultMessage.getFaultInfo().getClass());
        xroot.setTypeQName(faultType);
        ((PrismContextImpl) prismContext).getParserDom().serializeUnderElement(xroot, SchemaConstants.FAULT_MESSAGE_ELEMENT_NAME, detail);
    } catch (SchemaException e) {
        logger.error("Error serializing fault message (SOAP fault detail): {}", e.getMessage(), e);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) BeanMarshaller(com.evolveum.midpoint.prism.marshaller.BeanMarshaller) QName(javax.xml.namespace.QName) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) XNode(com.evolveum.midpoint.prism.xnode.XNode) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode)

Aggregations

BeanMarshaller (com.evolveum.midpoint.prism.marshaller.BeanMarshaller)1 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 XNode (com.evolveum.midpoint.prism.xnode.XNode)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 QName (javax.xml.namespace.QName)1