Configuring Web Services at Design Time

Prerequisites

The implementation bean of the Web service is available in the SAP NetWeaver Developer Studio.

Context

When you create an inside-out or an outside-in Web service, you can configure it at design time (in the SAP NetWeaver Developer Studio) to customize the Web service's behavior at runtime. You configure a Web service at design time by using a set of annotations, which SAP provides. You add the annotations manually in the Web service implementation bean.

Using annotations, you can configure design time properties of Web service features. In this way, you apply a minimal set of abstract configuration settings to the Web service, such as the relevant authentication level, or enabling Web services reliable messaging. The configuration you apply via annotations in the SAP NetWeaver Developer Studio serves as the basis for the runtime configuration settings you can apply in the SAP NetWeaver Administrator. For simplicity, we refer to the SAP-specific annotations you can use to configure design time properties of features as design time annotations .

Configuring Web services at design time by using annotations is optional:

  • You can leave the Web service with no custom configuration in the SAP NetWeaver Developer Studio and deploy the Web service. In this case, it will run with the default settings for every feature that can be configured via annotations. Then, you can configure the Web service at runtime from the SAP NetWeaver Administrator.

  • You can configure the design time properties of features for a Web service in the SAP NetWeaver Developer Studio. For example, it is possible that you just enable reliable messaging for the Web service and then deploy it on the application server. In this case, you have to apply runtime configuration settings to the Web service in the SAP NetWeaver Administrator to finish the configuration of reliable messaging.

Guidelines

The guidelines outlined below are applicable to the usage of the SAP-specific design time annotations:

  • You can use the annotations only in conjunction with classes exposed as a Web service ( @WebService ) and methods exposed as Web service methods ( @WebMethod ). When you are using a service endpoint interface (SEI) to expose a Web service, the @WebService and @WebMethod annotations are declared in the SEI. In this case, you can declare the SAP-specific annotations in the implementation bean, although only the @WebService annotation is explicitly declared in it.

  • Annotations configure the behavior either of a whole Web service (class level annotations), or of individual operations of a Web service (method level annotations). An annotation cannot be both a class level and a method level one.

  • You declare SAP-specific annotations in the Web service implementation bean. You cannot declare annotations in the SEI.

  • The attributes of SAP-specific design time annotations have default values.

    • You do not have to explicitly declare an annotation to set, or keep, the default value of its attributes. For example, by default all Web services you create are stateless. You do not have to explicitly use the corresponding annotation, @SessionHandlingDT (enableSession = false) , to keep the Web service configured as stateless.

    • To set the default value of an attribute, you do not need to explicitly specify this value in the annotation. For example, the default value for the level attribute of the @TransportGuaranteeDT annotation is TransportGuaranteeEnumsLevel.NONE . The meaning of @TransportGuaranteeDT() is the same as that of @TransportGuaranteeDT(level = TransportGuaranteeEnumsLevel.NONE) .

  • To use an annotation, you have to import the class of the respective annotation by using an import clause:

    Imports the class of a design time annotation. <design_time_annotation> is the name of the respective design time annotation.

Procedure