设为首页 收藏本站
查看: 773|回复: 0

[经验分享] Web service main idea(转自IBM)

[复制链接]

尚未签到

发表于 2017-5-25 12:20:53 | 显示全部楼层 |阅读模式
  
[size=0.76em][size=1.5em]Introduction
[size=0.76em]Web services have been around a while now. First there was SOAP. But SOAP only described what the messages looked like. Then there was WSDL. But WSDL didn't tell you how to write web services in Java™. Then along came JAX-RPC 1.0. After a few months of use, the Java Community Process (JCP) folks who wrote that specification realized that it needed a few tweaks, so out came JAX-RPC 1.1. After a year or so of using that specification, the JCP folks wanted to build a better version: JAX-RPC 2.0. A primary goal was to align with industry direction, but the industry was not merely doing RPC web services, they were also doing message-oriented web services. So "RPC" was removed from the name and replaced with "WS" (which stands for web Services, of course). Thus the successor to JAX-RPC 1.1 is JAX-WS 2.0 - the Java API for XML-based web services.
[size=0.76em][size=1.5em]What remains the same?
[size=0.76em]Before we itemize the differences between JAX-RPC 1.1 and JAX-WS 2.0, we should first discuss what is the same.

  • JAX-WS still supports SOAP 1.1 over HTTP 1.1, so interoperability will not be affected. The same messages can still flow across the wire.
  • JAX-WS still supports WSDL 1.1, so what you've learned about that specification is still useful. A WSDL 2.0 specification is nearing completion, but it was still in the works at the time that JAX-WS 2.0 was finalized.
[size=0.76em][size=1.5em]What is different?

  • SOAP 1.2[size=1em]JAX-RPC and JAX-WS support SOAP 1.1. JAX-WS also supports SOAP 1.2.
  • XML/HTTP[size=1em]The WSDL 1.1 specification defined an HTTP binding, which is a means by which you can send XML messages over HTTP without SOAP. JAX-RPC ignored the HTTP binding. JAX-WS adds support for it.
  • WS-I's Basic Profiles[size=1em]JAX-RPC supports WS-I's Basic Profile (BP) version 1.0. JAX-WS supports BP 1.1. (WS-I is the web services interoperability organization.)
  • New Java features

    • JAX-RPC maps to Java 1.4. JAX-WS maps to Java 5.0. JAX-WS relies on many of the features new in Java 5.0.
    • Java EE 5, the successor to J2EE 1.4, adds support for JAX-WS, but it also retains support for JAX-RPC, which could be confusing to today's web services novices.

  • The data mapping model

    • JAX-RPC has its own data mapping model, which covers about 90 percent of all schema types. Those that it does not cover are mapped to javax.xml.soap.SOAPElement.
    • JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas.

  • The interface mapping model[size=1em]JAX-WS's basic interface mapping model is not extensively different from JAX-RPC's; however:

    • JAX-WS's model makes use of new Java 5.0 features.
    • JAX-WS's model introduces asynchronous functionality.

  • The dynamic programming model

    • JAX-WS's dynamic client model is quite different from JAX-RPC's. Many of the changes acknowledge industry needs:

      • It introduces message-oriented functionality.
      • It introduces dynamic asynchronous functionality.

    • JAX-WS also adds a dynamic server model, which JAX-RPC does not have.

  • MTOM (Message Transmission Optimization Mechanism)[size=1em]JAX-WS, via JAXB, adds support for MTOM, the new attachment specification. Microsoft never bought into the SOAP with Attachments specification; but it appears that everyone supports MTOM, so attachment interoperability should become a reality.
  • The handler model

    • The handler model has changed quite a bit from JAX-RPC to JAX-WS.
    • JAX-RPC handlers rely on SAAJ 1.2. JAX-WS handlers rely on the new SAAJ 1.3 specification.

[size=0.76em]In the remainder of this tip, we will discuss SOAP 1.2, XML/HTTP, the WS-I Basic Profiles, and Java 5. Each of the remaining five bullets above will be a separate tip in this series.
SOAP encoding
SOAP encoding has fallen out of favor in the web services community. It is not supported by the WS-I basic profile. So JAX-WS, as the latest incarnation of Java web services, has disallowed SOAP encoding. JAX-RPC supports SOAP encoding, so if you really must use SOAP encoded messages, stick with JAX-RPC.

[size=0.76em][size=1.5em]SOAP 1.2
[size=0.76em]There is really not a lot of difference, from a programming model point of view, between SOAP 1.1 and SOAP 1.2. As a Java programmer, the only place you will encounter these differences is when using the handlers, which we will cover in a future tip. SAAJ 1.3 has been updated to support SOAP 1.2.
[size=0.76em][size=1.5em]XML/HTTP
[size=0.76em]Like the changes for SOAP 1.2, there is really not a lot of difference, from a programming model point of view, between SOAP/HTTP and XML/HTTP messages. As a Java programmer, the only place you will encounter these differences is when using the handlers, which we will cover in a future tip. The HTTP binding has its own handler chain and its own set of message context properties.
[size=0.76em][size=1.5em]WS-I's basic profiles
[size=0.76em]JAX-RPC 1.1 supports WS-I's Basic Profile (BP) 1.0. Since that time, the WS-I folks have developed BP 1.1 (and the associated AP 1.0 and SSBP 1.0). These new profiles clarify some minor points, and more clearly define attachments. JAX-WS 2.0 supports these newer profiles. For the most part, the differences between them do not affect the Java programming model. The exception is attachments. WS-I not only cleared up some questions about attachments, but they also defined their own XML attachment type: wsi:swaRef.
[size=0.76em]Many people are confused by all these profiles. You will need a little history to clear up the confusion.
[size=0.76em]WS-I's first basic profile (BP 1.0) did a good job of clarifying the various specs. But it wasn't perfect. And support for SOAP with Attachments (Sw/A) in particular was still rather fuzzy. In their second iteration, the WS-I folks pulled attachments out of the basic profile - BP 1.1 - and fixed some of the things they missed the first time around. At that point they also added two mutually exclusive supplements to the basic profile: AP 1.0 and SSBP 1.0. AP 1.0 is the Attachment Profile which describes how to use Sw/A. SSBP 1.0 is the Simple SOAP Binding Profile, which describes a web services engine that does not support Sw/A (such as Microsoft's .NET). The remaining profiles that WS-I has and is working on build on top of those basic profiles.
[size=0.76em][size=1.5em]Java 5
[size=0.76em]There are a number of changes to the Java language. JAX-WS relies on: annotations, generics, and executors. We will detail exactly how JAX-WS relies on this new functionality in follow-on tips. For information on these new features of Java, see the Java 5 link in Resources.
[size=0.76em][size=1.5em]Summary
[size=0.76em]JAX-WS 2.0 is the successor to JAX-RPC 1.1. There are some things that haven't changed, but most of the programming model is different to a greater or lesser degree. The topics introduced in this tip will be expanded upon in a series of tips which we will publish over the coming months that will compare, in detail, JAX-WS and JAX-RPC. At a high level though, here are a few reasons why you would or would not want to move to JAX-WS from JAX-RPC.
[size=0.76em]Reasons you may want to stay with JAX-RPC 1.1:

  • If you want to stay with something that's been around a while, JAX-RPC will continue to be supported for some time to come.
  • If you don't want to step up to Java 5.
  • If you want to send SOAP encoded messages or create RPC/encoded style WSDL.
[size=0.76em]Reasons to step up to JAX-WS 2.0:

  • If you want to use the new message-oriented APIs.
  • If you want to use MTOM to send attachment data.
  • If you want better support for XML schema through JAXB.
  • If you want to use an asynchronous programming model in your web service clients.
  • If you need to have clients or services that can handle SOAP 1.2 messages.
  • If you want to eliminate the need for SOAP in your web services and just use the XML/HTTP binding.
  • If you like playing with leading edge technology.
http://www.ibm.com/developerworks/webservices/library/ws-tip-jaxwsrpc/index.html#iratings
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0709_thaker/0709_thaker.html
  http://hi.baidu.com/wenter126/blog/item/c5d3a754b1772d183a293599.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-380981-1-1.html 上篇帖子: IBM JVM垃圾回收原理——1 下篇帖子: IBM MQ系列编程4--------浏览消息
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表