Show TOC

Setting an Authentication Level to the Web ServiceLocate this document in the navigation structure


The implementation EJB session bean is exposed as a Web service.


When you create a Web service, you can configure it at design time (in 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. More information: Configuring Web Services at Design Time .


  1. In the Project Explorer , choose Start of the navigation path ejbModule Next navigation step End of the navigation path, and then open the session bean.

  2. Update the source code as shown in the sample below.

    The code sample below shows the implementation of a class level annotation. This way you make a design time configuration of the basic authentication level of the session bean.

    import java.math.BigDecimal;
    import javax.ejb.Stateless;
    import javax.jws.WebService;
    @WebService(endpointInterface="", portName="ConverterBeanPort", serviceName="ConverterService", targetNamespace="")
    @AuthenticationDT(authenticationLevel = AuthenticationEnumsAuthenticationLevel.BASIC)
    public class ConverterBean implements ConverterLocal {
            private BigDecimal dollarRate = new BigDecimal("1.2");
            private BigDecimal euroRate = new BigDecimal("0.83");
            public BigDecimal dollarToEuro(BigDecimal dollars) {
              BigDecimal result = dollars.multiply(euroRate);
              return result.setScale(2, BigDecimal.ROUND_UP);
            public BigDecimal euroToDollar(BigDecimal euros) {
              BigDecimal result = euros.multiply(dollarRate);
              return result.setScale(2, BigDecimal.ROUND_UP);
  3. Save your changes.


The authentication level for the Converter Web service is set.