AIXS2 wsdl2java 要点说明

来源:互联网 发布:centos7 nginx负载均衡 编辑:程序博客网 时间:2024/06/11 17:00

Axis2是常用的一种SOAP engine,但是它提供的wsdl2Java的命令行工具的说明比较简单,没有具体的例子。下面举出几个例子:
  从最简单的开始 ,-uri 指定wsdl文件
  > WSDL2Java -uri currencyConvert.wsdl
  -d 使用不同的data binding方法
  > WSDL2Java -uri currencyConvert.wsdl -d XMLbeans
  -a 生成异步的方法
  > WSDL2Java -uri currencyConvert.wsdl -a
  -t 生成测试case
  > WSDL2Java -uri currencyConvert.wsdl -t ...
  稍微复杂一些的,-p可以指定生成的package,-o指定生成的路径,-ss生成服务端代码
  wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../gen_src -ss -sd -g -p foo.bat
  再复杂一些,-ns2p 将namespace进行替换,多个中间用逗号隔开
  wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../wsdl/gen_src -ss -sd -g -p com.foo.bar -ns2p "http://www.xxx.yyy.com/zzz/v1.0"=com.foo.bar,"http://www.xxx.yyy.com/ddd/v1.1"=com.foo.bar.goo

 

说明:

-u 生成数据绑定类

-p 指定导出包名,但不包括数据绑定类

-ns2p 指定导出包名,要使用完整的URL"http://www.xxx.yyy.com/zzz/v1.0"=com.foo.bar, 并加上引号;多个转换时,用逗号分隔

 

 

附命令说明:

Usage: WSDL2Java [options] -uri <url or path> : A url or path to a WSDL

where [options] include:
  -o <path>                Specify a directory path for the generated code.
  -a                       Generate async style code only (Default: off).
  -s                       Generate sync style code only (Default: off). Takes p
recedence over -a.
  -p <pkg1>                Specify a custom package name for the generated code.

  -l <language>            Valid languages are java and c (Default: java).
  -t                       Generate a test case for the generated code.
  -ss                      Generate server side code (i.e. skeletons) (Default:
off).
  -sd                      Generate service descriptor (i.e. services.xml). (Def
ault: off). Valid with -ss.
  -d <databinding>         Valid databinding(s) are adb, xmlbeans, jibx, jaxme a
nd jaxbri (Default: adb).
  -g                       Generates all the classes. Valid only with -ss.
  -pn <port_name>          Choose a specific port when there are multiple ports
in the wsdl.
  -sn <service_name>       Choose a specific service when there are multiple ser
vices in the wsdl.
  -u                       Unpacks the databinding classes
  -r <path>                Specify a repository against which code is generated.

  -ns2p ns1=pkg1,ns2=pkg2  Specify a custom package name for each namespace spec
ified in the wsdls schema.
  -ssi                     Generate an interface for the service implementation
(Default: off).
  -wv <version>            WSDL Version. Valid Options : 2, 2.0, 1.1
  -S                       Specify a directory path for generated source
  -R                       Specify a directory path for generated resources
  -em                      Specify an external mapping file
  -f                       Flattens the generated files
  -uw                      Switch on un-wrapping.
  -xsdconfig <file path>   Use XMLBeans .xsdconfig file. Valid only with -d xmlb
eans.
  -ap                      Generate code for all ports
  -or                      Overwrite the existing classes
  -b                       Generate Axis 1.x backword compatible code.
  -sp                      Suppress namespace prefixes (Optimzation that reduces
 size of soap request/response)
  -E<key> <value>          Extra configuration options specific to certain datab
indings. Examples:
                           -Ebindingfile <path>                   (for jibx) - s
pecify the file path for the binding file
                           -Etypesystemname <my_type_system_name> (for xmlbeans)
 - override the randomly generated type system name
                           -Emp <package name> (for ADB) - extension mapper pack
age name
                           -Eosv (for ADB) - off strict validation.
  --noBuildXML             Dont generate the build.xml in the output directory
  --noWSDL                 Dont generate WSDLs in the resources directory
  --noMessageReceiver      Dont generate a MessageReceiver in the generated sour
ces

原创粉丝点击