Package org.apache.axis2.jaxws.message

Examples of org.apache.axis2.jaxws.message.Block


            // Put the object into the message
            JAXBBlockFactory factory =
                    (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
            JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
            blockContext.setWebServiceNamespace(ed.getTargetNamespace());
            Block block = factory.createFrom(object,
                                             blockContext,
                                             wrapperQName)// The factory will get the qname from the value
            m.setBodyBlock(block);

            //  Now place the headers in the message
View Full Code Here


            // Put the object into the message
            JAXBBlockFactory factory =
                    (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
            JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
            blockContext.setWebServiceNamespace(ed.getTargetNamespace());
            Block block = factory.createFrom(object,
                                             blockContext,
                                             wrapperQName)// The factory will get the qname from the value
            m.setBodyBlock(block);

            // Now place the headers in the message
View Full Code Here

    // I just grabbed this code from the JAXWS MessageTests
        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
        Message m = mf.create(Protocol.soap11);
        XMLStringBlockFactory f =
                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
        Block block = f.createFrom(SOAP11_ENVELOPE, null, null);
        m.setBodyBlock(block);

        mc = new MessageContext();
        mc.setMessage(m);
        mc.setMEPContext(new MEPContext(mc));
View Full Code Here

                                "There are no elements to unmarshal.  ProviderDispatch will pass a null as input");
                    }
                }
            } else {
                // If it is not MESSAGE, then it is PAYLOAD (which is the default); only work with the body
                Block block = message.getBodyBlock(null, factory);
                if (block != null) {
                    try {
                        requestParamValue = block.getBusinessObject(true);
                        if (requestParamValue instanceof OMBlock) {
                            requestParamValue = ((OMBlock)requestParamValue).getOMElement();
                        }
                    } catch (WebServiceException e) {
                        throw ExceptionFactory.makeWebServiceException(e);
View Full Code Here

                    message = msgFactory.createFrom((SOAPEnvelope) value, protocol);
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Creating message using " + factory);
                    }
                    Block block = factory.createFrom(value, null, null);
                    message = msgFactory.createFrom(block, null, protocol);
                }
            } else {
                // PAYLOAD mode deals only with the body of the message.
                if (log.isDebugEnabled()) {
                    log.debug("Creating message (payload) using " + factory);
                }
                Block block = factory.createFrom(value, null, null);
                message = msgFactory.create(protocol);
               
                if (XMLFaultUtils.containsFault(block)) {
                    if (log.isDebugEnabled()) {
                        log.debug("The response block created contained a fault.  Converting to an XMLFault object.");
View Full Code Here

                // TODO
                //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());
                    }
                   
                    // Unmarshal the object into a JAXB object or JAXBElement
                    if (pd.isHeader()) {
                       
                        // Get the Block from the header
                        // NOTE The parameter name is always used to get the header
                        // element...even if the style is RPC.
                        String localName = pd.getParameterName();
                        block = message.getHeaderBlock(pd.getTargetNamespace(),
                                                       localName,
                                                       context,
                                                       factory);
                    } else {
                        if (totalBodyBlocks > 1) {
                            // You must use this method if there are more than one body block
                            // This method may cause OM expansion
                            block = message.getBodyBlock(index, context, factory);
                        } else {
                            // Use this method if you know there is only one body block.
                            // This method prevents OM expansion.
                            block = message.getBodyBlock(context, factory);
                        }
                        index++;
                    }
                   
                    Element element = new Element(block.getBusinessObject(true),
                                                  block.getQName());
                    PDElement pde =
                        new PDElement(pd, element, unmarshalByJavaType == null ? null
                                : unmarshalByJavaType[i]);
                    pdeList.add(pde);
                } else {
View Full Code Here

                }
                // 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 o
                // has @XmlRootElement defined
                Block block =
                    factory.createFrom(pde.getElement().getElementValue(),
                                       context,
                                       pde.getElement().getQName());
               
                if (pde.getParam().isHeader()) {
                    // Header block
                    QName qname = block.getQName();
                    message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block);
                } else {
                    // Body block
                    if (totalBodyBlocks < 1) {
                        // If there is only one block, use the following "more performant" method
View Full Code Here

            context.setProcessType(marshalByJavaTypeClass);
            context.setIsxmlList(isList);
        }

        //  Create a JAXBBlock out of the value.
        Block block = factory.createFrom(returnElement.getElementValue(),
                                         context,
                                         returnElement.getQName());

        if (isHeader) {
            message.setHeaderBlock(returnElement.getQName().getNamespaceURI(),
View Full Code Here

        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);
        } else {
            if (hasOutputBodyParams) {
                block = message.getBodyBlock(0, context, factory);
                isBody = true;
            } else {
                // If there is only 1 block, we can use the get body block method
                // that streams the whole block content.
                block = message.getBodyBlock(context, factory);
                //We look for body block only when the return type associated with operation is not void.
                //If a null body block is returned in response on a operation that is not void, its a user error.              
                isBody = true;
            }
        }
        //We look for body block only when the return type associated with operation is not void.
        //If a null body block is returned in response on a operation that has non void return type, its a user error.
        if(isBody && block == null){
             if(log.isDebugEnabled()){
               log.debug("Empty Body Block Found in response Message for wsdl Operation defintion that expects an Output");
               log.debug("Return type associated with SEI operation is not void, Body Block cannot be null");
             }
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("MethodMarshallerUtilErr1"))
        }
        // Get the business object.  We want to return the object that represents the type.
        Element returnElement = new Element(block.getBusinessObject(true), block.getQName());
        return returnElement;
    }
View Full Code Here

                    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);

            // At this point, faultBeanObject is an object that can be rendered as an
            // element.  We want the object that represents the type.
            if (faultBeanObject instanceof JAXBElement) {
                faultBeanObject = ((JAXBElement)faultBeanObject).getValue();
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.message.Block

Copyright © 2018 www.massapicom. 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.