Package org.apache.woden.wsdl20.xml

Examples of org.apache.woden.wsdl20.xml.ServiceElementTest


    private BindingFaultElement parseBindingFault(XMLElement bindFaultEl,
            DescriptionElement desc,
            BindingElement parent)
            throws WSDLException {

        BindingFaultElement fault = parent.addBindingFaultElement();

        QName intFltQN = null;
        String ref = bindFaultEl.getAttributeValue(Constants.ATTR_REF);
        if(ref != null)
        {
            try {
                intFltQN = bindFaultEl.getQName(ref);
                fault.setRef(intFltQN);
            } catch (WSDLException e) {
                getErrorReporter().reportError(
                        new ErrorLocatorImpl()//TODO line&col nos.
                        "WSDL505",
                        new Object[] {ref, bindFaultEl.getQName()},
                        ErrorReporter.SEVERITY_ERROR);
            }
        }

        parseExtensionAttributes(bindFaultEl, BindingFaultElement.class, fault, desc);

        /* Parse the child elements of binding <fault>.
         * As per WSDL 2.0 spec, they must be in the following order if present:
         * <documentation>
         * extension elements in any order
         * TODO validate that the elements are in correct order
         */

        XMLElement[] children = bindFaultEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
            {
                parseDocumentation(tempEl, desc, fault);
            }
            else
            {
                fault.addExtensionElement(
                        parseExtensionElement(BindingFaultElement.class, fault, tempEl, desc) );
            }
        }

        return fault;
View Full Code Here


            XMLElement faultRefEl,
            DescriptionElement desc,
            BindingOperationElement parent)
            throws WSDLException {

        BindingFaultReferenceElement faultRef = parent.addBindingFaultReferenceElement();

        QName refQN = null;
        String ref = faultRefEl.getAttributeValue(Constants.ATTR_REF);
        if(ref != null)
        {
            try {
                refQN = faultRefEl.getQName(ref);
                faultRef.setRef(refQN);
            } catch (WSDLException e) {
                getErrorReporter().reportError(
                        new ErrorLocatorImpl()//TODO line&col nos.
                        "WSDL505",
                        new Object[] {ref, faultRefEl.getQName()},
                        ErrorReporter.SEVERITY_ERROR);
            }
        }

        String msgLabel = faultRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
        if(msgLabel != null)
        {
            faultRef.setMessageLabel(new NCName(msgLabel));
        }
        else
        {
            //This is a limited solution supporting the 3 MEPs in the Part 2 spec.
            //TODO generic support for user-defined, extensible MEPs.
           
            BindingOperationElement bop = (BindingOperationElement)faultRef.getParentElement();
            InterfaceOperationElement iop = bop.getInterfaceOperationElement();
            URI mep = (iop != null ? iop.getPattern() : null); //iop might be null if the WSDL is invalid
           
            if(Constants.MEP_URI_IN_OUT.equals(mep))
            {
                //Ruleset is fault-replaces-message, so fault is in same direction as msg.
                //The <output> is replaced by an <outfault>.
                //The <input> is replaced by an <infault>.
                //The <outfault> msg label should match the <output> msg label.
                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
                {
                    faultRef.setMessageLabel(MessageLabel.OUT);
                }
                else
                {
                    faultRef.setMessageLabel(MessageLabel.IN);
                }
            }
            else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep)) 
            {
                //Ruleset is message-triggers-fault, so fault is opposite direction to msg.
                //The <input> can trigger an <outfault>.
                //The <outfault> msg label should match the <input> msg label.
                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
                {
                    faultRef.setMessageLabel(MessageLabel.IN); //the <outfault> is triggered by the <input>
                }
                else
                {
                    //TODO this MEP may have only <outfault>s, not <infault>s, so treat this as an error.
                    faultRef.setMessageLabel(MessageLabel.OUT);
                }
            }
            else if(Constants.MEP_URI_IN_ONLY.equals(mep))
            {
                //TODO Ruleset is no-faults, so treat this as an error.
            }
        }

        parseExtensionAttributes(faultRefEl, BindingFaultReferenceElement.class, faultRef, desc);

        /* Parse the child elements of binding operation <infault> or <outfault>.
         * As per WSDL 2.0 spec, they must be in the following order if present:
         * <documentation>
         * extension elements in any order
         * TODO validate that the elements are in correct order
         */

        XMLElement[] children = faultRefEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
            {
                parseDocumentation(tempEl, desc, faultRef);
            }
            else
            {
                faultRef.addExtensionElement(
                        parseExtensionElement(BindingFaultReferenceElement.class, faultRef, tempEl, desc) );
            }
        }

        return faultRef;
View Full Code Here

            XMLElement msgRefEl,
            DescriptionElement desc,
            BindingOperationElement parent)
            throws WSDLException {

        BindingMessageReferenceElement message = parent.addBindingMessageReferenceElement();

        if(Constants.ELEM_INPUT.equals(msgRefEl.getLocalName())) {
            message.setDirection(Direction.IN);
        }
        else if(Constants.ELEM_OUTPUT.equals(msgRefEl.getLocalName())) {
            message.setDirection(Direction.OUT);
        }

        String msgLabel = msgRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
        if(msgLabel != null)
        {
            message.setMessageLabel(new NCName(msgLabel));
        }
        else
        {
            //This is a limited solution supporting the 3 MEPs in the Part 2 spec.
            //TODO generic support for user-defined, extensible MEPs.
            if(message.getDirection().equals(Direction.IN))
            {
                message.setMessageLabel(MessageLabel.IN);
            }
            else
            {
                message.setMessageLabel(MessageLabel.OUT);
            }
        }

        parseExtensionAttributes(msgRefEl, BindingMessageReferenceElement.class, message, desc);

        /* Parse the child elements of binding operation <input> or <output>.
         * As per WSDL 2.0 spec, they must be in the following order if present:
         * <documentation>
         * extension elements in any order
         * TODO validate that the elements are in correct order
         */

        XMLElement[] children = msgRefEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
            {
                parseDocumentation(tempEl, desc, message);
            }
            else
            {
                message.addExtensionElement(
                        parseExtensionElement(BindingMessageReferenceElement.class, message, tempEl, desc) );
            }
        }

        return message;
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.woden.wsdl20.xml.BindingMessageReferenceElement#getInterfaceMessageReferenceElement()
     */
    public InterfaceMessageReferenceElement getInterfaceMessageReferenceElement() {
        InterfaceMessageReferenceElement intMsgRef = null;
        BindingOperationElement bindOp = (BindingOperationElement)getParentElement();
        InterfaceOperationElement intOp = bindOp.getInterfaceOperationElement();
        if(intOp != null)
        {
            //Determine the "effective" msg label for this binding msg ref.
            NCName effectiveMsgLabel = null;
            if(fMessageLabel != null)
View Full Code Here

    }

    private void validateWsdl2(HttpSoapConsumerMarshaler marshaler) throws org.apache.woden.WSDLException, IOException,
                    DeploymentException {
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descElement = reader.readWSDL(wsdl.getURL().toString());
        Description desc = descElement.toComponent();
        org.apache.woden.wsdl20.Service svc;
        if (getService() != null) {
            svc = desc.getService(getService());
            if (svc == null) {
                throw new DeploymentException("Could not find service '" + getService() + "' in wsdl");
View Full Code Here

    }
   
    protected void validateWsdl2(JmsSoapProviderMarshaler marshaler) throws
                                  org.apache.woden.WSDLException, IOException, DeploymentException {
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descElement = reader.readWSDL(wsdl.getURL().toString());
        Description desc = descElement.toComponent();
        org.apache.woden.wsdl20.Service svc;
        if (getService() != null) {
            svc = desc.getService(getService());
            if (svc == null) {
                throw new DeploymentException("Could not find service '" + getService() + "' in wsdl");
View Full Code Here

    protected static Binding<?> getBinding(String wsdlResource) {
        try {
            String url = PersonHttpTest.class.getResource(wsdlResource).toString();
            WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
            DescriptionElement descElement = reader.readWSDL(url);
            Description desc = descElement.toComponent();
            Endpoint endpoint = desc.getServices()[0].getEndpoints()[0];
            Binding<?> binding = BindingFactory.createBinding(endpoint);
            assertNotNull(binding);
            return binding;
        } catch (WSDLException e) {
View Full Code Here

    }
   
    protected void validateWsdl2(HttpSoapProviderMarshaler marshaler) throws
                                  org.apache.woden.WSDLException, IOException, DeploymentException {
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descElement = reader.readWSDL(wsdl.getURL().toString());
        Description desc = descElement.toComponent();
        org.apache.woden.wsdl20.Service svc;
        if (getService() != null) {
            svc = desc.getService(getService());
            if (svc == null) {
                throw new DeploymentException("Could not find service '" + getService() + "' in wsdl");
View Full Code Here

    }

    private void validateWsdl2(JmsSoapConsumerMarshaler marshaler) throws org.apache.woden.WSDLException, IOException,
            DeploymentException {
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descElement = reader.readWSDL(wsdl.getURL().toString());
        Description desc = descElement.toComponent();
        org.apache.woden.wsdl20.Service svc;
        if (getService() != null) {
            svc = desc.getService(getService());
            if (svc == null) {
                throw new DeploymentException("Could not find service '" + getService() + "' in wsdl");
View Full Code Here

            description = readInTheWSDLFile(fullPath);
        } catch (AxisFault axisFault) {
            throw new WSDLException("ERROR", "Exception occured while reading WSDL 2.0 doc", axisFault);
        }

        DescriptionElement descriptionElement = description.toElement();
        savedTargetNamespace = descriptionElement.getTargetNamespace()
                .toString();
        namespacemap = descriptionElement.getDeclaredNamespaces();
        this.description = description;
        this.serviceName = null;
        if (name != null) {
            serviceName = new QName(descriptionElement.getTargetNamespace().toString(), name);
        }
        this.interfaceName = interfaceName;
        this.axisService = new AxisService();
        setPolicyRegistryFromService(axisService);
    }
View Full Code Here

TOP

Related Classes of org.apache.woden.wsdl20.xml.ServiceElementTest

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.