Currently Being Moderated

In one of my recent projects I was asked to use one of the PI message header properties - queueid - inside the server ABAP proxy.



It seemed like an easy task as setting serialization ID in the client proxy is relatively very simple so I started searching for some references on SDN… and could not find any.
It turns out that accessing protocol classes for provider ABAP proxies is also pretty easy but you need a different approach. Let me show you an example on how to access any XI message property in server ABAP proxies with the piece of code below:

  DATA: lv_queue TYPE trfcqnam.
 

  DATA: lv_quality TYPE char4.

 

  DATA:   lo_server_context   TYPE REF TO if_ws_server_context,
        

              lo_xi_header TYPE REF TO if_wsprotocol_xi_header.




*get the queue name  and quality of service from the PI channel
 

TRY .

      lo_server_context   = cl_proxy_access=>get_server_context( ).


      lo_xi_header ?= lo_server_context->get_protocol( if_wsprotocol=>xi_header ).


      lv_quality  = lo_xi_header->get_header_field( if_wsprotocol_xi_header=>quality_of_service ).


      lv_queue = lo_xi_header->get_header_field( if_wsprotocol_xi_header=>queue_id ).

   

    CATCH cx_ai_system_fault .
   

    CATCH cx_ai_application_fault .

ENDTRY.



With this piece of code you can get all possible XI header values inside the provider proxy as per attributes of the if_wsprotocol_xi_header class: 

 



Note - further reading:
For more references on how to use other protocols please have a look at help.sap.com.

Question to you:
Have you ever needed to use any of those protocols in the ABAP server proxy ?

Comments

Filter Blog

By date:
By tag: