webservice用wsdl2java来生成客户端(操作简单方便)
2015-04-10 14:52
399 查看
打开Eclipse,Run--> Run Configurations,在Main class框里 输入 WSDL2Java 进行搜索,前提是你的工程里已加入axis的jar包,
会搜索到org.apache.axis.wsdl.WSDL2Java,在arguments标签栏里输入参数,默认基础目录为当前工程,参数如下所示:
src\\cfg\\test.wsdl -p com.xxx.xxx.xxx.client -t
这是wsdl文件在本地的情况,如果不是本地的wsdl文件,那么而是网址方式的(如:http://xxx:8080/xxx/xxx/xxx?wsdl),那么就输入: http://xxx:8080/xxx/xxx/xxx?wsdl -p com.xxx.xxx.xxx.client -t
这是比较简单的生成客户端代码参数,运行就可以,刷新工程,会与src同级的地方出现com.test.outsys.prod.client之前设置的包名 ,
复制到src下即可。
其他参数使用方法:
-h, --help
print this message and exit
-v, --verbose
print informational messages
-n, --noImports
only generate code for the immediate WSDL document
-O, --timeout <argument>
timeout in seconds (default is 45, specify -1 to disable)
-D, --Debug
print debug information
-W, --noWrapped
turn off support for "wrapped" document/literal
-q, --quiet
do not print any informational or debug messages (except err
ors)
-s, --server-side
emit server-side bindings for web service
-S, --skeletonDeploy <argument>
deploy skeleton (true) or implementation (false) in deploy.w
sdd. Default is false. Assumes --server-side.
-N, --NStoPkg <argument>=<value>
mapping of namespace to package
-f, --fileNStoPkg <argument>
file of NStoPkg mappings (default NStoPkg.properties)
-p, --package <argument>
override all namespace to package mappings, use this package
name instead
-o, --output <argument>
output directory for emitted files
-d, --deployScope <argument>
add scope to deploy.wsdd: "Application", "Request", "Session
"
-t, --testCase
emit junit testcase class for web service
-a, --all
generate code for all elements, even unreferenced ones
-T, --typeMappingVersion <argument>
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
ompliant. 1.2 indicates SOAP 1.1 encoded.)
-F, --factory <argument>
name of a custom class that implements GeneratorFactory inte
rface (for extending Java generation functions)
-H, --helperGen
emits separate Helper classes for meta data
-B, --buildFile
emit Ant Buildfile for web service
-U, --user <argument>
username to access the WSDL-URI
-P, --password <argument>
password to access the WSDL-URI
-X, --classpath
additional classpath elements
-i, --nsInclude <argument>
include namespace in generated code
-x, --nsExclude <argument>
exclude namespace from generated code
-c, --implementationClassName <argument>
custom name of web service implementation
-u, --allowInvalidURL
emit file even if WSDL endpoint URL is not a valid URL
-w, --wrapArrays
Prefers building beans to straight arrays for wrapped XML ar
ray types (defaults to off).
会搜索到org.apache.axis.wsdl.WSDL2Java,在arguments标签栏里输入参数,默认基础目录为当前工程,参数如下所示:
src\\cfg\\test.wsdl -p com.xxx.xxx.xxx.client -t
这是wsdl文件在本地的情况,如果不是本地的wsdl文件,那么而是网址方式的(如:http://xxx:8080/xxx/xxx/xxx?wsdl),那么就输入: http://xxx:8080/xxx/xxx/xxx?wsdl -p com.xxx.xxx.xxx.client -t
这是比较简单的生成客户端代码参数,运行就可以,刷新工程,会与src同级的地方出现com.test.outsys.prod.client之前设置的包名 ,
复制到src下即可。
其他参数使用方法:
-h, --help
print this message and exit
-v, --verbose
print informational messages
-n, --noImports
only generate code for the immediate WSDL document
-O, --timeout <argument>
timeout in seconds (default is 45, specify -1 to disable)
-D, --Debug
print debug information
-W, --noWrapped
turn off support for "wrapped" document/literal
-q, --quiet
do not print any informational or debug messages (except err
ors)
-s, --server-side
emit server-side bindings for web service
-S, --skeletonDeploy <argument>
deploy skeleton (true) or implementation (false) in deploy.w
sdd. Default is false. Assumes --server-side.
-N, --NStoPkg <argument>=<value>
mapping of namespace to package
-f, --fileNStoPkg <argument>
file of NStoPkg mappings (default NStoPkg.properties)
-p, --package <argument>
override all namespace to package mappings, use this package
name instead
-o, --output <argument>
output directory for emitted files
-d, --deployScope <argument>
add scope to deploy.wsdd: "Application", "Request", "Session
"
-t, --testCase
emit junit testcase class for web service
-a, --all
generate code for all elements, even unreferenced ones
-T, --typeMappingVersion <argument>
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
ompliant. 1.2 indicates SOAP 1.1 encoded.)
-F, --factory <argument>
name of a custom class that implements GeneratorFactory inte
rface (for extending Java generation functions)
-H, --helperGen
emits separate Helper classes for meta data
-B, --buildFile
emit Ant Buildfile for web service
-U, --user <argument>
username to access the WSDL-URI
-P, --password <argument>
password to access the WSDL-URI
-X, --classpath
additional classpath elements
-i, --nsInclude <argument>
include namespace in generated code
-x, --nsExclude <argument>
exclude namespace from generated code
-c, --implementationClassName <argument>
custom name of web service implementation
-u, --allowInvalidURL
emit file even if WSDL endpoint URL is not a valid URL
-w, --wrapArrays
Prefers building beans to straight arrays for wrapped XML ar
ray types (defaults to off).
相关文章推荐
- webservice wsdl2Java 生成客户端代码
- 利用wsdl2java生成本地WebService客户端
- 关于 wsdl2Java 自动生成客户端调取webservice接口
- webService 根据wsdl地址生成java客户端代码
- 利用wsdl2java工具生成webservice的客户端代码
- wsdl2java 生成webservice客户端
- 利用WSDL2java 生成cxf webservice 客户端代码
- CXF中wsdl2java命令生成webService客户端代码
- axis2通过wsdl2java.bat生成webservice异步客户端程序
- Web Service学习笔记(webservice、soap、wsdl、jws详细分析) Webservice的wsdl文件解析与Soap消息的发送、接收(不生成java客户端代码)
- java 使用cxf webservice客户端最简单实例,方便实用
- 利用wsdl2java工具生成webservice的客户端代码,编码问题
- 利用wsdl2java工具生成webservice的客户端代码
- 使用Axis2 wsdl2java命令生成webservice客户端
- 利用wsdl文件生成webservice接口的java客户端测试代码
- 利用wsdl2java工具生成webservice的客户端代码
- cxf发布webservice简介 及 wsdl2java生成客户端代码
- Webservice的wsdl文件解析与Soap消息的发送、接收(不生成java客户端代码)
- doc下通过wsdl2java命令生成webservice客户端
- wsdl2java 生成webService客户端代码,并读取数据