Examples of JAXBBlockContext


Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

        try {
            JAXBBlockFactory factory =
                (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);

            Class clazz = value.getClass();
            JAXBBlockContext context = null;
            if (jaxbContext != null) {
                context = new JAXBBlockContext(jaxbContext);
            } else {
                context = new JAXBBlockContext(clazz.getPackage().getName());
            }
            // The protocol of the Message that is created should be based
            // on the binding information available.
            Protocol proto = Protocol.getProtocolForBinding(endpointDesc.getClientBindingID());
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

        try {
            if (mode.equals(Mode.PAYLOAD)) {
                // Normal Case
                JAXBBlockFactory factory =
                        (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
                JAXBBlockContext context = new JAXBBlockContext(jaxbContext);
                Block block = message.getBodyBlock(context, factory);

                if (block != null) {
                    value = block.getBusinessObject(true);
                } else {
                    // REVIEW This seems like the correct behavior.  If the body is empty, return a null
                    // Any changes here should also be made to XMLDispatch.getValue
                    if (log.isDebugEnabled()) {
                        log.debug(
                                "There are no elements in the body to unmarshal.  JAXBDispatch returns a null value");
                    }
                    value = null;
                }
            } else {
                BlockFactory factory =
                        (BlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
                JAXBBlockContext context = new JAXBBlockContext(jaxbContext);
                value = message.getValue(context, factory);
                if (value == null) {
                    if (log.isDebugEnabled()) {
                        log.debug(
                                "There are no elements to unmarshal.  JAXBDispatch returns a null value");
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

                //if (isAsyncHandler(param)) {
                //    continue;
                //}

                Block block = null;
                JAXBBlockContext context = new JAXBBlockContext(packages);

                AttachmentDescription attachmentDesc = pd.getAttachmentDescription();
                if (attachmentDesc == null) {
                   
                    boolean isBase64Binary = byte[].class.equals(javaType[i]);
                   
                   
                    // In most cases the entire java object is unmarshalled.
                    // But in some cases, the java object is a series of
                    // elements.
                    boolean unmarshalComponents = false;
                    if (pd.isListType() ||
                        javaComponentType[i] == null ||
                        isBase64Binary) {
                        context.setProcessType(javaType[i]);
                        context.setIsxmlList(pd.isListType());
                    } else {
                        context.setProcessType(javaComponentType[i]);
                        unmarshalComponents = true;
                    }
                   
                   
                    // Unmarshal the object into a JAXB object or JAXBElement
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

                                    int outputBodyArgIndex)

            throws WebServiceException, XMLStreamException {

        // The return object is the first block in the body
        JAXBBlockContext context = new JAXBBlockContext(packages);
       
        // In most cases the entire java object is unmarshalled.
        // But in some cases, the java object is a series of
        // elements.
        boolean unmarshalComponents = false;
        if (isList || javaComponentTypeClass == null) {
            context.setProcessType(javaTypeClass);
            context.setIsxmlList(isList);
        } else {
            context.setProcessType(javaComponentTypeClass);
            unmarshalComponents = true;
        }
       
        Element returnElement = null;
        if (isHeader) {
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

        int index = message.getNumBodyBlocks();
        for (int i = 0; i < pdeList.size(); i++) {
            PDElement pde = pdeList.get(i);

            // Create JAXBContext
            JAXBBlockContext context = new JAXBBlockContext(packages);

            Attachment attachment = pde.getAttachment();
            if (attachment == null) {
                // Normal Flow: Not an attachment
               
               
                // Marshal by type only if necessary
                if (pde.getByJavaTypeClass() != null) {
                    context.setProcessType(pde.getByJavaTypeClass());
                    if(pde.getParam()!=null){
                        context.setIsxmlList(pde.getParam().isListType());
                    }
                }
                // Create a JAXBBlock out of the value.
                // (Note that the PDElement.getValue always returns an object
                // that has an element rendering...ie. it is either a JAXBElement or
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

                          boolean isHeader)
            throws WebServiceException {

        // Create the JAXBBlockContext
        // RPC uses type marshalling, so recored the rpcType
        JAXBBlockContext context = new JAXBBlockContext(marshalDesc.getPackages());
        if (marshalByJavaTypeClass != null) {
            context.setProcessType(marshalByJavaTypeClass);
            context.setIsxmlList(isList);
        }

        //  Create a JAXBBlock out of the value.
        Block block = factory.createFrom(returnElement.getElementValue(),
                                         context,
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

                                    boolean hasOutputBodyParams)

            throws WebServiceException, XMLStreamException {

        // The return object is the first block in the body
        JAXBBlockContext context = new JAXBBlockContext(packages);
        if (unmarshalByJavaTypeClass != null && !isHeader) {
            context.setProcessType(unmarshalByJavaTypeClass);
            context.setIsxmlList(isList);
        }
        Block block = null;
        boolean isBody = false;
        if (isHeader) {
            block = message.getHeaderBlock(headerNS, headerLocalPart, context, factory);
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

            if (fd != null) {
                if (log.isErrorEnabled()) {
                    log.debug("Marshal as a Service Exception");
                }
                // Create the JAXB Context
                JAXBBlockContext context = new JAXBBlockContext(marshalDesc.getPackages());

                // The exception is a Service Exception. 
                // It may be (A) JAX-WS compliant exception or
                // (B) JAX-WS legacy exception

                // The faultBeanObject is a JAXB object that represents the data of the exception.
                // It is marshalled in the detail section of the soap fault. 
                // The faultBeanObject is obtained direction from the exception (A) or via
                // the legacy exception rules (B).
                Object faultBeanObject = null;

                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
                String faultInfo = fd.getFaultInfo();
                if (faultInfo == null || faultInfo.length() == 0) {
                    // Legacy Exception case
                    faultBeanObject = LegacyExceptionUtil.createFaultBean(t, fd, marshalDesc);
                } else {
                    // Normal case
                    // Get the fault bean object. 
                    Method getFaultInfo = t.getClass().getMethod("getFaultInfo", null);
                    faultBeanObject = getFaultInfo.invoke(t, null);
                }

                if (log.isErrorEnabled()) {
                    log.debug("The faultBean type is" + faultBeanObject.getClass().getName());
                }

                // Use "by java type" marshalling if necessary
                if (faultBeanObject == t ||
                        (context.getConstructionType() != JAXBUtils.CONSTRUCTION_TYPE
                                .BY_CONTEXT_PATH &&
                                isNotJAXBRootElement(faultBeanObject.getClass(), marshalDesc))) {
                    context.setProcessType(faultBeanObject.getClass());
                }

                QName faultBeanQName = new QName(faultBeanDesc.getFaultBeanNamespace(),
                                                 faultBeanDesc.getFaultBeanLocalName());
                // Make sure the faultBeanObject can be marshalled as an element
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

            FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(faultDesc);
            boolean isLegacy =
                    (faultDesc.getFaultInfo() == null || faultDesc.getFaultInfo().length() == 0);

            // Get the JAXB object from the block
            JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());

            // Note that faultBean may not be a bean, it could be a primitive
            Class faultBeanFormalClass;
            try {
                faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());
            } catch (ClassNotFoundException e){
                faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName(), operationDesc.getEndpointInterfaceDescription().getEndpointDescription().getAxisService().getClassLoader());
            }

            // Use "by java type" marshalling if necessary
            if (blockContext.getConstructionType() !=
                JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH &&
                    isNotJAXBRootElement(faultBeanFormalClass, marshalDesc)) {
                blockContext.setProcessType(faultBeanFormalClass);
            }

            // Get the jaxb block and business object
            Block jaxbBlock = factory.createFrom(detailBlocks[0], blockContext);
            Object faultBeanObject = jaxbBlock.getBusinessObject(true);
View Full Code Here

Examples of org.apache.axis2.jaxws.message.databinding.JAXBBlockContext

                //if (isAsyncHandler(param)) {
                //    continue;
                //}

                Block block = null;
                JAXBBlockContext context = new JAXBBlockContext(packages);

                AttachmentDescription attachmentDesc = pd.getAttachmentDescription();
                if (attachmentDesc == null) {
                   
                    // Normal Processing: Not an Attachment
                    // Trigger unmarshal by java type if necessary
                    if (unmarshalByJavaType != null && unmarshalByJavaType[i] != null) {
                        context.setProcessType(unmarshalByJavaType[i]);
                        context.setIsxmlList(pd.isListType());
                    }

                    boolean consume = true;
                    // Unmarshal the object into a JAXB object or JAXBElement
                    if (pd.isHeader()) {
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.