Show TOC

Function documentationProtocols Locate this document in the navigation structure

 

With protocols, you can use additional runtime services. The different runtimes support different protocols.

Integration

The runtime provides protocols through classes that implement an ABAP Objects interface. You access these protocol classes differently, depending on whether the proxy is a provider or consumer proxy (see below).

Naming Conventions

All protocol classes have the following attributes:

  • They implement an ABAP Objects interface and include the interface IF_WSPROTOCOL.

  • All protocol classes have the prefix IF_WSPROTOCOL.

  • For each protocol class there is a constant in the interface attributes of IF_WSPROTOCOL.

  • The name of the implemented ABAP Objects interface comprises the prefix and the constant from the interface attributes.

Example

Protocol Constant in IF_WSPROTOCOL

Corresponding Interface for the Protocol Class

PAYLOAD

IF_WSPROTOCOL_PAYLOAD

To access the protocol in this example, use the protocol constant IF_WSPROTOCOL=>PAYLOAD. For an overview of all protocol classes, see the Features section of this documentation.

Accessing Protocol Classes for Consumer Proxies

With consumer proxies, you access the protocol class using their method GET_PROTOCOL. Below is an example for the IF_WSPROTOCOL_PAYLOAD protocol:

DATA:

  lo_clientProxy TYPE REF TO co_clientProxy,

  lo_payload_protocol TYPE REF TO if_wsprotocol_payload

  lo_payload TYPE REF TO if_ws_payload.

CREATE OBJECT lo_clientProxy.

*Get Protocol Class Using Method GET_PROTOCOL

  lo_payload_protocol ?=

  lo_clientProxy->get_protocol( if_wsprotocol=>payload ).

CALL METHOD lo_clientProxy->execute_synchronous

  EXPORTING output = ls_request

  IMPORTING input = ls_response.

*Use Protocol Methods

  lo_payload = lo_payload->get_sent_request_payload( ).

Accessing Protocol Classes for Provider Proxies

Within the implementation of a provider proxy, you get the protocol class by using the CL_PROXY_ACCESS=>GET_SERVER_CONTEXT( ) method:

DATA:

  lo_server_context TYPE REF TO if_ws_server_context,

  lo_payload_protocol TYPE REF TO if_wsprotocol_payload.

lo_server_context = cl_proxy_access=>get_server_context( ).lo_payload_protocol =

lo_server_context->get_protocol( if_wsprotocol=>payload ).

Features

The following table provides an overview of the available protocols and which runtime each one supports:

If you use GET_PROTOCOL to request a protocol that the runtime does not support, the method raises an exception.

Supported ABAP Proxy Runtime Protocols

Protocol Constant in IF_WS_PROTOCOL

Supported by

Use

XI Runtime (Interface Pattern XI 3.0-compatible)

Web Service Runtime

ASYNC_MESSAGING

Yes

No

Enables the quality of service Exactly Once in Order in asynchronous communication and controls processing of acknowledgments.

ROUTING

Yes

No

Setting the receiver and other routing services.

ATTACHMENTS

Yes

Yes

Exchanging message attachments

XI_HEADER

Yes

No

Accessing XI-specific message header fields.

PAYLOAD

Yes

Only XML handling, no query of payload

Extended XML Handling (for example, for querying initial values and xsd:nil); Querying the Payload

MESSAGE_ID

Yes

Yes (if configured)

Accessing the Message ID for the message sent.

SESSION

No

Yes (for services with interface-pattern stateful)

Creating or terminating a session on the receiver side with synchronous communication The logon context can be maintained over multiple calls.

SAP recommends that you only use this protocol in exceptional cases.

WS_HEADER

No

Yes (only on the consumer side)

Accessing Web service-specific message header fields (WS_Header).

Accessing Protocol Classes Regardless of the Proxy Instance (XI Runtime)

The CL_PROXY_ACCESS class provides additional help methods that enable you to access ABAP proxy runtime objects even without using a proxy instance:

Method

Use

GET_ACKNOWLEDGMENT

Reads the acknowledgment status of a message by using the message ID (see: Acknowledgments).

GET_PRE_ROUTING

Returns an object of type IF_WS_PRE_ROUTING for a proxy class for receiver pre-identification.

GET_PAYLOAD_HANDLER

Returns a payload handler that you can use for rendering and parsing the XML payload.

GET_SERVER_CONTEXT

See above.

Furthermore, using additional methods of the class, you can store relationships between PI messages and BOR application objects. For more information, see the class documentation for CL_PROXY_ACCESS (Using Object Links).