cxf使用详解

1.从阿帕奇官网下载apache-cxf-3.0.0.zip,解压后设置环境变量或在cmd环境下切换到bin目录

E:\apache-cxf-3.0.0-milestone1\bin>wsdl2java -h

2.以下是wsdl2java的帮助信息

wsdl2java

-fe|-frontend <front-end-name>

-db|-databinding <data-binding-name>

-wv <wsdl-version>

-p <[wsdl-namespace =]package-name>*

-sn <service-name>

-b <binding-file-name>*

-reserveClass <class-name>*

-catalog <catalog-file-name>

-d <output-directory>

-compile

-classdir <compile-classes-directory>

-impl

-server

-client

-clientjar <jar-file-name>

-all

-autoNameResolution

-allowElementReferences|-aer<=true>

-defaultValues<=class-name-for-DefaultValueProvider>

-ant

-nexclude <schema-namespace [= java-package-name]>*

-exsh <(true, false)> -noTypes -dns <Default value is true>

-dex <(true, false)>

-validate<[=all|basic|none]>

-keep

-wsdlLocation <wsdlLocation>

-xjc<xjc-arguments>*

-asyncMethods<[=method1,method2,...]>*

-bareMethods<[=method1,method2,...]>*

-mimeMethods<[=method1,method2,...]>*

-noAddressBinding

-faultSerialVersionUID <fault-serialVersionUID>

-encoding <encoding>

-exceptionSuper <exceptionSuper>

-mark-generated

-h|-?|-help

-version|-v -verbose|-V

-quiet|-q|-Q

-wsdlList <wsdlurl>


Options:

   -fe|-frontend <front-end-name>
                     Specifies the front end. (defaults to JAXWS)

   -db|-databinding <data-binding-name>
                     Specifies the data binding. (defaults to JAXB)

   -wv <wsdl-version>
                     Specifies the WSDL version. (default is WSDL1.1)

   -p <[wsdl-namespace =]package-name>*
                     Specifies the java package name to use for the generated  code. Optionally specify a WSDL namespace to Java package  name mapping.

   -sn <service-name>
                     Specify he WSDL service name to use for the generated code. Also, optionally specify the WSDL namespace.

   -b <binding-file-name>*
                     Specify an external jaxws or jaxb binding files. Use one -b  flag for each binding file.

   -reserveClass <class-name>*
                     Reserve a class name to keep the code generator from generating a class of the given name. In name cases, a
                     binding file or use of -autoNameResolution flag may be  necessary for the code generator to completely generate usable code.

   -catalog <catalog-file-name>
                     Specify catalog file to map the imported wsdl/schema.

   -d <output-directory>
                     Specify the directory into which the code is placed.

   -compile          Specifies that the generated code is compiled by the tool.

   -classdir <compile-classes-directory>
                     Specifies the directory into which compiled class files are placed.

   -impl             Specifies that a dummy service implementation is generated.

   -server           Specifies that server code is generated.

   -client           Specifies that client code is generated.

   -clientjar <jar-file-name>
                     Package all the client classes and wsdl in a jar file

   -all              Specifies that interfaces, types , service, server , dummy  impl, client and ant script are generated.

   -autoNameResolution
                     Specifies that the tool will attempt to resolve class naming conflicts without requiring the use of binding customizations.

   -allowElementReferences|-aer<=true>
                     allowElementReferences

   -defaultValues<=class-name-for-DefaultValueProvider>
                     Specifies that default values are generated for the dummy  implementation and client. You can specify the name of the
                     class to provide the default values. The default is  RandomValueProvider.

   -ant              Specifies that an ant build script is generated for the project.

   -nexclude <schema-namespace [= java-package-name]>*
                     Specifies a WSDL namespace to exclude when generating code.
                     This option can be specified multiple times. Optionally specify the Java package name to use for the WSDL namespace.

   -exsh <(true, false)>
                     Enables the processing of extended SOAP header message binding.

   -noTypes          Turns off generating types

   -dns <Default value is true>
                     Enables loading the default namespace package name mapping. The default is true.

   -dex <(true, false)>
                     Enable loading the default excludes namespace mapping. The default is true.

   -validate<[=all|basic|none]>
                     Specifies that the WSDL is validated before generating the  code. Using this option is highly recommended. By default,
                     only very basic validation is done to make sure the WSDL meets the WSI-BasicProfile standards that CXF requires.
                     -validate=none can turn off those checks while -validate or
                     -validate=all turns on additional schema validation and other checks.

   -keep             Specifies that existing code will not be over written.
                     NOTE: You will have to solve any resulting compilation problems by yourself

   -wsdlLocation <wsdlLocation>
                     Specifies the value of the @WebServiceClient annotation's wsdlLocation property.

   -xjc<xjc-arguments>*
                     Specifies a comma separated list of arguments that are  passed directly to XJC when the JAXB data binding is used.
                     This option causes XJC to load additional plugins that augment code generation. For example to load the
                     toString(ts) plugin that will add a toString() method to  all generated types the following <xjc arguments> would be
                     used: -xjc-Xts A list of available XJC plugins can be obtained by using -xjc-X.

   -asyncMethods<[=method1,method2,...]>*
                     Specifies a comma separated list of methods that should  have asynchronous version generated in addition to the
                     normal synchronous versions. If no methods are listed, all  methods are generated with asynchronous versions.

   -bareMethods<[=method1,method2,...]>*
                     Specifies a comma separated list of methods that should not be unwrapped into individual parameters and instead be left in their "bare" form.

   -mimeMethods<[=method1,method2,...]>*
                     Specifies a comma separated list of methods where the  mime:content information is used to generate the type.

   -noAddressBinding Specifies that the generator should not use the address
                     jaxb binding file to map wsa:EndpointReferenceType or  wsa:EndpointReference to
                     javax.xml.ws.wsaddressing.W3CEndpointReference.

   -faultSerialVersionUID <fault-serialVersionUID>
                     Specifies how to generate fault Exception's SUID, can use  NONE|TIMESTAMP|FQCN|####", the default is NONE. FQCN uses a
                     hash of the fully qualified class name. #### would be any  valid Long to use as the SUID.

   -encoding <encoding>
                     Specifies the charset encoding to use when generating java sources

   -exceptionSuper <exceptionSuper>
                     Specifies the superclass to use for generated exceptions, the default is java.lang.Exception.

   -mark-generated   Adds @Generated annotation in all java files that are generated.

   -h|-?|-help       Display detailed information for options.

   -version|-v       Display the version of the tool.

   -verbose|-V       Specifies that the generator runs in verbose mode.

   -quiet|-q|-Q      Specifies that the generator runs in quiet mode.

   -wsdlList         Indicates the wsdlurl is a plain text list of wsdlurls that are new line delimited. As an example the wsdlurl might point to
                     http://127.0.0.1:8080/context_path/ws?formatted=false&wsdlL
                     ist=true on a cxf server.

   <wsdlurl>         wsdl-url

3、cxf命令,生成全部(服务端、客户端、实现类)

wsdl2java -p com.unime.tianqi.services.impl -d c:\wsdl2java -all -encoding UTF-8 http://webservice.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl

4、cxf分解执行

4.1生成实现

wsdl2java -p com.unime.tianqi.services.impl -d c:\wsdl2java -impl -encoding UTF-8 http://webservice.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl
4.2生成服务端
wsdl2java -p com.unime.tianqi.services.server -d c:\wsdl2java -server -encoding UTF-8 http://webservice.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl
4.3生成客户端
wsdl2java -p com.unime.tianqi.services.client -d c:\wsdl2java -client -encoding UTF-8 http://webservice.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值