Skip to Content

Michal’s PI tips: Accessing Protocol Classes for Provider ABAP Proxies – XI message header

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


      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 .


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

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

You must be Logged on to comment or reply to a post.
  • Hi Michal,

    In my scenario we had common ABAP server proxy for three sender services, therein we used this to identify the sender service for some fragment of code that needed to be executed depending on the sender.

    “lv_snd  = lv_hdr->get_header_field( if_wsprotocol_xi_header=>sender_service )”


    • Hi Pravesh,

      we had the same but we can do it on the basis of the queue id as only one of them is EOIO 🙂
      so pretty much the same scenario 🙂

      Michal Krawczyk

  • Hi Michal,

    Just saw your post today. We’re using the attachment protocol quite often. I was wondering if you know a way to retrieve the real name of an attachment in a server proxy? Using the document name method gives you the name that PI sets for you eg. “attachment-1, attachment-2”. In the manifest section of the soap body you see the former real names of the attachments but I dont know a way to read them..

    Example of a manifest section:

    <?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes” ?> 

          <SAP:Payload xlink:href=”cid:4975485053_20120521_3998981.pdf>



    <SAP:Payload xlink:href=”cid:4975485053_20120521_3998981.xml>



    <SAP:Payload xlink:href=”>

    <SAP:Description>Main XML document</SAP:Description>



      Did you come across some methods to get real names in an abap proxy scenario?


      Heiko Bergmann

  • Hi Michal,

    Nice blog. A quick question though. How to recognize whether the message is retried. Is there any parameter to indicate that. Actually I am implementing a fault message and in my proxy code trying to analyze whether the message is arrived at the first time or it is retried. One way is to compare the timestamp but I hope there should be some parameter to identify that.