⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java2wsdl.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright 2001-2004 The Apache Software Foundation. *  * Licensed 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.axis.wsdl;import org.apache.axis.utils.CLArgsParser;import org.apache.axis.utils.CLOption;import org.apache.axis.utils.CLOptionDescriptor;import org.apache.axis.utils.CLUtil;import org.apache.axis.utils.ClassUtils;import org.apache.axis.utils.Messages;import org.apache.axis.wsdl.fromJava.Emitter;import org.apache.axis.encoding.TypeMappingRegistryImpl;import org.apache.axis.encoding.TypeMappingImpl;import java.io.File;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;/** * Command line interface to the java2wsdl utility *  * @author Ravi Kumar (rkumar@borland.com) * @author Rich Scheuerle (scheu@us.ibm.com) */public class Java2WSDL {    // Define our short one-letter option identifiers.    /** Field INHERITED_CLASS_OPT */    protected static final int INHERITED_CLASS_OPT = 'a';    /** Field SOAPACTION_OPT */    protected static final int SOAPACTION_OPT = 'A';    /** Field BINDING_NAME_OPT */    protected static final int BINDING_NAME_OPT = 'b';    /** Field STOP_CLASSES_OPT */    protected static final int STOP_CLASSES_OPT = 'c';    /** Field IMPORT_SCHEMA_OPT */    protected static final int IMPORT_SCHEMA_OPT = 'C';    /** Field EXTRA_CLASSES_OPT */    protected static final int EXTRA_CLASSES_OPT = 'e';    /** Field HELP_OPT */    protected static final int HELP_OPT = 'h';    /** Field IMPL_CLASS_OPT */    protected static final int IMPL_CLASS_OPT = 'i';    /** Field INPUT_OPT */    protected static final int INPUT_OPT = 'I';    /** Field LOCATION_OPT */    protected static final int LOCATION_OPT = 'l';    /** Field LOCATION_IMPORT_OPT */    protected static final int LOCATION_IMPORT_OPT = 'L';    /** Field METHODS_ALLOWED_OPT */    protected static final int METHODS_ALLOWED_OPT = 'm';    /** Field NAMESPACE_OPT */    protected static final int NAMESPACE_OPT = 'n';    /** Field NAMESPACE_IMPL_OPT */    protected static final int NAMESPACE_IMPL_OPT = 'N';    /** Field OUTPUT_OPT */    protected static final int OUTPUT_OPT = 'o';    /** Field OUTPUT_IMPL_OPT */    protected static final int OUTPUT_IMPL_OPT = 'O';    /** Field PACKAGE_OPT */    protected static final int PACKAGE_OPT = 'p';    /** Field PORTTYPE_NAME_OPT */    protected static final int PORTTYPE_NAME_OPT = 'P';    /** Field SERVICE_PORT_NAME_OPT */    protected static final int SERVICE_PORT_NAME_OPT = 's';    /** Field SERVICE_ELEMENT_NAME_OPT */    protected static final int SERVICE_ELEMENT_NAME_OPT = 'S';    /** Field TYPEMAPPING_OPT */    protected static final int TYPEMAPPING_OPT = 'T';    /** Field USE_OPT */    protected static final int USE_OPT = 'u';    /** Field OUTPUT_WSDL_MODE_OPT */    protected static final int OUTPUT_WSDL_MODE_OPT = 'w';    /** Field METHODS_NOTALLOWED_OPT */    protected static final int METHODS_NOTALLOWED_OPT = 'x';    protected static final int CLASSPATH_OPT = 'X';    /** Field STYLE_OPT */    protected static final int STYLE_OPT = 'y';            /** Field DEPLOY_OPT */    protected static final int DEPLOY_OPT = 'd';    /**     * Define the understood options. Each CLOptionDescriptor contains:     * - The "long" version of the option. Eg, "help" means that "--help" will     * be recognised.     * - The option flags, governing the option's argument(s).     * - The "short" version of the option. Eg, 'h' means that "-h" will be     * recognised.     * - A description of the option for the usage message     */    protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{        new CLOptionDescriptor("help", CLOptionDescriptor.ARGUMENT_DISALLOWED,                HELP_OPT, Messages.getMessage("j2wopthelp00")),        new CLOptionDescriptor("input", CLOptionDescriptor.ARGUMENT_REQUIRED,                INPUT_OPT, Messages.getMessage("j2woptinput00")),        new CLOptionDescriptor("output", CLOptionDescriptor.ARGUMENT_REQUIRED,                OUTPUT_OPT,                Messages.getMessage("j2woptoutput00")),        new CLOptionDescriptor("location",                CLOptionDescriptor.ARGUMENT_REQUIRED,                LOCATION_OPT,                Messages.getMessage("j2woptlocation00")),        new CLOptionDescriptor("portTypeName",                CLOptionDescriptor.ARGUMENT_REQUIRED,                PORTTYPE_NAME_OPT,                Messages.getMessage("j2woptportTypeName00")),        new CLOptionDescriptor("bindingName",                CLOptionDescriptor.ARGUMENT_REQUIRED,                BINDING_NAME_OPT,                Messages.getMessage("j2woptbindingName00")),        new CLOptionDescriptor(                "serviceElementName", CLOptionDescriptor.ARGUMENT_REQUIRED,                SERVICE_ELEMENT_NAME_OPT,                Messages.getMessage("j2woptserviceElementName00")),        new CLOptionDescriptor("servicePortName",                CLOptionDescriptor.ARGUMENT_REQUIRED,                SERVICE_PORT_NAME_OPT,                Messages.getMessage("j2woptservicePortName00")),        new CLOptionDescriptor("namespace",                CLOptionDescriptor.ARGUMENT_REQUIRED,                NAMESPACE_OPT,                Messages.getMessage("j2woptnamespace00")),        new CLOptionDescriptor("PkgtoNS",                CLOptionDescriptor.DUPLICATES_ALLOWED            + CLOptionDescriptor.ARGUMENTS_REQUIRED_2,                PACKAGE_OPT,                Messages.getMessage("j2woptPkgtoNS00")),        new CLOptionDescriptor("methods",                CLOptionDescriptor.DUPLICATES_ALLOWED            + CLOptionDescriptor.ARGUMENT_REQUIRED,                METHODS_ALLOWED_OPT,                Messages.getMessage("j2woptmethods00")),        new CLOptionDescriptor("all", CLOptionDescriptor.ARGUMENT_DISALLOWED,                INHERITED_CLASS_OPT,                Messages.getMessage("j2woptall00")),        new CLOptionDescriptor("outputWsdlMode",                CLOptionDescriptor.ARGUMENT_REQUIRED,                OUTPUT_WSDL_MODE_OPT,                Messages.getMessage("j2woptoutputWsdlMode00")),        new CLOptionDescriptor("locationImport",                CLOptionDescriptor.ARGUMENT_REQUIRED,                LOCATION_IMPORT_OPT,                Messages.getMessage("j2woptlocationImport00")),        new CLOptionDescriptor("namespaceImpl",                CLOptionDescriptor.ARGUMENT_REQUIRED,                NAMESPACE_IMPL_OPT,                Messages.getMessage("j2woptnamespaceImpl00")),        new CLOptionDescriptor("outputImpl",                CLOptionDescriptor.ARGUMENT_REQUIRED,                OUTPUT_IMPL_OPT,                Messages.getMessage("j2woptoutputImpl00")),        new CLOptionDescriptor("implClass",                CLOptionDescriptor.ARGUMENT_REQUIRED,                IMPL_CLASS_OPT,                Messages.getMessage("j2woptimplClass00")),        new CLOptionDescriptor("exclude",                CLOptionDescriptor.DUPLICATES_ALLOWED            + CLOptionDescriptor.ARGUMENT_REQUIRED,                METHODS_NOTALLOWED_OPT,                Messages.getMessage("j2woptexclude00")),        new CLOptionDescriptor("stopClasses",                CLOptionDescriptor.DUPLICATES_ALLOWED            + CLOptionDescriptor.ARGUMENT_REQUIRED,                STOP_CLASSES_OPT,                Messages.getMessage("j2woptstopClass00")),        new CLOptionDescriptor("typeMappingVersion",                CLOptionDescriptor.ARGUMENT_REQUIRED,                TYPEMAPPING_OPT,                Messages.getMessage("j2wopttypeMapping00")),        new CLOptionDescriptor("soapAction",                CLOptionDescriptor.ARGUMENT_REQUIRED,                SOAPACTION_OPT,                Messages.getMessage("j2woptsoapAction00")),        new CLOptionDescriptor("style", CLOptionDescriptor.ARGUMENT_REQUIRED,                STYLE_OPT, Messages.getMessage("j2woptStyle00")),        new CLOptionDescriptor("use", CLOptionDescriptor.ARGUMENT_REQUIRED,                USE_OPT, Messages.getMessage("j2woptUse00")),        new CLOptionDescriptor("extraClasses",                CLOptionDescriptor.DUPLICATES_ALLOWED            + CLOptionDescriptor.ARGUMENT_REQUIRED,                EXTRA_CLASSES_OPT,                Messages.getMessage("j2woptExtraClasses00")),        new CLOptionDescriptor("importSchema",                CLOptionDescriptor.ARGUMENT_OPTIONAL,                IMPORT_SCHEMA_OPT,                Messages.getMessage("j2woptImportSchema00")),        new CLOptionDescriptor("classpath",                CLOptionDescriptor.ARGUMENT_OPTIONAL,                CLASSPATH_OPT,                Messages.getMessage("optionClasspath")),        new CLOptionDescriptor("deploy",                        CLOptionDescriptor.ARGUMENT_DISALLOWED,                        DEPLOY_OPT,                        Messages.getMessage("j2woptDeploy00")),    };    /** Field emitter */    protected Emitter emitter;    /** Field className */    protected String className = null;    /** Field wsdlFilename */    protected String wsdlFilename = null;    /** Field wsdlImplFilename */    protected String wsdlImplFilename = null;    /** Field namespaceMap */    protected HashMap namespaceMap = new HashMap();    /** Field mode */    protected int mode = Emitter.MODE_ALL;    /** Field locationSet */    boolean locationSet = false;    /** Field typeMappingVersion */    protected String typeMappingVersion = "1.2";        /** Field isDeplpy */    protected boolean isDeploy = false;        /**     * Instantiate a Java2WSDL emitter.     */    protected Java2WSDL() {        emitter = createEmitter();    }    // ctor    /**     * Instantiate an Emitter     *      * @return      */    protected Emitter createEmitter() {        return new Emitter();    }    // createEmitter    /**     * addOptions     * Add option descriptions to the tool.  Allows     * extended classes to add additional options.     *      * @param newOptions CLOptionDescriptor[] the options     */    protected void addOptions(CLOptionDescriptor[] newOptions) {        if ((newOptions != null) && (newOptions.length > 0)) {            CLOptionDescriptor[] allOptions =                    new CLOptionDescriptor[options.length + newOptions.length];            System.arraycopy(options, 0, allOptions, 0, options.length);            System.arraycopy(newOptions, 0, allOptions, options.length,                    newOptions.length);            options = allOptions;        }    }    /**     * Parse an option     *      * @param option CLOption is the option     * @return      */    protected boolean parseOption(CLOption option) {        String value;        boolean status = true;        switch (option.getId()) {            case CLOption.TEXT_ARGUMENT:                if (className != null) {                    System.out.println(                            Messages.getMessage(                                    "j2wDuplicateClass00", className,                                    option.getArgument()));                    printUsage();                    status = false;    // error                }                className = option.getArgument();                break;            case METHODS_ALLOWED_OPT:                emitter.setAllowedMethods(option.getArgument());                break;            case INHERITED_CLASS_OPT:                emitter.setUseInheritedMethods(true);                break;            case IMPL_CLASS_OPT:                emitter.setImplCls(option.getArgument());                break;            case HELP_OPT:                printUsage();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -