With protocols, you can use additional runtime services. The different runtimes support different protocols.
The ABAP runtime provides protocols through classes that implement an ABAP object interface. You access these protocol classes differently, depending on whether the proxy is a provider or consumer proxy.
For more information about ABAP object interfaces, see Interfaces.
All protocol classes have the following attributes:
They implement an ABAP object 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
The protocol constant in IF_WSPROTOCOL is PAYLOAD. The corresponding interface for the protocol class is IF_WSPROTOCOL_PAYLOAD.
To access the protocol in this example, use the protocol constant IF_WSPROTOCOL=>PAYLOAD
.
The following table provides an overview of the available protocols and the supported runtimes. Consider that if you use GET_PROTOCOL to request a protocol that the runtime does not support, the method raises an exception.
Protocol Constant in IF_WS_PROTOCOL |
Supported by XI Runtime (Interface Pattern XI 3.0-compatible) |
Supported by Web Service Runtime |
Use |
More information |
---|---|---|---|---|
ASYNC_MESSAGING |
Yes |
No |
Enables the quality of service Exactly Once in Order in asynchronous communication and controls processing of acknowledgments. |
Asynchronous Communication |
ROUTING |
Yes |
No |
Setting the receiver and other routing services. |
Routing |
ATTACHMENTS |
Yes |
Yes |
Exchanging message attachments. |
Attachments |
XI_HEADER |
Yes |
No |
Accessing XI-specific message header fields. |
Querying the XI Message Header |
PAYLOAD |
Yes |
Only XML handling, no query of payload |
Extended XML handling, for example, for querying initial values and xsd:nil. You can also use it for 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. We recommend 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). |
With consumer proxies, you access the protocol class using their method GET_PROTOCOL. Below is an example for the IF_WSPROTOCOL_PAYLOAD protocol:
Syntax
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( ).
Within the implementation of a provider proxy, you obtain the protocol class by using the CL_PROXY_ACCESS=>GET_SERVER_CONTEXT( ) method:
Syntax
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 ).
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 |
More information |
---|---|---|
GET_ACKNOWLEDGMENT |
Reads the acknowledgment status of a message by using the message ID. |
Acknowledgments |
GET_PRE_ROUTING |
Returns an object of type IF_WS_PRE_ROUTING for a proxy class for receiver preidentification. |
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).