目前J2EE中使用的web serivce的主流技术有JAX-WS2.0, CXF, AXIS2等,这些技术都能作为WSDL1.1, 1,2服务器或者客户端。JAX-WS2.0, CXF, AXIS2这些技术各有优缺点, 相互之间也会有一些类库冲突,一般在一个公司内部都会采用欧一种技术作为web service的实现。我们用的是jboss 的jax-ws实现。
最近在项目中遇到了一个和billing system集成的任务, 这个系统发布得有6,7年了,用软件开发的术语来描述就是和Legacy System集成。从客户那边拿到了一个使用rpc/encoding作为binding style的wsdl文件,用这个wsdl生成客户端的stub类。尝试了jax-ws的wsimport,得到"jax ws - java: Rpc/encoded wsdls are not supported in JAXWS 2.0"的错误,wsimport不支持rpc/encoding。
说一下最终目标:
1)使用wsdl文件生成一个web service的服务器作为模拟器,用于集成测试
2)生成一个client,部署于jbossesb 4.8中作为客户端调用web serivce
通过比较最终得出
wsdl2java(AXIS2) 用于生成web service的服务器作为模拟器
wscompile(AXIS) 生成客户端stub
Part 1 使用wsdl2java(AXIS2)生成web service的服务器作为模拟器
Use Axis2 to implement the axis web service:
1) Use Axis2 wsdl2java to generate source code(use ant in maven)
2) wsdl2java config: -ss -wsdl 1.1 ...
3) Add dependencies
4) copy generated xsd file to classes folder
5) copy wsdl file to
6) modify services.xml to use a mock service implemenation
<!-- The following dependencies are used to generate the server side source code from wsdl. -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
... ...
</dependencies>
<build>
<plugins>
<!-- use ant to call wsdl2java to generate the java source code, see detail in build.xml -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<ant antfile="${basedir}/build.xml" target="generate.server" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- add the generated source code to source path -->
<plugin>
... ...
</plugin>
<!-- copy generated xsd files to WEB-INF/classes -->
<plugin>
... ...
</plugin>
</plugins>
Use ant script to run wsdl2java to generate client side stub.
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true" classpath="${compile_classpath}">
<arg line="-uri ./src/main/webapp/WEB-INF/services/GreatLakes/META-INF/IOBISMSClient.wsdl" />
<arg line="-s" />
<arg line="-ss" />
<arg line="-sd" />
<arg line="-wv 1.1" />
<arg line="-l java" />
<arg line="-p net.beaumaris.billing.gl.mockservice" />
<arg line="-d xmlbeans" />
<arg line="-o ./target/generated-sources/xjc" />
</java>
</target>
Part 2 使用wscompile(AXIS) 生成客户端stub
TBD
分享到:
相关推荐
WSDL规范目前最新的版本是2.0 ,但是目前大部分还是按1.1的版本进行使用,而且1.1的内容看上去比2.0也简单些,所以我就翻译了这个版本。 作为一种《炒作过度的技术和概念》的一类,WEB Service的确是太过重量级,...
WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范1.1版WSDL中文规范...
尽管很流行,但是 WSDL 1.1 仍然有一些问题,包括使用的模式很多,而且 Web 服务处理 WSDL 文档的方法各异。根据其中一个模式版本编写的文档一般与其
WSDL-中文规范1.1
对wsdl的格式进行分析,主要讲解soap服务中rpc和doucumnet的不同之处。
WSDL官方标准规范,方便随时参考
Java调用以WSDL形式发布的web service.docJava调用以WSDL形式发布的web service.docJava调用以WSDL形式发布的web service.docJava调用以WSDL形式发布的web service.docJava调用以WSDL形式发布的web service.docv
NC65版本uapstudio安装wsdl文件生成工具插件
Web Service描述语言 WSDL 详解
Web Service描述语言 WSDL 详解.pdf
使用 WSDL 部署 Web 服务 使用 WSDL 部署 Web 服务
Web Service描述语言 WSDL 详解 博文链接:https://whistler.iteye.com/blog/89201
本文介绍了如何编写一个简单的WSDL文件,并根据WSDL文件编写服务器端和客户端代码,并发布Web Service服务的过程。
之前有人写过,但是有点错误,并且描述不是很清晰。这是我的完整解析wsdl的方法 wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl
wsdl2java 源码 Java调用WebService的几种方式 Constants 常量 // WebService俩个参数,帐号跟密码 private static final String USERNAME = "void"; private static final String PASSWORD = "password"; // ...
Web Service描述语言 WSDL 详解.doc
Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独立的通讯技术。是:通过SOAP在Web上提供的软件服务,使用WSDL文件进行说明,并通过UDDI...
该文档详细描述了利用Zend Studio for Eclipse 生成wsdl文件,用php编写提供web service 的服务程序,然后用php调用,亲测通过
通过示例说明document/literal、document/literal(wrapped)、rpc/encoded、rpc/literal样式的web服务对应的soap消息格式,对于理解webservice有很大好处,尤其是根据wsdl构造soap消息,非常有价值。