Do you really understand the specifications and implementations in Java that are related to webservice?

Source: Internet
Author: User
Tags soap oauth mule esb

Very many people use WebService in the project, just know how to publish WebService, how to call webservice, but really want to discuss its ins and outs, it is not necessarily clear.

Everything is going to start with our great Sun Company specification.


JAVA has three types of webservice specifications, each of which are JAXM&saaj, Jax-ws (JAX-RPC), Jax-rs.

Let's take a brief look at these three specifications separately. for JDK version number 1.6, the new one hasn't been researched yet .


(1.) Jax-WS:


JAX-WS (Java API for Xml-webservice), JDK1.6 comes with a version number of jax-ws2.1, and its underlying supportas JAXB. Early SOAP-based Java Web Services specification JAX-RPC (Java API forxml-remote Procedure Call) has now been replaced by JAX-WS specifications, and Jax-WS is the evolution of Jax-RPCversion number, but Jax-ws is not completely backwards compatible with JAX-RPC, the biggest difference is the rpc/encoded styleWsdl,jax-ws has not provided such support. The Jax-RPC API has been removed from Java EE5, such asIf you use j2ee1.4, its API is located in the javax.xml.rpc.* package. the Jax-ws (JSR 224) Specification API is located in the javax.xml.ws.* package, most of which are annotations that provide APIAs a Web service (typically used by the client, because the client can be generated using the SDK, so theAPI We are less likely to use directly). Ws-metadata (JSR 181) is a JAX-WS dependency specification whose API is located in the javax.jws.* package, using annotations withInformation about the exposed Web service and the configuration of the SOAP message.

(2.) Jaxm&saaj:


JAXM (Java API for XML message) primarily defines the APIs required to send and receive messages, equivalent to the server side of the Web service, whose APIs are located in the javax.messaging.* package, which is an optional package for JAVA EE. So you need to download it separately.
SAAJ (soap with Attachment API for JAVA,JSR 67) is an API that is used with JAXM, providing important support for building soap packages and parsing SOAP packets, supporting attachment transfer, which is required on both the server side and the client. Also mentioned here is the SAAJ specification, whose API is located in the javax.xml.soap.* package.

Jaxm&saaj and Jax-ws are SOAP-based Web services, in contrast to the Jaxm&saaj of soap many other underlying details, coding is more cumbersome, and Jax-ws is more abstract, hiding a lot of other details, more object-oriented, You basically don't need to care about soap in any detail. So suppose you want to control many of the other details of SOAP messages, and you can use Jaxm&saaj.

(3.) Jax-rs:
Jax-rs is a set of Java Web service specifications for the rest (representation state Transfer) style, because the specification (JSR) is not released with JDK1.6, and you need to JCP(Java Community Process) separately downloads the JAX-RS specification interface, whose API is located in the javax.ws.rs.* package.


understand these specifications, after all, to implement the implementation of these specifications, and then used in our project.
We do projects that generally do not directly target these specifications, but rather use frameworks that implement these specifications, such as AXIS,CXF. I personally like CXF, because my development is mainly Java-oriented, andHopefully with spring integration, and even with mule ESB integration, these aspects cxf do well. AXIS2 is doing very well in multi-lingual support (the multilingual language here is using axis).


There's not much say in axis, because it's less used, so here's a little bit about CXF. (Official documentation)


Apache CXF is an open Source services framework. CXF helps you build and develop services using frontend programming APIs, Likejax-ws and Jax-rs. These services can speak a variety of protocols such assoap, Xml/http, RESTful HTTP, or CORBA and work over a variety of T Ransportssuch as HTTP, JMS or JBI.


If you want to use CXF in maven, declare maven dependencies in the Pom.

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-distribution-manifest</artifactId>

<version>2.5.9</version>

<scope>provided</scope>

</dependency>

After testing, call WebService, only need to draw this one is enough, it will indirectly introduce some other jar


Finally, the Cxf_home 2.5.9 Version number of the Lib Jar function:

The following jars is required for all cxfusage:

-Cxf.jar

-Commons-logging.jar

-Geronimo-activation.jar (Or the Sunequivalent) [6]

-Geronimo-annotation.jar (Or the Sunequivalent) [6]

-Geronimo-javamail.jar (Or the Sunequivalent) [6]

(May is able to remove javamail if you don ' t use any Mtom/saaj typethings)

-Geronimo-stax-api.jar (Or the Sunequivalent) [6]

-Neethi.jar

-Jaxb-api.jar [6]

-Jaxb-impl.jar (This was a [6] for Normalruntime, but was required for

Tooling and the Dynamicclients)

-Xmlschema.jar

-Woodstox-core-asl.jar [6] or another StAX implementation

-Stax2-api-3.0.1.jar [6] for Woodstoxabove

-Wsdl4j.jar

The following jars is required for Xmlcatalog support:

-Xml-resolver.jar

For JAVA2WSDL and Wsdl2java:

-The above Jars

-Jaxb-xjc.jar

-Velocity.jar

-Commons-collections.jar

-Commons-lang.jar

-Cxf-xjc*.jar (optional, these is xjcextensions for providing enhanced

JAXB code Generation)

For Jax-WS support:

-Geronimo-ws-metadata.jar [6]

-Geronimo-jaxws_2.2_spec-1.0.jar (Or thesun equivalent) [6]

-Saaj-api.jar [6]

-Saaj-impl.jar [6]

-Asm.jar (semi-optional, helps withperformance of wrapper types and is

Required when adding JAXB annotations onto the SEI methods and

Parameters.)

For XML Configuration Support:

-Aopalliance.jar

-Spring-beans.jar

-Spring-context.jar

-Spring-core.jar

-Spring.web.jar

-Fastinfoset.jar

For standalone HTTP support:

-Geronimo-servlet.jar

-Jetty-*.jar

-Sl4j.jar & Sl4j-jdk14.jar (Optional-but improves logging)

For Aegis Support:

-Jdom.jar (optional, if you want to Mapxsd:anytype to Jdom)

For XmlBeans DataBinding support:

-Xmlbeans.jar

For ws-security Support:

-Bcprov-jdk15.jar

-Xalan.jar

-Serializer.jar

-Wss4j.jar

-Xmlsec.jar

-Ehcache-core.jar

For SAML support in ws-security

-Joda-time.jar

-Opensaml.jar

-Openws.jar

-Xmltooling.jar

For HTTP Binding Support:

-Jra.jar

-Jettison.jar (Needed for JSON servicesonly)

For Jax-rs Support:

-Abdera* (optional:for AtomPub support, but also needed for the

Management Log Browser console)

-Commons-codec.jar (Needed for Abdera)

-Jaxen.jar (Needed for Abdera)

-Axiom* (Needed for Abdera)

-Jsr311-api.jar

-Jettison.jar (Needed for JSON servicesonly)

-Oauth*.jar (Needed for OAuth support)

For JMS Transport

-Geronimo-jms.jar (Or the Sun equivalent)

-Spring-jms.jar

-Spring-tx.jar

For CORBA Support:

-Antlr.jar

For JavaScript functionality:

-Js.jar

For schema validation with the Aegis databinding.

-msv-core.jar (version 2010.1)

-xsdlib:jar (version 2010.1)

-isorelax.jar (version 20030108)

-relaxngdatatype.jar (version 20020414)

For the ws-notification Service:

-cxf-services-wsn-api.jar

-cxf-services-wsn-core.jar

For the CXF Security Token Service:

-Cxf-services-sts-core.jar


Official documents, written so well, I will no longer chew the tongue, we go to the official website to see it.


Understand the Java WebService this piece of specification and implementation, I believe you again in Java use WebService will not be so confused, how to do, out of the problem how to do, know it.




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.