Practical usecase based difference between JAX-RPC vs JAX-WS vs JAX-RS web services

穿精又带淫゛_ 提交于 2020-01-10 15:40:07

问题


I know there are many documents available on net which mostly describes technical difference.

But I'm rather interested to know what are the common use cases where you prefer one specific type over other any why ?

Are those preferences because integration patterns/products support particular type ?


回答1:


Thanks for answer. However practical use case difference and when to use what. Both, JAX-WS and JAX-RS have standard implementations. I have come up with the following differences:

RESTful services (Mostly web integration, mobile phone apps)

  • Integration over web will be easy with the REST. Popularly used with the AJAX calls.
  • Not verbose as SOAP services so need less bandwidth hence good to use for the mobile apps.
  • Web services are completely stateless so only for stateless services.

JAX-WS and JAX-RPC are SOAP based services. (Enterprise web services)

JAX-WS Java EE later versions support this and standards still evolving. - SOAP based services not preferred for mobile app communication because of heavy payload compare to rest. - More suitable for the enterprise web services where you need interoperability, transactions, message delivery and reliability.




回答2:


JAX-RPC forget about this one. It is the old obsolete standard for Java Web Services

JAX-WS new standard for SOAP-Based web services (also is provided as a reference implementation)

JAX-RS stack for REST-full web services




回答3:


I would like add points to the answer from @Arjan Tijms

JAX-WS uses asynchronous features from Java 5.0,J2EE5.0 JAX-RPC is primarily uses features from J2EE 1.4 and is supported in J2EE 5.0 also.

JAX-RPC has its own data mapping model,it covers many and those are not covered are mapped to javax.xml.soap.SOAPElement.

JAX-WS's data mapping model is JAXB that promises mappings for all XML schemas, which has got many advantages like one can use with XSD and using annotations without XSD, it is highly useful with large, complex XML and few limitations also.

There are some differences according Webservice specifications as the specifications has got changed and improved after JAX-RPC and hence Jax-WS got some more features.

One thing is common is both are confusing while using them with J2EE 5.0, JavaEE 6.x. The better is Jax-RS or Jersey for new implementations and re-designs. or You can continue with JAX-RPC or JAX-WS.

JavaEE7.0 promises new light weight, developer and tester friendly approaches for RESTful webservices.

Java Architecture for XML Binding (JAXB) is an XML-to-Java binding technology that simplifies the development of web services by enabling transformations between schema and Java objects and between XML instance documents and Java object instances



来源:https://stackoverflow.com/questions/10311381/practical-usecase-based-difference-between-jax-rpc-vs-jax-ws-vs-jax-rs-web-servi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!