PI/XI: how to get a PI message from java stack (AAE) in PI 7.11 from ABAP?
There were many questions on PI forum asking about how to get the content of PI message from the PI tables. It seems that as far as it’s relatively easy to do it if the message is stored in abap tables it’s a little bit more difficult if you’re using local AAE (without IE) and the message it not stored in the ABAP tables. Is there any nice way you can retrieve the message from local AAE then?
It turns out there is and it’s not that difficult – let me show you the steps:
1. In order to get the message we will have to do two steps – call two web services and decode the message. I’m not going to show you how to call Web Serivces in ABAP as this was already described many times like in this blog:
BSP a Developer’s Journal Part XIV – Consuming WebServices with ABAP
2. At first we need to find Web Serice called – AdapterMessageMonitoringVi in WSNAVIGATOR
3. Then we need to call one of it’s methods – getMessageList in order to get messageKey of the PI message. The only input parameter is “messageIDs” and you will get messageKey as the output parameter as shown in the screen below.
4. The next step is to call the same Web Service – this time with method – getMessageBytesJavaLangStringBoolean to get the message content. The only input parameter is the messageKey.
and if the messagekey exists you should get an output similar to the one shown below.
5. As you can see the value of the response tag does not resemble the PI message yet but we’re not done yet. The content of the message is encoded with base64 so now that you have the encoded PI message you just need to decode it and you can do it in ABAP as shown in this WIKI:
Decoding BASE64 in ABAP
If you don’t belive me and want to check the message content before writing the ABAP code have a look at this free web based base64 decoder
So now you know how you can get the PI message easily from the java stack of PI ????