|
Apache CXF example source code file (WSDL11Generator.java)
The Apache CXF WSDL11Generator.java source code/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.cxf.tools.java2wsdl.generator.wsdl11; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.WSDLException; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLWriter; import org.w3c.dom.Element; import org.apache.cxf.common.WSDLConstants; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.helpers.XMLUtils; import org.apache.cxf.service.model.SchemaInfo; import org.apache.cxf.tools.common.ToolException; import org.apache.cxf.tools.java2wsdl.generator.AbstractGenerator; import org.apache.cxf.tools.util.FileWriterUtil; import org.apache.cxf.wsdl11.ServiceWSDLBuilder; import org.apache.cxf.wsdl11.WSDLDefinitionBuilder; public class WSDL11Generator extends AbstractGenerator<Definition> { public Definition generate(final File dir) { File file = getOutputBase(); if (file == null && dir != null) { if (dir.isDirectory()) { file = new File(dir, getServiceModel().getName().getLocalPart() + ".wsdl"); } else { file = dir; } } else if (dir == null) { file = new File(getServiceModel().getName().getLocalPart() + ".wsdl"); } File outputdir = createOutputDir(file); Definition def = null; try { Writer os = FileWriterUtil.getWriter(file); WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter(); ServiceWSDLBuilder builder = new ServiceWSDLBuilder(getBus(), getServiceModel()); builder.setUseSchemaImports(this.allowImports()); String name = file.getName(); if (name.endsWith(".wsdl")) { name = name.substring(0, name.lastIndexOf(".wsdl")); } builder.setBaseFileName(name); Map<String, SchemaInfo> imports = new HashMap Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF WSDL11Generator.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.