Package org.apache.axis2.jaxws.message

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


                        (OMBlockFactory) FactoryRegistry.getFactory(OMBlockFactory.class);
                ArrayList<Block> list = new ArrayList<Block>();
                Iterator it = detail.getChildElements();
                while (it.hasNext()) {
                    OMElement om = (OMElement) it.next();
                    Block b = bf.createFrom(om, null, om.getQName());
                    list.add(b);
                }
                blocks = new Block[list.size()];
                blocks = list.toArray(blocks);
            }
View Full Code Here


                ArrayList<Block> list = new ArrayList<Block>();
                Iterator it = detail.getDetailEntries();
                while (it.hasNext()) {
                    DetailEntry de = (DetailEntry)it.next();
                    OMElement om = converter.toOM(de);
                    Block b = bf.createFrom(om, null, om.getQName());
                    list.add(b);
                }
                blocks = new Block[list.size()];
                blocks = list.toArray(blocks);
            }
View Full Code Here

        try {
            Object value = null;
            if (protocol == Protocol.rest) {
                // The implementation of rest stores the rest xml inside a dummy soap 1.1 envelope.
                // So use the get body block logic.
                Block block = xmlPart.getBodyBlock(context, blockFactory);
                if (block != null) {
                    value = block.getBusinessObject(true);
                }
               
            } else {
                // Must be SOAP
                if (blockFactory instanceof SOAPEnvelopeBlockFactory) {
                    value = getAsSOAPMessage();
                } else {
                    // TODO: This doesn't seem right to me.
                    // We should not have an intermediate StringBlock.
                    // This is not performant. Scheu
                    OMElement messageOM = getAsOMElement();
                    String stringValue = messageOM.toString();
                    String soapNS =
                            (protocol == Protocol.soap11) ? SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE
                                    : SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE;
                    QName soapEnvQname = new QName(soapNS, "Envelope");


                    XMLStringBlockFactory stringFactory =
                            (XMLStringBlockFactory)
                            FactoryRegistry.getFactory(XMLStringBlockFactory.class);
                    Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);
                    Block block = blockFactory.createFrom(stringBlock, context);
                    value = block.getBusinessObject(true);
                }
            }
            return value;
        } catch (Throwable e) {
            throw ExceptionFactory.makeWebServiceException(e);
View Full Code Here

            // Create list of JAXB objects
            if(blockList!=null && blockList.size() > 0){
                try{
                    Iterator it = blockList.iterator();
                    while (it.hasNext()) {
                        Block block = (Block) it.next();
                        Object bo = block.getBusinessObject(false);
                        if(bo!=null){
                            if(log.isDebugEnabled()){
                                log.debug("Extracted BO from Header Block");
                            }
                            list.add(bo);
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());
                    }

                    boolean consume = true;
                    // 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);
                        consume = false;
                    } 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;
                    if (block != null) {
                        element = new Element(block.getBusinessObject(true),
                                              block.getQName());
                    } else {
                        // The block could be null if the header is missing (which is allowed)
                        QName qName = new QName(pd.getTargetNamespace(),pd.getParameterName());
                        if (log.isDebugEnabled()) {
                            log.debug("There is no value in the incoming message for " + qName);
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 or
                // has @XmlRootElement defined
                Block block =
                    factory.createFrom(pde.getElement().getElementValue(),
                                       context,
                                       pde.getElement().getQName());
               
                if (pde.getParam().isHeader()) {
                    // Header block
                    if (pde.getElement().getTypeValue() != null) {
                        // The value is non-null, add a header.
                        QName qname = block.getQName();
                        message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block);
                    } else {
                        // The value is null, it is still best to add a nil header.
                        // But query to see if an override is desired.
                        if (isWriteWithNilHeader(contextProperties)) {
                            QName qname = block.getQName();
                            message.setHeaderBlock(qname.getNamespaceURI(), qname.getLocalPart(), block);
                        }
                    }
                } else {
                    // Body block
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

    }
   
    private Object _getPayload(Object context, BlockFactory factory) {
        Object payload = null;
        try {
            Block block = mepCtx.getMessageObject().getBodyBlock(context, factory);
            if (block != null) {
               if (log.isDebugEnabled()) {
                       log.debug("A message payload was found.");
               }
               Object content = block.getBusinessObject(true);
              
               // For now, we have to create a new Block from the original content
               // and set that back on the message.  The Block is not currently
               // able to create a copy of itself just yet.
               Payloads payloads = createPayloads(content);
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.