How to determine if a Java web service is JAX-WS o

2020-07-19 23:40发布

问题:

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.

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.

回答1:

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.

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.