Sending a Message

Use

You can use a consumer proxy to do the following:

  • To call a service through the Integration Server

  • To call a Web service

How the server proxy is used depends on the runtime configuration.

Procedure

To send a message, call the corresponding consumer proxy in your application program.

  1. Declare the following variables:

    DATA:

    * Reference variables for proxy and exception class

       lo_clientProxy TYPE REF TO [generated proxy class],

       lo_sys_exception TYPE REF TO cx_ai_system_fault,

    * Structures to set and get message content

       ls_request TYPE [output message type],

       ls_response TYPE [input message type].

  2. Complete the structure ls_request for the request message.

  3. Instantiate your consumer proxy:

    TRY.

    • create proxy client

        CREATE OBJECT lo_consumerProxy

                EXPORTING LOGICAL_PORT_NAME = 'LOGICAL_PORT_NAME'

  4. To send a message, call the corresponding consumer proxy method. WSDL allows several such methods (specified by the element <operation>). In XI, there is only one method, with the default name EXECUTE_SYNCHRONOUS or EXECUTE_ASYNCHRONOUS. Catch at least the exception cx_ai_system_fault:

    * do synchronous consumer proxy call

           CALL METHOD lo_consumerProxy->execute_synchronous

                 EXPORTING output = ls_request

                 IMPORTING input = ls_response.

           CATCH cx_ai_system_fault INTO lo_sys_exception.

    * Error handling

    ENDTRY.