Package org.apache.woden.wsdl20.xml

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


        boolean ns6;
       
        NamespaceDeclaration[] namespaces;
       
        //Description with two namespaces.
        DescriptionElement descriptionElement = factory.newDescription();
        descriptionElement.addNamespace(prefix1,namespace1);
        descriptionElement.addNamespace(prefix2,namespace2);
        //Service on description with two name spaces.
        ServiceElement serviceElement = descriptionElement.addServiceElement();
        serviceElement.addNamespace(prefix3, namespace3);
        serviceElement.addNamespace(prefix4, namespace4);
        //Endpoint on description with two namespaces
        EndpointElement endpointElement = serviceElement.addEndpointElement();
        endpointElement.addNamespace(prefix5, namespace5);
        endpointElement.addNamespace(prefix6, namespace6);
       
        //Get description declared name spaces.
        namespaces = descriptionElement.getDeclaredNamespaces();
        assertEquals("Expected 2 namespaces", namespaces.length, 2);
       
        ns1 = false;
        ns2 = false;
        for(int i=0; i<namespaces.length; i++) {
            if (namespaces[i].getNamespaceURI().equals(namespace1) && namespaces[i].getPrefix().equals(prefix1))
                ns1 = true;
            if (namespaces[i].getNamespaceURI().equals(namespace2) && namespaces[i].getPrefix().equals(prefix2))
                ns2 = true;
        }

        assertTrue("Expected NamespaceURI not found", ns1);
        assertTrue("Expected NamespaceURI not found", ns2);
       
        //Get description in scope namespaces.
        namespaces = descriptionElement.getInScopeNamespaces();
        assertEquals("Expected 2 namespaces", namespaces.length, 2);
       
        ns1 = false;
        ns2 = false;
        for(int i=0; i<namespaces.length; i++) {
View Full Code Here


            factory = WSDLFactory.newInstance();
        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }

        DescriptionElement descriptionElement = factory.newDescription();

    // Create the BindingElement<->InterfaceElement->InterfaceOperationElement->InterfaceMessageReferenceElement hierarchy
    BindingElement bindingElement = descriptionElement.addBindingElement();
    bindingElement.setInterfaceName(new QName("interface1"));
   
    InterfaceElement interfaceElement = descriptionElement.addInterfaceElement();
    interfaceElement.setName(new NCName("interface1"));

    InterfaceOperationElement ifopElement = interfaceElement.addInterfaceOperationElement();
    ifopElement.setName(new NCName("operation1"));
    InterfaceMessageReferenceElement ifmrElement = ifopElement.addInterfaceMessageReferenceElement();
    ifmrElement.setMessageLabel(new NCName("MessageRef1MessageLabel"));
       
    // Create the BindingOperationElement->BindingMessageReferenceElement hierarchy
    BindingOperationElement bopElement = bindingElement.addBindingOperationElement();
    bopElement.setRef(new QName("operation1"));
    fBindingMessageRefElement = bopElement.addBindingMessageReferenceElement();
    fBindingMessageRefElement.setMessageLabel(new NCName("MessageRef1MessageLabel"));

    Description descComp = descriptionElement.toComponent();
    descComp.getBindings(); // this triggers setting the link to description in the binding
   
    fBindingMessageRef = (BindingMessageReference) fBindingMessageRefElement;
    InterfaceMessageReference retrievedMessage = fBindingMessageRef.getInterfaceMessageReference();
    assertEquals("The retrieved InterfaceMessageReference is not that which was set",
View Full Code Here

        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }

    // Create and name an Interface Element
    DescriptionElement desc = factory.newDescription();
    InterfaceElement interfaceElement = desc.addInterfaceElement();
    interfaceElement.setName(new NCName("interface1"));
   
    // Create a binding from the description 
    fBindingElement = desc.addBindingElement();
    fBindingElement.setName(new NCName("binding1"));
    desc.toComponent();
    Binding binding = desc.toComponent().getBinding(new QName("binding1"));
 
    // getInterface() - interface attribute unspecified, but hierarchy in place:
    retrievedInterface = binding.getInterface();
    assertNull("Retrieved Interface should be null if interface attribute unspecified -", retrievedInterface);
   
    // getInterface() - interface attribute specified, and hierarchy in place:
    // Set the "interface" attribute to reference the new Interface Element
    // (have to recreate whole desc hierarchy as toComponent() will not rerun if already run!)
    desc = factory.newDescription();
    interfaceElement = desc.addInterfaceElement();
    interfaceElement.setName(new NCName("interface1"));
    fBindingElement = desc.addBindingElement();
    fBindingElement.setName(new NCName("binding1"));
    fBindingElement.setInterfaceName(new QName("interface1"));
   
    //fDescriptionElement.toComponent();
   
        binding = desc.toComponent().getBinding(new QName("binding1"));
    //fBinding = (Binding)fBindingElement;
   
    retrievedInterface = binding.getInterface();
    assertEquals("Retrieved Interface was not that expected -", interfaceElement, retrievedInterface);
  }  
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

                return;
            }
            WSDLReader reader = new DOMWSDLReader();
            DOMWSDLSource source = (DOMWSDLSource) reader.createWSDLSource();
            source.setSource(document);
            DescriptionElement descElement = reader.readWSDL(source);
            Description desc = descElement.toComponent();
            // Check if the wsdl is only a port type
            // In these cases, only the port type is used, as the service name and endpoint name
            // are provided on the jbi endpoint
            if (desc.getInterfaces().length == 1 && desc.getServices().length == 0) {
                Interface itf = desc.getInterfaces()[0];
View Full Code Here

            File file = new File(wsdlUri);
            fullPath = file.getAbsolutePath();
        }
        Description description = readInTheWSDLFile(fullPath);

        DescriptionElement descriptionElement = description.toElement();
        savedTargetNamespace = descriptionElement.getTargetNamespace()
                .toString();
        namespacemap = descriptionElement.getNamespaces();
        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

            // null));
            // }
            //
            // }

            DescriptionElement descriptionElement = description.toElement();
            TypesElement typesElement = descriptionElement
                    .getTypesElement();
            if (typesElement != null) {
                Schema[] schemas = typesElement.getSchemas();
                for (int i = 0; i < schemas.length; i++) {
                    XmlSchema schemaDefinition = schemas[i].getSchemaDefinition();
View Full Code Here

        }
        try {
            if (description == null) {

                Description description = null;
                DescriptionElement descriptionElement = null;
                if (wsdlURI != null && !"".equals(wsdlURI)) {
                    description = readInTheWSDLFile(wsdlURI);
                    descriptionElement = description.toElement();
                } else if (in != null) {

                    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
                            .newInstance();
                    documentBuilderFactory.setNamespaceAware(true);
                    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                    Document document = documentBuilder.parse(in);

                    WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
                    // This turns on WSDL validation which is set off by default.
                    reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
                    WSDLSource wsdlSource = reader.createWSDLSource();
                    wsdlSource.setSource(document.getDocumentElement());
                    wsdlSource.setBaseURI(new URI(getBaseUri()));
                    description = reader.readWSDL(wsdlSource);
                    descriptionElement = description.toElement();
                } else {
                    throw new AxisFault("No resources found to read the wsdl");
                }

                savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
                namespacemap = descriptionElement.getNamespaces();
                this.description = description;

            }
            // Create the namespacemap
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(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

TOP

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

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.