Overview of JWS Files and JWS Annotations

4 Programming the JWS File 4-1 4 Programming the JWS File The following sections provide information about programming the JWS file that implements your Web service: ■ Section 4.1, Overview of JWS Files and JWS Annotations ■ Section 4.2, Java Requirements for a JWS File ■ Section 4.3, Programming the JWS File: Typical Steps ■ Section 4.4, Accessing Runtime Information About a Web Service ■ Section 4.5, Should You Implement a Stateless Session EJB? ■ Section 4.6, Programming the User-Defined Java Data Type ■ Section 4.7, Invoking Another Web Service from the JWS File ■ Section 4.8, Using SOAP 1.2 ■ Section 4.9, Validating the XML Schema ■ Section 4.10, JWS Programming Best Practices

4.1 Overview of JWS Files and JWS Annotations

There are two ways to program a WebLogic Web service from scratch: 1. Annotate a standard EJB or Java class with Web service Java annotations, as defined by JSR-181, the JAX-WS specification, and by the WebLogic Web services programming model. 2. Combine a standard EJB or Java class with the various XML descriptor files and artifacts specified by JSR-109 such as, deployment descriptors, WSDL files, data mapping descriptors, data binding artifacts for user-defined data types, and so on. Oracle strongly recommends using option 1 above. Instead of authoring XML metadata descriptors yourself, the WebLogic Ant tasks and runtime will generate the required descriptors and artifacts based on the annotations you include in your JWS. Not only is this process much easier, but it keeps the information about your Web service in a central location, the JWS file, rather than scattering it across many Java and XML files. The Java Web service JWS annotated file is the core of your Web service. It contains the Java code that determines how your Web service behaves. A JWS file is an ordinary Java class file that uses Java metadata annotations to specify the shape and characteristics of the Web service. The JWS annotations you can use in a JWS file include the standard ones defined by the Web services Metadata for the Java Platform 4-2 Getting Started With JAX-WS Web Services for Oracle WebLogic Server specification JSR-181, described at http:www.jcp.orgenjsrdetail?id=181 , plus a set of additional annotations based on the type of Web service you are building—JAX-WS or JAX-RPC. For a complete list of JWS annotations that are supported for JAX-WS and JAX-RPC Web services, see Web Service Annotation Support in WebLogic Web Services Reference for Oracle WebLogic Server. When programming the JWS file, you include annotations to program basic Web service features. The annotations are used at different levels, or targets, in your JWS file. Some are used at the class-level to indicate that the annotation applies to the entire JWS file. Others are used at the method-level and yet others at the parameter level.

4.2 Java Requirements for a JWS File