Package javax.wsdl.xml

Examples of javax.wsdl.xml.WSDLWriter


            }
        }
       
       
       
        WSDLWriter w =  WSDLFactory.newInstance().newWSDLWriter();
       
        w.writeWSDL(definition, System.out);
       
    }
View Full Code Here


        if (definition == null) {
            System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
        } else {
            try {
                System.out.println("-->Generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
                WSDLWriter writer =  WSDLFactory.newInstance().newWSDLWriter();
                writer.writeWSDL(definition, System.out);
            } catch (WSDLException e) {
                // ignore
            }
        }
    }
View Full Code Here

        String portName = portTypeName.getLocalPart();

        try
        {
            WSDLFactory fac = WSDLFactory.newInstance();
            WSDLWriter wsWriter = fac.newWSDLWriter();

            // =========== start of wsdl definition ===========
            Definition def = fac.newDefinition();

            String typens = nameSpaceURI + "/" + portName + "/" + "xsd";
            String globalTypens = nameSpaceURI + "/" + "xsd";

            if (abstractWSDL)
            {
                def.setQName(serviceQName);
                logger.info("Service QName set to = " + serviceQName);
            }
            else
            {
                def.setQName(wsdlQName);
                logger.info("WSDL QName set to = " + wsdlQName);
            }

            //FIXME: this need to be in configration=========== start of wsdl namespaces ===========
            def.setTargetNamespace(nameSpaceURI);
            def.addNamespace(WSDLNS, nameSpaceURI);
            def.addNamespace(TYPENS, typens);
            def.addNamespace(GLOBAL_TYPENS, globalTypens);
            def.addNamespace(SOAP, SOAP_NAMESPACE);
            def.addNamespace(XSD, XSD_NAMESPACE);
            def.addNamespace(CROSSCUT_PREFIX,"http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/");
            def.addNamespace(WSA_PREFIX,"http://www.w3.org/2005/08/addressing");

            if(GFacConstants.TRANSPORT_LEVEL.equals(security) || GFacConstants.MESSAGE_SIGNATURE.equals(security))
            {
                def.addNamespace(WSA_PREFIX, WSA_NAMESPACE);
                def.addNamespace("wsp", WSP_NAMESPACE);
                def.addNamespace("wsu", WSU_NAMESPACE);
                def.addNamespace("wspe", WSPE_NAMESPACE);
                def.addNamespace("sp", SP_NAMESPACE);
                def.addNamespace("wss10", WSS10_NAMESPACE);

                def.addNamespace("sp", SP_NAMESPACE);
                def.addNamespace("wst", WST_NAMESPACE);
            }
            // =========== end of wsdl namespaces ===========
           
           
           
           

            javax.xml.parsers.DocumentBuilderFactory domfactory =
                javax.xml.parsers.DocumentBuilderFactory.newInstance();
            javax.xml.parsers.DocumentBuilder builder = null;

            try
            {
                builder = domfactory.newDocumentBuilder();
            }
            catch (javax.xml.parsers.ParserConfigurationException e)
            {
                throw new GFacSchemaException("Parser configuration exception: " + e.getMessage());
            }

            DOMImplementation dImpl = builder.getDOMImplementation();

            String policyID = portName + "_Policy";
            String inputPolicyID = portName + "_operationPolicy";

            UnknownExtensibilityElement serviceLevelPolicRef = null;
            UnknownExtensibilityElement opLevelPolicRef = null;
           
            String namespace = GFacConstants.GFAC_NAMESPACE;
            Document doc = dImpl.createDocument(namespace, "factoryServices", null);

           
            //TODO this is boken fix it
            String description = serviceMap.getService().getServiceDescription();
            if(description != null){
               
                Element documentation = doc.createElementNS("http://schemas.xmlsoap.org/wsdl/","wsdl:documentation");
                documentation.appendChild(doc.createTextNode(description));
                def.setDocumentationElement(documentation);
            }
           

            if(GFacConstants.TRANSPORT_LEVEL.equals(security))
            {
                def.addExtensibilityElement(createTransportLevelPolicy(dImpl, policyID));
                serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
            }
            else if (GFacConstants.MESSAGE_SIGNATURE.equals(security))
            {
                def.addExtensibilityElement(WSPolicyGenerator.createServiceLevelPolicy(dImpl, policyID));
                def.addExtensibilityElement(WSPolicyGenerator.createOperationLevelPolicy(dImpl, "inputPolicy", inputPolicyID));
                serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
                opLevelPolicRef = createWSPolicyRef(dImpl, inputPolicyID);
            }

            // Create types
            Types types = TypesGenerator.addTypes(def, dImpl, serviceMap, typens, globalTypens, methods);
            def.setTypes(types);

//            if(!abstractWSDL)
//            {
//                table = createMessageTable(serviceMap, typens, methods);
//            }

            // Create port types (only first port type)
            PortTypeImpl portType = addPortTypes(def, dImpl, portTypes, serviceQName);
            Binding binding = addBinding(def, nameSpaceURI, portType, serviceLevelPolicRef,dImpl);

            Vector methodDesc = WSDLGenUtil.getMethodDescriptions(serviceMap);
            for(int i = 0; i < methods.length; ++i)
            {
                String methodName = methods[i].getMethodName();
                Vector outParams = WSDLGenUtil.getOutParams(serviceMap, methodName);
               
               
                OperationImpl operation = addOperation(def, dImpl, methodName, (String) methodDesc.get(i),typens,outParams);
                portType.addOperation(operation);
               
                if(!abstractWSDL)
                {
                    UnknownExtensibilityElement wsInPolicyRef = null;
                    UnknownExtensibilityElement wsOutPolicyRef = null;

                    BindingInputImpl bindingInput = addBindingInput(def, methodName, wsInPolicyRef);
                    BindingOutputImpl bindingOutput = addBindingOutput(def, methodName, outParams, wsOutPolicyRef);
                    BindingOperation bindingOperation = addBindingOperation(def, operation,dImpl);
                    bindingOperation.setBindingInput(bindingInput);
                    bindingOperation.setBindingOutput(bindingOutput);
                    binding.addBindingOperation(bindingOperation);

                    if(opLevelPolicRef != null)
                    {
                        binding.addExtensibilityElement(opLevelPolicRef);                    }

                }
            }
            def.addPortType(portType);

            // =========== end of wsdl binding ===========

// FIXME: This is done as factory information is not needed
//            if(abstractWSDL)
//            {
//
//
//                Element factoryServices = doc.createElement("n:factoryServices");
//                factoryServices.setAttribute("xmlns:n", namespace);
//                Element factoryService = doc.createElement("n:factoryService");
//                factoryService.setAttribute("location", "http://rainier.extreme.indiana.edu:12345");
//                factoryService.setAttribute("portType", "n:GenericFactory");
//                factoryService.setAttribute("operation", "n:CreateService");
//                factoryServices.appendChild(factoryService);
//                UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
//                elem.setElement(factoryServices);
//                def.addExtensibilityElement(elem);
//            }

            if (!abstractWSDL)
            {
                def.addBinding(binding);
                ServiceImpl service = (ServiceImpl) def.createService();
                service.setQName(wsdlQName);
               
                PortImpl port = (PortImpl) def.createPort();
                port.setName(wsdlQName.getLocalPart() + WSDL_PORT_SUFFIX);
                port.setBinding(binding);
                service.addPort(port);

                SOAPAddressImpl soapAddress = new SOAPAddressImpl();
                soapAddress.setLocationURI(serviceLocation);
                port.addExtensibilityElement(soapAddress);
                def.addService(service);
            }

            if(!abstractWSDL)
            {
                table.put(WSDL_QNAME, wsdlQName);
            }

            table.put(SERVICE_QNAME, serviceQName);

            ByteArrayOutputStream bs = new ByteArrayOutputStream();
            wsWriter.writeWSDL(def, bs);
            wsdlString = bs.toString();
        }
        catch (WSDLException e)
        {
            throw new GFacSchemaException("Error generating WSDL: " + e.getMessage());
View Full Code Here

        //Node node = wsBinding.getWSDLDefinition().getDefinition().getDocumentationElement();
        //Source source = new DOMSource(node);
       
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        try {
            WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
            writer.writeWSDL(wsBinding.getUserSpecifiedWSDLDefinition().getDefinition(), outStream);
        } catch (Exception ex){
            ex.printStackTrace();
        }
       
        //System.out.println(outStream.toString());
View Full Code Here

        // for debugging
        if (printWSDL) {
            try {
                System.out.println("Generated WSDL for Java interface " + javaInterface.getName() + " class " + javaInterface.getJavaClass().getName());
                WSDLWriter writer =  javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
                writer.writeWSDL(def, System.out);
            } catch (WSDLException e) {
                throw new WSDLGenerationException(e);
            }
        }
View Full Code Here

        // for debugging
        if (printWSDL) {
            try {
                System.out.println("Generated WSDL for " + component.getName() + "/" + contractName);
                WSDLWriter writer =  javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
                writer.writeWSDL(def, System.out);
            } catch (WSDLException e) {
                throw new WSDLGenerationException(e);
            }
        }
View Full Code Here

        }
        sf.getServiceFactory().setDataBinding(binding);
    }

    protected Collection<Document> getWSDLDocuments(String string) throws WSDLException {
        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();       

        Collection<Document> docs = new ArrayList<Document>();
        Definition definition = getWSDLDefinition(string);
        if (definition == null) {
            return null;
        }
        docs.add(writer.getDocument(definition));
       
        for (Import wsdlImport : WSDLDefinitionBuilder.getImports(definition)) {
            docs.add(writer.getDocument(wsdlImport.getDefinition()));
        }
        return docs;
    }
View Full Code Here

                        String publishingUrl =
                            String.valueOf(endpointInfo.getProperty("publishedEndpointUrl"));
                        updatePublishedEndpointUrl(publishingUrl, def, endpointInfo.getName());
                    }
       
                    WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
                        .getWSDLFactory().newWSDLWriter();
                    def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
                    doc = wsdlWriter.getDocument(def);
                }
            } else {
                SchemaReference si = smp.get(xsd);
                if (si == null) {
                    String xsd2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
View Full Code Here

    protected Document getWSDLDocument(String string) throws WSDLException {
        Definition definition = getWSDLDefinition(string);
        if (definition == null) {
            return null;
        }
        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
        return writer.getDocument(definition);
    }
View Full Code Here

                            String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
                        updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
                        base = epurl;
                    }
       
                    WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
                        .getWSDLFactory().newWSDLWriter();
                    def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
                    doc = wsdlWriter.getDocument(def);
                }
            } else {
                SchemaReference si = smp.get(xsd);
                if (si == null) {
                    String xsd2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
View Full Code Here

TOP

Related Classes of javax.wsdl.xml.WSDLWriter

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.