轴 2 会自动创建(并保存)wsdl 文件吗?
我有一个使用 eclipse/tomcat/axis2 启动并运行的 Web 服务.我想让它链接到一个 bpel 进程,所以我需要 wsdl 文件.我可以通过启动服务器来显示 wsdl 并转到
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
http://localhost:8080/axis2/services/MyService?wsdl
但是如果我搜索项目的目录结构,我找不到 wsdl 文件.我当然可以从浏览器复制并粘贴 wsdl 并将其保存为文本文件,然后将 bpel 指向该 wsdl.但似乎轴 2 会为我生成(并保存)一个 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
时,Axis2 不会检索以前生成的 WSDL 文档.每次都会生成.但是如果将 WSDL 文档文件和相应的 XML Schema 文件放在服务归档文件的 META-INF
文件夹中,则可以通过以下方式恢复:
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:
http://localhost:8080/axis2/services/MyService.wsdl
services.xml
中给出的服务名称和 WSDL 中定义的服务名称文件应该是一样的.
The service name given in the services.xml
and the service name defined in the WSDL
document should be the same.
另一方面,如果您想保存生成的 WSDL 文档,只需使用类 org.apache.ws.java2wsdl.Java2WSDL
.
In another hand, if you want to save a generated WSDL document, simply run something like the following snippet as a Java Application on some class of your project, using the class org.apache.ws.java2wsdl.Java2WSDL
.
public static void main(String[] args) throws Exception {
Java2WSDL.main("-cn com.abc.MyService".split("\s+"));
}
执行后,生成的 WSDL 文档文件和对应的 XML Schema 文件可以在项目的文件夹中找到.
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.
要了解更多选项以使用此工具,请使用以下内容:
To find out more options to use them with this tool, use the following:
public static void main(String[] args) throws Exception {
Java2WSDL.printUsage();
}
相关文章