web services

Java API for XML Web Services (JAX-WS)

Java API for RESTful Web Services (JAX-RS)

 

JAX-WS supports the Web Services Interoperability (WS-I) Basic Profile Version 1.1. The WS-I Basic Profile is a document that clarifies the SOAP 1.1 and WSDL 1.1 specifications to promote SOAP interoperability.

 

Creating a SimpleWeb Service and Clients with JAX-WS

The basic steps for creating a web service and client are as follows:

  1. Code the implementation class.
  2. Compile the implementation class.
  3. Package the files into aWARfile.
  4. Deploy theWARfile. The web service artifacts (wsdl, xsd), which are used to communicate with clients, are generated by the Application Server during deployment.
  5. Code the client class.
  6. Use a wsimport Ant task to generate and compile the web service artifacts (wsdl, xsd) needed to connect to the service. (Results of wsimport are auto-gen java classes)
  7. Compile the client class.
  8. Run the client.

Requirements of a JAX-WS Endpoint

  1. The implementing class must be annotated with either the javax.jws.WebService or the
    javax.jws.WebServiceProvider annotation.
  2. The implementing class may explicitly reference an SEI through the endpointInterface
    element of the @WebService annotation but is not required to do so. If no endpointInterface is specified in @WebService, an SEI is implicitly defined for the implementing class.
  3. The business methods of the implementing class must be public and must not be declared
    static or final.
  4. Business methods that are exposed to web service clients must be annotated with
    javax.jws.WebMethod.
  5. Business methods that are exposed to web service clients must have JAXB-compatible
    parameters and return types
    . See the list of JAXB default data type bindings at
    http://download.oracle.com/javaee/5/tutorial/doc/bnazq.html#bnazs.
  6. The implementing class must not be declared final and must not be abstract.
  7. The implementing class must have a default public constructor.
  8. The implementing class must not define the finalize method.
  9. The implementing class may use the javax.annotation.PostConstruct or the
    javax.annotation.PreDestroy annotations on its methods for lifecycle event callbacks. The @PostConstruct method is called by the container before the implementing class begins responding to web service clients. The @PreDestroy method is called by the container before the endpoint is removed from operation.

你可能感兴趣的:(oracle,Web,javaee,webservice,SOAP)