Java WebService Introduction

Source: Internet
Author: User

SOA (Service-Oriented Architecture) is an idea of Service-Oriented Architecture. It uses neutral contracts (independent of hardware platforms, operating systems, and programming languages) to different functional units of an application) to make functional units of various forms better integrated. Currently, WebService is a good implementation method of SOA. WebService uses HTTP as the transmission Protocol, and SOAP (Simple Object Access Protocol) as the message transmission format. However, WebService does not fully comply with the concept of SOA, because the SOAP protocol is a special protocol of WebService and does not comply with the transparent requirements of the SOA transmission protocol. SOAP is an application protocol, which was used in RPC implementation in early days. The transmission protocol can depend on HTTP, SMTP, and so on. Web Service Specification in JAVA: There are three Web service specifications in JAVA, namely JAXM & SAAJ, JAX-WS (JAX-RPC), JAX-RS. The three specifications are briefly described below. (1) JAX-WS: JAX-WS (Java API For XML-WebService), JDK1.6 comes with a version of JAX-WS2.1, its underlying support For JAXB. Early SOAP-based JAVA Web Service Specification JAX-RPC (Java API For XML-Remote Procedure Call) has been replaced by JAX-WS specification, JAX-WS is an evolving version of JAX-RPC, but the JAX-WS is not fully backward compatible with the JAX-RPC, and the biggest difference between the two is the RPC/encoded style WSDL, which is no longer supported by the JAX-WS. The JAX-RPC's API has been removed since JAVA EE5, and if you are using J2EE1.4, its API is located in the javax. xml. rpc. * package. The JAX-WS (JSR 224) specification API is located in javax. xml. ws. * The package, most of which are annotations, provides APIs to operate Web services (usually used in many clients, because the client can use the SDK to generate, therefore, the APIs in this package are rarely used directly ). WS-MetaData (JSR 181) is a JAX-WS dependency specification whose API is located in javax. jws. * package: Use annotations to configure information about the exposed Web service and SOAP messages. (2 .) JAXM & SAAJ: JAXM (java api For XML Message) mainly defines the APIS required to send and receive messages, which is equivalent to the server side of the Web service. Its APIs are located in javax. messaging. * package, which is an optional java ee package, so you need to download it separately. SAAJ (SOAP With Attachment API For Java, JSR 67) is an API used With JAXM. It provides important support For creating a SOAP package and parsing a SOAP package, and supports Attachment transmission, it is required on both the server side and the client side. The SAAJ specification is also mentioned here. Its API is located in the javax. xml. soap. * package. JAXM & SAAJ and JAX-WS are SOAP-based Web Services, in contrast to JAXM & SAAJ exposed SOAP more bottom-layer details, coding is more troublesome, while JAX-WS is more abstract, it hides more details and is more object-oriented. Basically, you do not need to care about any details of SOAP. To control more details about SOAP messages, use JAXM & SAAJ. The current version is 1.3. (3 .) JAX-RS: JAX-RS is a set of Web service specifications developed by JAVA for the REST (Representation State Transfer) style, due to the late launch of the specification (JSR 311, the current JAX-RS version is 1.0) not released with JDK1.6, You need to download the JAX-RS specification interface on JCP, its API is located in javax. ws. rs. * package. The JAX-WS and JAX-RS specifications here are implemented using Apache CXF, which is a combination of Objectweb Celtix and Codehaus XFire. The core of CXF is org. apache. cxf. bus (Bus) is similar to Spring's ApplicationContext. Bus is created by BusFactory. The default is SpringBusFactory. It can be seen that CXF depends on Spring by default, and Bus has an ID, the default bus id is cxf. Note that if you put all the jar files in the Apache CXF2.2 release package directly to the lib directory, you must use JDK1.6, otherwise the issue of inconsistent JAX-WS versions will be reported. For the JAXM & SAAJ specifications, we use the default implementation in JDK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.