Skip to Content


I will share a complete solution with the objective to achive the logic that will alow you to make corrective decisions for your solutions implemented or to monitor for preventive symptoms for current interfaces… After we can agree that a lot of companies suffer in their integration processes and don’t know the main reason, but this article will not cover that point here; because i just will share a “logical tool” to let you implement your own technology to monitor and decision making reports.

First it is important to share a great reference that talk about this logic via Michal’s with great tips!!: michals-pi-tips-how-to-get-rwb-message-overview-data-to-an-external-system

Understanding Michal’s proposal, we can now implement our new tool:

About Metada:

  1. Getting metadata:


2. Example of execution without values:


3. Now your xsd can be uploaded in an external definition via PI Enterprise Service Repository:


After you understand the logic about metadata, now we can test with different tools in order to get the Runtime workbech information:

1. Excecute your own url: http://<host>:<port>/mdt/messageoverviewqueryservlet?component=af.<AF.PARAMETER><PITECHNAME>&view=SR_ENTRY_VIEW_XPI&begin=2016-12-31%2018:00:00.0&end=2017-12-31%2018:00:00.0&detailedStatus=true


2. Test via POSTMAN:

This technique is important because you will confirm 2 data information for security cookie:




3. Now you can test it via SOAPUI:


After you understand how to get the metadata and how to testing, you can implement different solutions since using only java and excel, or using automatic interfaces, or technologies for analytics via hana, lumira, or another in your robust infraestructure for your decision making…


1. Implement Java Call:



package test;


//import org.apache.commons.codec.binary.Base64;


public class ConnectToUrlUsingBasicAuthentication {

	public static void main(String[] args) {

		try {
			String webPage = "http://hostname:port/mdt/messageoverviewqueryservlet?component=af.<AF.PI.PARAMETERS>&view=SR_ENTRY_VIEW_XPI&begin=2016-12-31%2018:00:00.0&end=2017-12-31%2018:00:00.0&detailedStatus=true";
			String name = "admin";
			String password = "admin";

//			String authString = name + ":" + password;
//			System.out.println("auth string: " + authString);
//			byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
//			String authStringEnc = new String(authEncBytes);
//			System.out.println("Base64 encoded auth string: " + authStringEnc);

			URL url = new URL(webPage);
			URLConnection urlConnection = url.openConnection();
			urlConnection.setRequestProperty("Authorization", "Basic " + "SPACEAuthentification ID");
			InputStream is = urlConnection.getInputStream();
			InputStreamReader isr = new InputStreamReader(is);

			int numCharsRead;
			char[] charArray = new char[1024];
			StringBuffer sb = new StringBuffer();
			while ((numCharsRead = > 0) {
				sb.append(charArray, 0, numCharsRead);
			String result = sb.toString();

			System.out.println("*** BEGIN ***");
			System.out.println("*** END ***");
                 * To write contents of StringBuffer to a file, use
                 * BufferedWriter class.
                BufferedWriter bwr = new BufferedWriter(new FileWriter(new File("C:\\Path/demo.xml")));
                //write contents of StringBuffer to a file
                //flush the stream
                //close the stream
                System.out.println("Content of StringBuffer written to File.");
		} catch (MalformedURLException e) {
		} catch (IOException e) {



Test your java solution:

In this case you can get data via REST or via HTTP Request, even modify your way to test:

In this case, how to call an http and dont forget just use basic authentification, without user an password:

In this case, how to save it via file:


2. Implement PI call insted manual solution:


Data Source:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:MessageStatisticsQueryResults xmlns:ns0="">
         <ns0:Column>Sender Component </ns0:Column>
            <ns0:Entry>SENDER_COMPONENT </ns0:Entry>
            <ns0:Entry>RECEIVER_COMPONENT </ns0:Entry>
            <ns0:Entry>SERVICE_INTERFACE </ns0:Entry>
            <ns0:Entry>NAMESPACE </ns0:Entry>
            <ns0:Entry>A </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>0 </ns0:Entry>
            <ns0:Entry>22 </ns0:Entry>


Target Metadata:
MT_ MessageType Element DT_DataType null
row Element 0..unbounded false
SenderPartner Element xsd:string 1 false

Implement transformation (with one logic proposed but you can change it):

Mapping: in simple idea is a direct mapping node and childnode(here you add UDF)


UDF: ConcatSubnodes

public String ConcatSubnodes(String srcTreeFragment, Container container) throws StreamTransformationException{
Document doc = null;
String resStr = "";
try {
 InputStream in = new ByteArrayInputStream(srcTreeFragment.getBytes("UTF-8"));;
 doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
 catch (Exception e){
 throw new RuntimeException(e.getMessage());
NodeList items = doc.getDocumentElement().getChildNodes();
 for(int i=0;i<items.getLength();i++){
   resStr = resStr + " | " + items.item(i).getTextContent().trim();

return resStr;



Result to import to Excel (you can modify the logic):

<?xml version="1.0" encoding="UTF-8"?>
<ns1:MT_MessageType xmlns:ns1="http://example">
      <SenderPartner> | NA | SENDER_COMPONENT | NA | RECEIVER_COMPONENT | SERVICE_INTERFACE | NAMESPACE | A | 0 | 0 | 0 | 0 | 0 | 0 | 22</SenderPartner>


3. Implement Analytics in a simple way via Excel:



Thank you and success for your own solution!!

To report this post you need to login first.

1 Comment

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

  1. Ariel M. Bravo Ayala

    Thanks Azael for your blog entry. Keep going.

    Although I get your idea, I think is cleaner and simpler to use the Adapter Message Monitoring WS. It is a WS that is already prepared for this duties and provides extra valuable information. You can access this WS at:






Leave a Reply