Package org.codehaus.xfire.service

Examples of org.codehaus.xfire.service.MessagePartInfo


            QName typeName = entry.getTypeName();
            if (typeName != null)
            {
                QName partName = new QName(getTargetNamespace(), entry.getName());
               
                MessagePartInfo part = info.addMessagePart(partName, null);
                part.setSchemaElement(false);
                part.setSchemaType(getBindingProvider().getSchemaType(typeName, service));
                part.setIndex(info.size()-1);
            }

            // We've got a concrete schema type
            QName elementName = entry.getElementName();
            if (elementName != null)
            {
                MessagePartInfo part = info.addMessagePart(elementName, null);
                part.setSchemaType(getBindingProvider().getSchemaType(typeName, service));
                part.setIndex(info.size()-1);
                if( entry.getDocumentationElement()!= null ){
                    part.setDocumentation(entry.getDocumentationElement().getNodeValue());//TextContent());
                }
            }
        }
    }
View Full Code Here


    protected void processFaultDetail(XFireFault fault, MessageContext context)
        throws Exception
    {
        Element exDetail = (Element) fault.getDetail().getChildren().get(0);
       
        MessagePartInfo faultPart = getFaultPart(context.getExchange().getOperation(),
                                                 exDetail);

        if (faultPart == null || faultPart.getTypeClass() == null)
            return;

        BindingProvider provider = context.getService().getBindingProvider();
        JDOMStreamReader reader = new JDOMStreamReader(exDetail);
        reader.nextTag();
       
        Object e = (Object) provider.readParameter(faultPart, reader, context);
        if (!(e instanceof Exception))
        {
            Class exClass = ((FaultInfo) faultPart.getContainer()).getExceptionClass();
           
            Constructor constructor = exClass.getConstructor(new Class[] {String.class, faultPart.getTypeClass()});
            e = constructor.newInstance(new Object[] {fault.getMessage(), e});
        }
       
        context.getExchange().getFaultMessage().setBody(e);
    }
View Full Code Here

       
        for (Iterator itr = operation.getFaults().iterator(); itr.hasNext();)
        {
            FaultInfo faultInfo = (FaultInfo) itr.next();
           
            MessagePartInfo part = faultInfo.getMessagePart(qname);
           
            if (part != null) return part;
        }
       
        return null;
View Full Code Here

    protected void initializeMessage(Service service, MessagePartContainer container, int type)
    {
        for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();)
        {
            MessagePartInfo part = (MessagePartInfo) itr.next();
           
            if (part.getSchemaType() == null)
            {
                SimpleSchemaType st = new SimpleSchemaType();
                st.setAbstract(false);
                st.setNillable(false);
               
                part.setSchemaType(st);
            }
        }
    }
View Full Code Here

    {
        Iterator messagePartIterator = messageParts.iterator();
        for (Iterator parameterIterator = parameters.iterator(); parameterIterator.hasNext();)
        {
            Object param = parameterIterator.next();
            MessagePartInfo mpi = (MessagePartInfo) messagePartIterator.next();           
            if (!mpi.getTypeClass().equals(param.getClass()))
            {
                return false;
            }
        }
        return true;
View Full Code Here

    {
        Iterator messagePartIterator = messageParts.iterator();
        for (Iterator parameterIterator = parameters.iterator(); parameterIterator.hasNext();)
        {
            Object param = parameterIterator.next();
            MessagePartInfo mpi = (MessagePartInfo) messagePartIterator.next();
           
            if (!mpi.getTypeClass().isAssignableFrom(param.getClass()))
            {
                if (!param.getClass().isPrimitive() && mpi.getTypeClass().isPrimitive())
                {
                    return checkPrimitiveMatch(mpi.getTypeClass(), param.getClass());
                }
                else
                {
                    return false;
                }
View Full Code Here

                                              QName name,
                                              int index)
    {
        // TODO: This isn't too efficient. we need to only look at non headers here
        // TODO: filter out operations which aren't applicable
        MessagePartInfo lastChoice = null;
        for ( Iterator itr = operations.iterator(); itr.hasNext(); )
        {
            OperationInfo op = (OperationInfo) itr.next();
            MessageInfo msgInfo = null;
            if (isClientModeOn(context))
            {
                msgInfo = op.getOutputMessage();
            }
            else
            {
                msgInfo = op.getInputMessage();
            }

            Collection bodyParts = msgInfo.getMessageParts();
            if (bodyParts.size() == 0 || bodyParts.size() <= index)
            {
                // itr.remove();
                continue;
            }
           
            MessagePartInfo p = (MessagePartInfo) msgInfo.getMessageParts().get(index);
            if (p.getName().equals(name)) return p;

            if (p.getSchemaType().getSchemaType().equals(XSD_ANY))
                lastChoice = p;
        }
        return lastChoice;
    }
View Full Code Here

        int param = 0;
        boolean clientMode = isClientModeOn(context);
       
        while (STAXUtils.toNextElement(dr))
        {
            MessagePartInfo p;
           
            if (opInfo != null && clientMode)
            {
                p = (MessagePartInfo) opInfo.getOutputMessage().getMessageParts().get(param);
            }
View Full Code Here

                    schemaType = part.getTypeName();
                }
               
                SchemaType st = getBindingProvider().getSchemaType(schemaType, getService());
               
                MessagePartInfo info = getSoapBinding().getHeaders((MessageInfo) msg).addMessagePart(name, null);
                info.setSchemaType(st);
            }
        }
    }
View Full Code Here

        return res;
    }

    private void createDocumentation(List messageParts){
        for(Iterator itr = messageParts.iterator();itr.hasNext();){
            MessagePartInfo param = (MessagePartInfo) itr.next();
          
           if( param.getDocumentation() != null){
          
               Element e = (Element) typeMap.get(param.getName().getNamespaceURI());
               List children  =  e.getChildren("element",Namespace.getNamespace(SoapConstants.XSD));
               for( Iterator elemItr = children.iterator(); elemItr.hasNext();){
                   Element elem = (Element) elemItr .next();
                   if(elem.getAttribute("name").getValue().equals(param.getName().getLocalPart())){
                       elem.addContent(createDocElement(param.getDocumentation()));
                       break;
                   }
               }
              
           }
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.service.MessagePartInfo

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.