JAX-WS 2.0 Annotations (JSR 224)

The JSR 224 specification defines annotations for JAX-WS 2.0.

Note: The Java™ class that contains each annotation in the JSR 224 standard is named javax.xml.ws.xxx, where xxx is the name of the annotation after the '@' character. For example, the Java class name for the @BindingType annotation is javax.xml.ws.bindingtype.
Name: Description: Properties: Definitions:
@BindingType This annotation specifies which binding to use when you publish an endpoint of this type. If the annotation is not specified, the default value is SOAP11_HTTP_BINDING.

You can apply this annotation to a JavaBeans implementation class for a service endpoint that is based on the Service Endpoint Interface or the Provider interface.

Important:

Use the @BindingType annotation on the JavaBeans endpoint implementation class to enable Message Transmission Optimization Mechanism (MTOM), by specifying either SOAP11_HTTP_MTOM_BINDING or SOAP12_HTTP_MTOM_BINDING as the value for the annotation.

  • Annotation target: Type
  • Properties:
    - value
    Indicates the binding identifier web address. (String)
@Retention(value = RetentionPolicy.RUNTIME)
@Target({TYPE})
public  @interface BindingType{
	String value() default SOAP11_HTTP_BINDING;
};
@RequestWrapper This annotation supplies the JAXB generated request wrapper bean, the element name, and the namespace for serialization and deserialization with the request wrapper bean that is used at runtime.

When your start with a Java object, this element is used to resolve overloading conflicts in document literal mode. Only the className attribute is required in this case.

This annotation can be applied to methods in a client or server Service Endpoint Interface (SEI), or in a service endpoint implementation class for a JavaBeans endpoint.

  • Annotation target: Method
  • Properties:
    - localName
    Specifies the local name of the XML schema element that represents the request wrapper. The default value is the operationName as defined in javax.jws.WebMethod annotation. (String)
    - targetNamespace
    Specifies the XML namespace of the request wrapper method. The default value is the target namespace of the SEI. (String)
    - className
    Specifies the name of the class that represents the request wrapper. (String)
@Retention(value = RetentionPolicy.RUNTIME)
@Target({METHOD})
public @interface RequestWrapper{
	String localName() default “”;
	String targetNamespace() default “”;
	String className() default “”;
};
@ResponseWrapper This annotation supplies the JAXB-generated response wrapper bean, the element name, and the namespace for serialization and deserialization with the response wrapper bean that is used at run time.

When your start with a Java object, use this element to resolve overloading conflicts while in document literal mode. Only the className attribute is required in this case.

You can apply this annotation to methods in a client or server Service Endpoint Interface (SEI), or in a service endpoint implementation class for a Java beans endpoint.

  • Annotation target: Method
  • Properties:
    - localName
    Specifies the local name of the XML schema element that represents the request wrapper. The default value is the operationName +response. operationName is defined in javax.jws.WebMethod annotation. (String)
    - targetNamespace
    Specifies the XML namespace of the request wrapper method. The default value is the target namespace of the SEI. (String)
    - className
    Specifies the name of the class that represents the response wrapper. (String)
@Retention(value = RetentionPolicy.RUNTIME)
@Target({METHOD})
public @interface ResponseWrapper{
	String localName() default “”;
	String targetNamespace() default “”;
	String className() default “”;
};
@ServiceMode This annotation specifies whether a service provider must have access to an entire message protocol or just to the message payload.
Important: The @ServiceMode annotation is only supported on classes that have the @WebServiceProvider annotation.
  • Annotation target: Type
  • Properties:
    - value
    Indicates whether the provider class accepts the payload of the message, PAYLOAD, or the entire message MESSAGE. The default value is PAYLOAD. (String)
@Retention(value = RetentionPolicy.RUNTIME)
@Target({TYPE})
@Inherited
public @interface ServiceMode{
Service.Mode value() default javax.xml.ws.Service.Mode.PAYLOAD; 
};	
@WebFault This annotation maps WSDL faults to Java exceptions. Use this annotation to capture the name of the fault; this capturing occurs during serialization of the JAXB type that is generated from a global element that is referred to by a WSDL fault message. You can also use this annotation to customize the mapping of service-specific exceptions to WSDL faults.

You can apply this annotation to a fault implementation class.

  • Annotation target: Type
  • Properties:
    - name
    Specifies the local name of the XML element that represents the corresponding fault in the WSDL file. You must specify the actual value. (String)
    - targetNamespace
    Specifies the namespace of the XML element that represents the corresponding fault in the WSDL file. (String)
    - faultBean
    Specifies the name of the fault bean class. (String)
@Retention(value = RetentionPolicy.RUNTIME)
@Target({TYPE})
public @interface WebFault{
	String name() default “”; 
	String targetNamespace() default “”;
	String faultBean() default “”;
};