java 轴 2 会自动创建(并保存)wsdl 文件吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15994541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
does axis 2 automatically create (and save) wsdl file?
提问by bernie2436
I have a web service up and running with eclipse/tomcat/axis2. I want to get it linked to a bpel process, so I need the wsdl file. I can display the wsdl by starting the server and going to
我有一个使用 eclipse/tomcat/axis2 启动并运行的 Web 服务。我想让它链接到一个 bpel 进程,所以我需要 wsdl 文件。我可以通过启动服务器并转到
http://localhost:8080/axis2/services/MyService?wsdl
But if I search the directory structure for the project, I can't find the wsdl file. I can of course copy and paste the wsdl from the browser and save it as a text file, then point bpel to that wsdl. But it seems like axis 2 would generate (and save) a wsdl file for me, right?
但是如果我搜索项目的目录结构,我找不到wsdl文件。我当然可以从浏览器复制并粘贴 wsdl 并将其另存为文本文件,然后将 bpel 指向该 wsdl。但似乎轴 2 会为我生成(并保存)一个 wsdl 文件,对吗?
回答by Paul Vargas
By default, when you add ?wsdl
, Axis2 does not retrieve a previously generated WSDL document. It is generated every time.
But if you put the WSDL document file and the corresponding XML Schema files inside the META-INF
folder in the service archive file, it can be recovered with:
默认情况下,当您添加 时?wsdl
,Axis2 不会检索以前生成的 WSDL 文档。每次都会生成。但是,如果您将 WSDL 文档文件和相应的 XML Schema 文件放在META-INF
服务存档文件的文件夹中,则可以使用以下命令进行恢复:
http://localhost:8080/axis2/services/MyService.wsdl
The service name given in the services.xml
and the service name defined in the WSDL
document should be the same.
中给出services.xml
的服务名称和 WSDL 文档中定义的服务名称应该相同。
In another hand, if you want to save a generated WSDL document, simply run something like the following snippet as a Java Applicationon some class of your project, using the class org.apache.ws.java2wsdl.Java2WSDL
.
在另一个方面,如果要保存生成WSDL文档,只需运行像下面的代码片段为Java应用程序上的一些类项目的,使用类org.apache.ws.java2wsdl.Java2WSDL
。
public static void main(String[] args) throws Exception {
Java2WSDL.main("-cn com.abc.MyService".split("\s+"));
}
Once it has been executed, the generated WSDL document file and the corresponding XML Schema files you can find it in the folder of the project.
执行后,您可以在项目文件夹中找到生成的 WSDL 文档文件和相应的 XML Schema 文件。
To find out more options to use them with this tool, use the following:
要了解将它们与此工具一起使用的更多选项,请使用以下命令:
public static void main(String[] args) throws Exception {
Java2WSDL.printUsage();
}
回答by Amila Maharachchi
It doesn't keep a wsdl in the file system. You need to save it as .wsdl file and point your BPEL to it. Or else you can follow java2wsdl wizard as mentioned in http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.htmlto generate the wsdl from the code.
它不会在文件系统中保留 wsdl。您需要将其保存为 .wsdl 文件并将您的 BPEL 指向它。或者,您可以按照http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html 中提到的 java2wsdl 向导从代码生成 wsdl。