Show TOC Start of Content Area

Procedure documentation Configuring Web Services Reliable Messaging   Locate the document in its SAP Library structure

Use

You want to enable Web services reliable messaging (WS-RM) for a Web service. By default, WS-RM is disabled for all Web services you create.

You enable WS-RM for individual Web service methods in the implementation bean by using the method level @RelMessagingNW05DTOperation annotation. When you have enabled WS-RM in the SAP NetWeaver Developer Studio, you can finish the WSRM configuration in the NetWeaver Administrator by applying runtime configuration settings.

Caution

You can enable and configure reliable messaging only for:

       Inside-out Web services.

       Web service methods whose message exchange pattern (MEP) is explicitly set to one way with the @Oneway()annotation. Methods whose MEP is one way must return void. If you enable WSRM for a method that does not return void, WSRM will not be operational. More information: Configuring a One Way Message Exchange Pattern.

       Web services for which Web services addressing is not disabled. By default, Web service addressing is enabled for all Web services.

If you want to provide a WS-RM-enabled Web service in cluster environment, you have to enable stateful communication for that Web service. More information: Configuring Stateful Communication.

Prerequisites

      The implementation bean is available.

      If you are configuring an inside-out Web service by using a service endpoint interface (SEI), you must have the SEI available in the SAP NetWeaver Developer Studio. More information: Service Endpoint Interface.

Procedure

 

       1.      In the application-j2ee-engine.xml file of the EAR containing the Web service, add a runtime reference to the WS-RM application on the application server as shown in the code sample below:

Syntax

<?xml version="1.0" encoding="UTF-8"?>

<application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">

  <reference reference-type="hard">

    <reference-target target-type="application" provider-name="sap.com">tc~esi~esp~wsrm~app</reference-target>

  </reference>

</application-j2ee-engine>

       2.      The code sample below shows the usage of the annotation relevant for the enablement and configuration of WS-RM.

The method MyMethod1 is WS-RM-enabled via the method level, design time annotation @RelMessagingNW05DTOperation(enableWSRM=true).

As a prerequisite to enabling WSRM for MyMethod1, the method’s MEP is set to one way and Web service addressing is not disabled for the implementation class. The method MyMethod2 cannot be WSRM-enabled because it does not return void.

Note

In the code sample below, the @Oneway annotation is inserted directly in the implementation bean because this sample shows an inside-out Web service which was generated without using an SEI. If you are using an SEI for your Web service, you have to insert the @Oneway in the SEI.

Syntax 

package com.sap.example;

 

import javax.ejb.Stateless;

import javax.jws.WebService;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.Oneway;

import com.sap.engine.services.webservices.espbase.configuration.ann.dt.RelMessagingNW05DTOperation

import com.sap.engine.services.webservices.espbase.configuration.ann.dt. SessionHandlingDT

 

@WebService(targetNamespace="http://sap.com/example/", portName="MyClassBeanPort", name="MyClass", serviceName="MyClassService")

@Stateless

 

//Enable session handling for the whole class

//if you want to provide the WS-RM-enabled Web service

//in cluster environment

@SessionHandlingDT(enableSession=true)

 

public class MyClassBean {

      @WebMethod(exclude=false, operationName="MyMethod1")

      //Set a one way message exchange pattern for MyMethod1

      @Oneway()

      //Enable WSRM for MyMethod1

      @RelMessagingNW05DTOperation(enableWSRM=true)

      public void MyMethod1 (@WebParam(name="newValue1")

      int newValue1)

      {

         //MyMethod1 implementation

      }

      @WebMethod(exclude=false, operationName="MyMethod2")

      public int MyMethod2 (@WebParam(name="arg")

      int arg)

      {

         return arg;

      }

}

 

When you have enabled WS-RM for a Web service operation, you can configure the runtime settings for WS-RM, such as acknowledgement interval, or inactivity timeout period in the SAP NetWeaver Administrator.

More information about configuration from the SAP NetWeaver Administrator: Configuring Web Services and Web Service Clients in the SAP NetWeaver Administrator. More information about configuring individual Web services (single configuration): Configuring Individual Web Services. More information about configuring groups of Web services (mass configuration): Configuring Groups of Web Services.

End of Content Area