《《精编》论eclipse根据wsdl文件生成webservice客户端》由会员分享,可在线阅读,更多相关《《精编》论eclipse根据wsdl文件生成webservice客户端(8页珍藏版)》请在金锄头文库上搜索。
1、neclipse根据wsdl文件生成webservice客户端一、 前期准备:1、配置log4j没有配置的场合提示下列的信息(可以不配置):(log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).log4j:WARN Please initialize the log4j system properly.Error: Missing argument to option -p)log4j.properties文件内容:log4j.rootLogger=info
2、,stdout,R# # Console Appender #log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target=System.outlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%XLKV %dyyyy-MM-dd HH:mm:ss,SSS %c %t %L %p - %m%n# # File Appender #
3、log4j.appender.R=org.apache.log4j.DailyRollingFileAppender#log4j.appender.R.File=$WORKDIR/TestWebService/WebRoot/logs/out.log#log4j.appender.R.File=$catalina.home/WebRoot/logs/out.loglog4j.appender.R.File=D:/logs/TestWebService.loglog4j.appender.R.DatePattern = .yyyy-MM-ddlog4j.appender.R.layout=org
4、.apache.log4j.PatternLayoutlog4j.appender.R.layout.ConversionPattern=%XLKV %dyyyy-MM-dd HH:mm:ss,SSS %c %t %L %p - %m%n# # log level# .ibatis=mon.jdbc.SimpleDataSource=mon.jdbc.ScriptRunner=.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debuglog4j.logger.java.sql.Connection=debuglog4j.logger.java.s
5、ql.Statement=debuglog4j.logger.java.sql.PreparedStatement=debug,stdoutlog4j.logger.java.sql.PreparedStatement=debug,stdout,R.jiahelife=.jiahelife.platform=error2、log4j使用jar包:log4j-1.2.8.jarcommons-discovery-0.2.jarcommons-logging.jar3、wsdl使用jar包:axis.jarwsdl4j-1.5.1.jar二、 开始生成文件:具体操作如下图:选中Include li
6、braries when searching for a main class复选框;然后点击Search按钮进入如下的画面,在输入框中输入WSDL2Java点击【OK】按钮进入下图:点击Arguments的页面,进行如下设置:21说明:1、WSDL文件生成的XML文件 2、XML文件所在工作目录,以及生成后java文件的存放目录。点击【Run】后生成文件。三、项目结构图:com文件夹就是生成后的wsdl代码。四、补充说明1、arguments标签栏里输入参数参考: -h, -help print this message and exit -v, -verbose print informa
7、tional messages -n, -noImports only generate code for the immediate WSDL document -O, -timeout 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
8、messages (except err ors) -s, -server-side emit server-side bindings for web service -S, -skeletonDeploy deploy skeleton (true) or implementation (false) in deploy.w sdd. Default is false. Assumes -server-side. -N, -NStoPkg = mapping of namespace to package -f, -fileNStoPkg file of NStoPkg mappings
9、(default NStoPkg.properties) -p, -package override all namespace to package mappings, use this package name instead -o, -output output directory for emitted files -d, -deployScope add scope to deploy.wsdd: Application, Request, Session -t, -testCase emit junit testcase class for web service -a, -all
10、 generate code for all elements, even unreferenced ones -T, -typeMappingVersion 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 name of a custom class that implements GeneratorFactory inte rface (for extending Java generation functi
11、ons) -H, -helperGen emits separate Helper classes for meta data -B, -buildFile emit Ant Buildfile for web service -U, -user username to access the WSDL-URI -P, -password password to access the WSDL-URI -X, -classpath additional classpath elements -i, -nsInclude include namespace in generated code -x
12、, -nsExclude exclude namespace from generated code -c, -implementationClassName 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).