使用本地WSDL文件生成Metro Client [英] Generating Metro Client Using Local WSDL File

查看:213
本文介绍了使用本地WSDL文件生成Metro Client的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前使用wsimport生成了Metro客户端,但是在那种情况下,WSDL是通过https访问的.我的命令如下:

I have generated a Metro client using wsimport before, but in that case the WSDL was accessed over https. My commaned looked like this:

wsimport https://service.net/services/Service?wsdl -d C:\ClientProject\src\main\java -keep

,一切正常.现在,我试图生成一个客户端,但是,我只有WSDL文件的本地副本.我的项目目录是这样设置的(在c:\ Devel中):

and everything worked fine. Now I am trying to generate a client, however, I only have a local copy of the WSDL file. My project directory is set up like this (in c:\Devel):

ClientProject
  |- src
     |- main
        |- java
     |- resources
        |- META-INF
           |- service.wsdl
  |- wsimport.bat

wsimport.bat文件如下所示:

The wsimport.bat file looks like this:

wsimport -keep -d ../src/main/java -wsdlLocation ../src/resources/META-INF/service.wsdl

基于Metro指南示例,但没有-p选项(http://metro.java.net/guide/Developing_client_application_with_locally_packaged_WSDL.html).但是,当我运行bat文件时,我得到了不断循环的命令打印到控制台的循环.例如

which was based on the Metro Guide example but without the -p option (http://metro.java.net/guide/Developing_client_application_with_locally_packaged_WSDL.html). However, when I run the bat file, I get an endless loop of of the command being printed to the console. E.g.

C:\Devel\ClientProject>wsimport -keep -d ../src/main/java -wsdlLocation ../src/resources/META-INF/service.wsdl

有人可以指出我在做什么错吗?

Can somebody point out what I'm doing wrong?

更新

我尝试使用绝对路径(并且重新排列参数顺序无济于事.我仍然得到无尽的命令控制台打印信息:

I have tried using absolute paths (and rearranging the param order to no avail. I still get the endless command console prints:

wsimport C:\Devel\ClientProject\src\resources\META-INF\service.wsdl -d C:\Devel\ClientProject\src\main\java -keep

推荐答案

如果使用.bat文件运行wsimport命令,请不要将其命名为wsimport,否则您将陷入无休止的递归循环中,对该文件进行调用.

If using a .bat file to run the wsimport command, do not name it wsimport or you'll be in an endless recursive loop calling that file.

此外,-wsdllocation"区分大小写. "-wsdlLocation"不起作用(尽管我在搜索过程中看到了很多示例).

Also, "-wsdllocation" is case sensitive. "-wsdlLocation" will not work (although I've seen many examples of it during my searches).

此wsimport命令从本地WSDL生成客户端代码,并在Service类的@WebServiceClient批注上设置"wsdlLocation"属性:

This wsimport command generates the client code from the local WSDL and sets the "wsdlLocation" attribute on the Service class' @WebServiceClient annotation:

wsimport src/resources/META-INF/service.wsdl -keep -d src/main/java -wsdllocation META-INF/service.wsdl

这篇关于使用本地WSDL文件生成Metro Client的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆