New Features of Servlet 3.1 Version

@WebService

1. serviceName: The service name published to the outside world, specify the service name of the Web Service: wsdl:service. The default is the simple name of the Java class + Service. (string)

2. endpointInterface: The full path of the service interface, designated as SEI (Service EndPoint Interface) service endpoint interface

3. name: The value of this attribute contains the name of the XML Web Service. By default, the value is the name of the class implementing the XML Web Service, the name of the wsdl:portType. The default is the unqualified name of the Java class or interface. (string

4. portName: wsdl:portName. The default is WebService.name+Port.

5. targetNamespace: Specify the namespace you want, which is the inverse of the package name of the interface implementation class

6. wsdlLocation: Specify the Web address of the WSDL document used to define the Web Service. Web addresses can be relative or absolute paths. (string)

Note: Webservice annotations may not be added to the implementation class

@WebMethod

An annotation represents a method as a Web Service operation, apply this annotation to a method on a client or server service endpoint interface (SEI), or to a server endpoint implementation class for a JavaBeans endpoint.

Key Points:

   仅支持在使用 @WebService 注释来注释的类上使用 @WebMethod 注释

1. operationName: Specify the name of the wsdl:operation that matches this method. The default is the name of the Java method. (string)

2, action: Define the behavior of this operation. For SOAP bindings, this value determines the value of the SOAPAction header. The default is the name of the Java method. (string)

3. exclude: specify whether to exclude a method from the Web Service. The default value is false. (Boolean value)

@Oneway

Annotation represents a method as a one-way operation of a Web Service with only input messages and no output messages.

Apply this annotation to a method on a client or server service endpoint interface (SEI), or to a server endpoint implementation class for JavaBeans endpoints

@WebParam

Annotations are used to customize the mapping from individual parameters to Web Service message parts and XML elements.

Apply this annotation to a method on a client or server service endpoint interface (SEI), or to a server endpoint implementation class for a JavaBeans endpoint.

1. name : The name of the parameter. If the operation is of type Remote Procedure Call (RPC) and the partName attribute is not specified, this is the name of the wsdl:part attribute used to represent the parameter.

If the operation is a document type or the parameter maps to a header, -name is the local name of the XML element used to represent the parameter. If the action is a document type,

This attribute must be specified if the parameter type is BARE and the mode is OUT or INOUT. (string)

2. partName: Defines the name of the wsdl:part attribute used to represent this parameter. This parameter is only used when the operation type is RPC or the operation is a document type and the parameter type is BARE. (string)

3. targetNamespace: Specifies the XML namespace of the parameter's XML element. Applies only to document bindings when attributes are mapped to XML elements. The default is the targetNamespace of the Web Service. (string)

4. mode: This value indicates the direction of the parameter flow of this method. Valid values ​​are IN, INOUT, and OUT. (string)

5. header: Specifies whether the parameter is in the message header or the message body. The default value is false. (Boolean value)

@WebResult

Annotations are used to customize the mapping from return values ​​to WSDL parts or XML elements. Apply this annotation to a method on a client or server service endpoint interface (SEI), or to a server endpoint implementation class for a JavaBeans endpoint.

1. name: When the return value is listed in the WSDL file and the return value is found in the message on the connection, specify the name of the return value. For RPC bindings, this is the name of the wsdl:part attribute used to represent the return value. For document binding, the -name parameter is the local name of the XML element used to represent the return value. For RPC and DOCUMENT/WRAPPED bindings, the default is return. For DOCUMENT/BARE bindings, the default is method name + Response. (string)

2. targetNamespace: Specifies the XML namespace of the return value. This parameter is only used when the operation type is RPC or the operation is a document type and the parameter type is BARE. (string)

3. header: Specifies whether the header is accompanied by a result. The default value is false. (Boolean value)

4. partName: Specifies the part name of the result of the RPC or DOCUMENT/BARE operation. The default is @WebResult.name. (string)

@HandlerChain

Annotations are used to associate a web service with an externally defined handler chain. Server-side handlers can only be configured by using the @HandlerChain annotation on the SEI or implementation class.

But there are several ways to configure the client's handler. Client-side handlers can be configured by using the @HandlerChain annotation on the generated service class or SEI. Additionally, you can register your own implementation of the HandlerResolver interface on the service programmatically, or set up handler chains on the binding object programmatically.

1. file: Specifies the location of the handler chain file. The file location can be an absolute java.net.URL in external format, or a relative path within the class file. (string)

2. name: Specifies the name of the handler chain in the configuration file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325515801&siteId=291194637