如何确定Java Web服务是JAX-WS还是JAX-RPC [英] How to determine if a Java web service is JAX-WS or JAX-RPC

查看:158
本文介绍了如何确定Java Web服务是JAX-WS还是JAX-RPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求完成一些与应用程序中的许多Web服务相关的文档,并指出每个服务是否使用JAX-WS或JAX-RPC实现。这些服务已经开发了很多年,可能使用各种方法,包括RAD内置的Web服务向导,以及使用从Maven调用的wsimport。而且他们也随着时间的推移而改变和发展 - 即使在有些原始文件说这项服务是其中之一的情况下,我也不确定他们可以信任多少。

I've been asked to complete some documentation related to a number of web services in an application and indicate for each service if it as implemented using JAX-WS or JAX-RPC. The services have been developed over a number of years, and probably using a variety of methods including the built in web-service wizard in RAD, as well as using wsimport, called from Maven. And they've changed and evolved over time as well - even in some cases where there was original documents saying that the service was one or the other, I'm not sure how much they can be trusted.

如果服务是JAX-WS或JAX-RPC,是否有任何明确的标记让我知道?我可以完全访问源代码,WSDL和模式。我只是不确定要找什么。

Are there any clear markers to let me know if a service is JAX-WS or JAX-RPC? I have full access to the source code, WSDLs and schemas. I'm just not 100% sure what to look for.

推荐答案

如果你看到 @WebService <在Java源代码中,/ code>肯定是JAX-WS服务类。 JAX-WS结合使用自己的注释,并利用JAXB注释(pojos中的 @XmlType )将Java序列化/反序列化为XML。

If you see @WebService in the Java source, that's certainly a JAX-WS service class. JAX-WS uses a combination of its own annotations and leverages JAXB annotations (@XmlType in pojos) for serializing/deserializing Java to/from XML.

如果在Web模块中看到 webservices.xml 或XML文件,其名称似乎映射到已知的Web服务名称,并且可能看起来像< a href =http://oss.org.cn/ossdocs/geronimo/development-deployment/web-services-sample.html#id2644944\"rel =nofollow>这个例子,那些是JAX-RPC服务。 JAX-RPC使用反射和映射文件将一组有限的Java类型转换为XML或从XML转换。您甚至可以在代码库中搜索/ grep XML命名空间值,例如 http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd http://java.sun.com/xml/ns/jax-rpc/ri/config 查找这样的映射文件 - 它们的名称可能会引导您使用JAX实现的服务-RPC。

If you see webservices.xml or XML files in a web module whose names seem to map to known web service names and that may look like this example, those are JAX-RPC services. JAX-RPC uses reflection and mapping files to convert a limited set of Java types to and from XML. You may even be able to search/grep the codebase for XML namespace values such as http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd or http://java.sun.com/xml/ns/jax-rpc/ri/config to find such mapping files - their names will likely guide you to the services implemented with JAX-RPC.

这篇关于如何确定Java Web服务是JAX-WS还是JAX-RPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆