Skip to Content

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 ?

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Pravesh Puria
    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 )”

    Regards,
    Pravesh

    (0) 
    1. Michal Krawczyk Post author
      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 🙂

      Regards,
      Michal Krawczyk

      (0) 
  2. Heiko Bergmann

    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:Manifest>
          <SAP:Payload xlink:href=”cid:4975485053_20120521_3998981.pdf>

    <SAP:Name>attachment-1</SAP:Name>
    <SAP:Description>attachment</SAP:Description>
    <SAP:Type>ApplicationAttachment</SAP:Type>

      </SAP:Payload>

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

    <SAP:Name>attachment-2</SAP:Name>
    <SAP:Description>attachment</SAP:Description>
    <SAP:Type>ApplicationAttachment</SAP:Type>

    </SAP:Payload>

    <SAP:Payload xlink:href=”cid:payload-87930ef5a3b711e19a2f000003d04d02@sap.com>

    <SAP:Name>MainDocument</SAP:Name>
    <SAP:Description>Main XML document</SAP:Description>
    <SAP:Type>Application</SAP:Type>

    </SAP:Payload>

      </SAP:Manifest>

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

      Regards,

      Heiko Bergmann

    (0) 
  3. Ameet Kamat

    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.

    Regards

    (0) 

Leave a Reply