Skip navigation
All Places > PI Developers Club > Blog > 2011 > December

Rodney Dangerfield was a hit with his "I don't get no respect" jokes. Maybe every profession needs to lighten up a bit - especially security professionals and hackers. 


But first let's qualify hacking a bit more.  As Joel Langill summarized in his vCampus Live! presentation, when a hacker gains access is the point of no return and the activity becomes an attack. Of course perpetrators of malicious attacks are criminals and for this discussion no longer considered hackers. Criminals are definitely in the naughty category, but what about hackers?


Hackers often exploit bugs that can lead to full control of an application, server, or even a control system. In this light, bug hunting is a profession that is kind of dangerous and doesn't seem to get respect.  Think about it, a hacker does all this work to find a big, scary bug but then what?  If a hacker doesn't tell anyone the bug might go unnoticed and not get fixed (thus remain open to criminals).  On the other hand someone else might find the same bug and receive credit for all that hard work.  Obviously there is lots of incentive to report the bug.


However, how a hacker chooses to disclose vulnerability is often a matter of philosophy or in some cases a business policy. Regardless who should be told remains a very controversial topic. In the case of industrial control systems, ICS-CERT provides an official channel for vulnerability disclosure. Nice hackers report to ICS-CERT.


Like hackers, vendor coordination with ICS-CERT is voluntary. OSIsoft and other major vendors in the industrial control system community of interest have well established channels with ICS-CERT.


In other words, the effectiveness of ICS-CERT in providing good information to operators of critical infrastructure relies on nice hackers and respectful vendors. So be nice everyone and give a hacker some respect.


Happy holidays and best wishes to all of you.




The joy of computing

Posted by MvanderVeeken Employee Dec 17, 2011

There are certain moments in my live when I revisit all the joyful moments that I've experienced during my live. This always makes me think back of all the good times that I had with computers. Now, this sounds like the nerdiest and geekiest thing one can imagine: and it probably is. But the fact remains that computers brought a lot of joy and excitement in my life.


I haven't had much of those moments in the last few years, mainly because I used computers almost only for development, email and web browsing. Now: I've experienced very good and happy moments when programming: the times when you make something very complicated work, or the times when you are amazed by your own creations. But, for me that's a different kind of 'joy'.


This time the cause of revisiting all those joyful moments was the upgrade of my (personal) workstation. The hardware was getting really old. Now, as we all know that 'old' is very relative if you are speaking about computer hardware. Most of my hardware (the CPU, main board, memory and graphics card) was about 6 years old. That's almost comparing Napoleonic warfare with the modern battlefield in computer-years.


I'm one of those people who can be really spontaneous in buying small things, but when it comes to the 'bigger' expenses, I tend to wait as long as possible and try to research as much as possible. That's why my workstation hardware got so 'old'. For the last 2,5 years I had problems with it. It would halt on boots, and Windows 7 would not install. I managed to install Ubuntu after a lot of trouble, and just kept going using my ancient machinery. In the meanwhile I looked at all the reviews and and web shops in search for 'the perfect system'. I didn't want to spend too much money, but I did want to build something that would last me at least a couple of years.


I visited the US during vCampus Live! 2011, and we had training in the OSIsoft office in San Leandro. That gave us some free time during the weekend. We visited a gigantic electronics store, and I was amazed by all the computer and electronics stuff they sold. 


I felt all curious and excited inside. Then it hit me! I was reliving my own 'joy of computing'. When I got back to the hotel I started writing it down. I wanted to share this with you, in the hope you might relive your joy you had with computers.


The Joy of Computing




I think my first experience with a ‘real’ computer was at a friend’s house. I must have been 7 or 8 back then. His father worked for a telecom company, so they were early adopters. I think their computer must have been an 8068 or a 80268, and it had a green phosphor screen. We played a lot of ‘Prince of Persia’ on it. I believe the game is now available for IPhone and Android, and I had a blast a few weeks back when I was able to play it again.




Then a few years later my father bought an 80368. He thought it would be good for our education. I was playing around with the DOS shell a lot, navigating through the file system, archiving and copying games on floppy disk, etc. Then a friend of my father’s came to the house one day, and he showed me how I could use batch scripts to create a simple menu for my games. I could pop up a ‘menu’ with choices, and I had batch scripts called 1.bat, 2.bat, 3.bat, that would correspond with the menu options. He then also showed me QBasic. I was stunned by what you could do with it! I quickly created more and more nice menus for my games. This all must have been in primary school.




When I went to secondary school (age 12 or 13), I had a friend who was also into programming with QBasic. The problem back then was that you didn’t have very good references or programming examples. It was sometimes really cumbersome to create something decent. His uncle worked at a university, and they had early access to the internet. He gave us some floppy disks with examples. At a certain point, he gave us a library to control the mouse. Together with the ‘graphics’ libraries in QBasic we were able to create more decent applications and games. I can remember I learned a lot from the ‘Gorillas’ game, which was wide spread as an example QBasic application.




I still had to use the ‘family’ computer for all my programming and exploration. When there was something wrong with the computer, I was always blamed. My goal in live became to get my own computer. They were pretty expensive back then. I already had ‘job’ delivering newspapers, so I started to save for my own computer. It must have taken me almost a year, and with some help of my parents (who were fed up with me crashing the family computer all the time) I was able to buy my first computer.










A Pentium 200 MMX, with 16mb RAM with Windows 95. I believe it costs me about $1200 at that time, which is a huge amount of money when you are 13. A few months later I bought 2 10mbit network cards with BNC cable and a couple of terminators, I can remember they were also really expensive.


We then moved to Turbo Pascal and C. At that time, we got more and more computers at school, and we also started to get computer lessons. We were always bored during these classes, and we were always trying to ‘get to the grade lists’ to see and change our grades. Off course we never got that far, because we had no idea what we were really doing. But I can remember we had a lot of fun exploring the school’s network.


I would invite friends to come over and play ‘Command & Conquer: Red Alert’. We would spent the entire morning building huge bases and armies, and then battle it out in the afternoon. We crashed the game a couple of times because there were so many units on the field!


I think we also got internet at that time. First with a 33k6 modem, and later we got two ISDN lines. I got my own ISDN modem, and a whole new world was opening up for me. I quickly discovered ICQ and IRC to stay in touch with my friends and meet new people. 


I started to use mIRC, and found out about mIRC scripting. At that time I found more school friends who were also into playing games, programming and scripting. If I think back to that time, it still makes me happy. I was learning about programming and scripting, and met a lot of people trough IRC. We discussed different programming techniques, and how we could build IRC chatbots to ‘guard’ our channels. mIRC was highly customizable, and we basically could create our own applications with it.


I found out about ‘IRC warfare’. Basically, this means that you try to take over IRC channels by flooding other people out of the channels, so the you are the only one left, once you ‘cycle’ (leave and rejoin), you where the operator of that channel. I became obsessed with protecting myself on IRC and trying to get as much ‘power’ as possible. We would find SOCKS proxies to get SOCK puppets onto the IRC server, and so on. We really felt we were the ‘underground hackers’ at that time. Basically, we were just enthusiastic and curious kids looking for excitement. But this gave me the opportunity to learn about basic network protocols, and I was obsessed with learning as much as possible about the IP and TCP protocol.


Then my father came to my room with the phone bill… I think it was about $2000 for 3 months. My parents were furious, and wanted to take away my precious ISDN modem. After some debate, and after I convinced them that ‘it was good for my future, and I was learning a lot’, we agreed that I would pay half of the bill. So, I took 2 summer jobs and paid my parents back. Luckily, sometime after that we got our first ADSL connection, which saved me a lot of money and fights with my parents.


To be continued...









We are verry happy to announce that the videos and presentations from vCampus Live! 2011 have been published. These videos are recorded from Track 4 and the general sessions (see the agenda).


All videos are publicly available on the OSIsoft website. Everyone with internet access can access these, so you can also forward the links to non-vCampus members.


This is your opportunity to watch the presentations you missed!


I think all presentations are very good and really worth watching! If you did not attend vCampus Live! 2011, the 'PI System Roadmap' (demo's of Coresight for the IPad, Android Devices and WP7!) and the 'Sneak Peek at PI Server 2012' are the ones you probably want to start with. I personally also really enjoyed the two presentations by Joel Langill: 'How Stuxnet spreads' and 'Network architecture and Active Directory considerations for the PI System'. The last one has a super exciting demo near the end.


If you feel 'nostalgic' you can also have a look at  the vCampus Live! 2010 and vCampus Live! 2009 recordings! Please don't hesitate to leave any feedback here.




edit: the 'Sneak Peek at PI Server 2012' and 'The Perfect Storm: The PI System, Cloud Services and Windows Phone 7'  video's are not available yet at this moment. We will keep you posted on the ETA.


The recordings are now also available in mobile format in the 'Mobile' column.

PI System Roadmap OSIsoft John Baier General Presentation Resources MP4
Plant Performance and Condition-based Maintenance Using the OSIsoft PI System Process Innovations, Inc. Joe Devine General Presentation Resources MP4
How Stuxnet Spreads SCADAhacker Joel Langill General Presentation Resources MP4
Challenges and Future Direction OSIsoft Jon Peterson General Presentation Resources MP4
Asset Utilization with RtDuet and PI Event Frames ADM Systems Engineering Ltd. Keith Flynn General Presentation Resources MP4
The Importance of Community OSIsoft Dr. J. Patrick Kennedy General Presentation Resources MP4
Welcome OSIsoft Ahmad Fattahi General Presentation Resources MP4
vCampus All-Stars OSIsoft Michael van der Veeken General Presentation Resources MP4
The Perfect Storm: The PI System, Cloud Services and Windows Phone 7 DST Constrols Lonnie Bowling General Presentation Resources N/A

Human Body Performance Monitoring and Modeling Using PI System 2010 and PI Coresight Hulix Conseil François Ruel General Presentation Resources MP4
PI AF + PI Event Frames + Ekho from iTi = Real-time Operational Intelligence iTi Yannick Galipeau General Presentation Resources MP4
PI Event Frames for Corrosion Coupon Data Nalco Rick Davin General Presentation Resources MP4
Machine Learning for Prediction Purposes on PI System Data OSIsoft Michael Christopher General Presentation Resources MP4
Sneak Peek at PI Server 2012 OSIsoft Greg Holt General Presentation Resources N/A
Discover How to Programmatically Generate PI Coresight Displays with the Right Data Items and Time Range OSIsoft Mike Weiss General Presentation Resources MP4
Network Architecture and Active Directory Considerations for the PI System SCADAhacker Joel Langill General Presentation Resources MP4

In most situations, sitting on a box on a street corner in a big city means you’re a crazy person yelling at people about the apocalypse. However, I was casually having my boots shined and this was the perfect vantage point to get a feel for the coming days. I peered over my caffè latte, trying to seem nonchalant. A stone’s throw to my left, some new arrivals were unloading their taxis in front of the hotel entrance. A patchy beard… check, a superhero t-shirt… check,  multiple computer bags slung around each neck… check. Those guys are PI power users, I told myself, and they’re going to OSIsoft vCampus Live! 2011. I grinned with pride over my coffee and began analyzing the taxi that was pulling up. Oops… shoes done!


OSIsoft’s vCampus Live! 2011 was held at the exquisite Palace Hotel in downtown San Francisco. Standing in the main entrance looking over the Garden Court, one can’t help but wonder how many US Presidents have come through its halls. As it turns out, many have… too many to write down. With conference rooms named Napa, Marina, Presidio, Pacific Heights, and Telegraph Hill, it feels like a cross section of bay area neighborhoods all in one building.  And what better way to experience the Silicon Valley than at a high tech conference. OSIsoft is the big man in town in terms of data infrastructure software. The PI System has become the global industry standard in enterprise infrastructure, for management of real-time data and events.  OSIsoft vCampus Live! is all about getting the best and brightest PI System power users and developers, from companies all over the world, and letting them sink their teeth into OSIsoft products.


The event had three major components, the hands on sessions, the developers lounge, and the track sessions. I started in on a hands on session titled, “Migrating to an Asset Centric PI System.” Stephen Kwan, a product manager with OSIsoft, stood at the front of the room next to a pile of tech equipment and a projector screen. Some 50 expectant pupils sat at laptop stations clicking away within a virtual machine created specifically for this hands on session and served from a server in the pile next to Steve. Regardless of industry, these guys all worked at companies that have machines, or assets, which produce data and have monitoring instruments on them.  All those data streams, combined with all the data streams coming from all the other machines at the company, are stored in the PI System. The art of the PI System administrator begins with a question, “How do I find a particular data stream on a particular asset?” Traditionally, this was handled by naming conventions. That is, a data stream is named, or tagged, so that it is obvious what information it contains. But when dealing with tags in the tens of thousands, hundreds of thousands, or millions, tag names can get a bit unwieldy. For example, a tag name could easily look like this, 01212010osi.randd.kansas.kansascity.genplant.boilers.boiler02.temp1. Now try searching, analyzing, and creating equations with a million tags named like that. The solution, Steve was showing us, is to reference all that data from the PI Asset Framework. This groups tag based on which piece of equipment they belong to and organizes them into wonderful hierarchical structures.


We began the exercise in Microsoft Excel, the trusty old sword of the engineering world. Using a plug-in for Excel, one could create all the hierarchical structures and associate them with all the tags needed. It worked, but was a little complicated and required that the engineer make zero typos. Engineer… no typos. But Steve had more up his sleeve, “Ok, now that we’ve finished that up,” said Steve smiling, “I just want to let you know that this is the stupid way to migrate your data.” He made hand gestures like he was blocking the groans coming from the audience. “Now wait just a second, this is just like school. They teach you the stupid hard way first, and then they teach you the smart way.” Some in the crowd chuckled and then Steve guided us through the same exercise, only using the OSIsoft PI AF Client tool called PI System Explorer to create a quick template that basically automatically populates an asset based on the naming conventions already in place.  It saved a significant amount of time. I was still trying to get my AF structure the way I wanted it when I overheard the guys behind me talking. One had a thick Spanish accent, and the other a terse German accent. They had finished early and the German was explaining breakthroughs he’d had creating tags at work. The Spaniard was amazed and jotting down notes. Then he began talking about some things he had learned from making templates and then it was the German's turn to find pen and paper. Both seemed to have had little or no formal training with the PI system, but had self-taught themselves to be experts and were sharing revelations. Steve ended the lab with some words of wisdom, “Don’t forget to use units of measure in your AF element attributes. If you don’t, it can cause your space craft to crash into the wrong planet… upside down.” Ah, the Mars orbiter.


The next day I found myself in the developers’ lounge listening in to what amounted to Klingon as far as I could tell. The PI power users had found their groove now and coagulated into circles of combined IQ in the thousands. Dazed from searching my mind for acronyms and terms I’d never heard, I sat down to enjoy a coffee with Mike Christopher, a friend and fellow coworker. Across from us sat a well-dressed guy with a badge that read, Francois Ruel, Hulix Conseil.  A bell went off in my head. I knew something about this company.


“Oh hey, you guys did the athlete monitoring stuff right?” I broke the ice. I had read through a slide deck about how Hulix used the PI System to interface with and collect data from athletes. They were working on a new model to optimize performance by analyzing the data.


“yeah, that’s us.” Francois replied amused.


Another bell went off.


“Didn’t you ask some questions about linear regression in the ‘machine learning’ session this morning that Mike here gave?” I nodded to Mike.


I might as well have put Lance Armstrong and Michael Phelps together and told them to talk exercise routines.  It was the perfect storm of dedicated engineers and youthful enthusiasm. Mike and Francois locked in and began discussing techniques they had used to predict future data. Mike had just given a talk on using Math Works famous MATLAB program together with PI System data to model and predict data trends. Francois had done his own work modeling Pulp & Paper mill data. He recounted the time he and a colleague had zeroed in on a faulty steam condenser valve. The fix saved the mill $8K annually. One remark Francois made stuck with me, “You don’t have weeks to model these processes with high powered modeling software. You need a tool to quickly go in and analyze the process and make a recommendation to the engineers. And that’s where PI ProcessBook and now PI Coresight are really useful.”  At some point, I chimed in again to ask if there were any other non-traditional projects he had done involving the PI System, like the one with athlete monitoring. Francois paused a moment before a mischievous smile took over his face.  “Well I did interface with the electric and gas meters at my house using my office's PI System. I did it to show my girlfriend how much her long showers were costing us.” We all laughed as I imagined this confused and frustrated significant other unable to argue with her nerdy boyfriend’s usage charts. And then he continued, “One time I was giving a presentation to some financial people and I put my live house data up on screen. Then I called my girlfriend and asked her to turn on the shower and we all watched the trends going up.”  Awesome!


After the show, I was reflecting over a delicious plate of catered food in the Gold Ballroom. Two gentlemen sat down next to me and Mike Purcell. Mike, OSIsoft’s Sales Support Manager, is able to talk software shop with the best of them and was soon chatting away like old friends with the guy closer to him. As it turned out, Peter Hulse of E.On was next me and I asked him what he thought of the show.  “You know,” he said with a sly English accent, “this event is quite different. You see, I’ve been to a few of your Users Conferences (OSIsoft’s biggest annual event) and this is a lot more ‘hands on’, which is what I was looking for.” I responded by paraphrasing my hands on session experience. He then summed up the show for me, “The best way to see new stuff and what people are doing with the PI System is to come to these types of things.” I sat back in astonishment. That’s what I had been simultaneously sensing and looking for throughout the past two days.


OSIsoft vCampus' greatest accomplishment is providing an environment of collaboration and innovation for the crème de la crème of PI System wizards. Here are people from all over the world who have independently developed ways to save their companies time, energy, and money. And they’re swapping tips back and forth; homing in on some global gold standard for data management using the PI System. 



For those of you who attended vCampus Live! and we had the privilege to present to you a "Sneak Peek at PI Server 2012", one of the more exciting developments we announced are new PowerShell Tools for the PI System.  This is a set of cmdlets for Windows PowerShell which allows you to manage a PI System.  Hopefully this will make the lives of PI System administrators that much easier by enabling you to create powerful, reusable scripts for commonly needed or bulk system management operations.  We used several example scripts to show off the power of PI Server 2012, which everyone will get a chance to see once the video is posted.  We encourage you to check that out since it has exciting stuff on performance, scalability, and reliability in PI Server 2012 - something for everyone in this next release!




We are now making available the PowerShell Tools for the PI System as an extra in the Download Center.  We know there is a lot of interest in using PowerShell (or other scripting tools) with the PI System, based on the following discussion threads -




Powershell & Archive Maintenance


PI - Automation of Maintenance


Powershell scripts for PI System maintenance


Powershell and Archive Maintenance


Get the Archive - Files


Scripting MDB edits










Some of the use cases we have heard are monitoring message logs, scheduling backups, adding users or mappings, and managing archives.  In fact, we provided sample scripts for each of these.  The samples are well documented and should be a good starting point.  In addition, the online help for each of the cmdlets is extensive and a great resource.  In case you have a question or need further assistance, feel free to leverage the vCampus community.  We will also be listening in for feedback and providing "support" (although it is not an officially supported PI product).




If you are new to PowerShell, here are some links you might find useful to get started:


Windows Powershell Getting Started Guide


Scripting with Windows Powershell




Enjoy the new PowerShell Tools for the PI System and if you like it, or you want to see some features/functionality added, or you have a helpful script to share, then please let the vCampus community knowStay tuned for a webinar early next year where we can dive into more of the capabilities of this tool.




Happy scripting!




edit by Michael @ OSIsoft: the PowerShell Tools for the PI System are not available yet in the Download Area, we are uploading them this very minute. Stay tuned The download is up in the Download Area, under 'Extra's'!


Update: check out this webinar -

Builders's Café Webinar Series: The PI System and PowerShell - The Life of the PI System Admin Just Got Easier

Microsoft is organizing an event around Windows Azure called 'Learn Windows Azure'. It will start at 09:00 AM on Dec. 13. The best thing is: it's free. If you happen to live in the Redmond area, you can attend the event in person. If you don't happen to live in the neighborhood you can attend the event live via Channel9!


The event focuses on getting started with building applications for Windows Azure. I think this event is great to get an idea on what's involved with Azure development. The event will be led by Microsoft's technical leaders Scott Guthrie, Dave Campbell, and Mark Russinovich!


Scott Guthrie will be kicking off the event with a 90 min. keynote that will provide an overview of Windows Azure and he will explain the concepts and core features. He will walk through building applications for Windows Azure with Visual Studio and the Azure SDK (with lots of demo's!). After that they will drill down more on Cloud Data and Storage, using the Windows Azure tools for Visual Studio and how to build scalable cloud applications with Windows Azure. The event will be concluded by a Q&A session.


You can register for the event here.


Here's the agenda







Firstly, blown away that I was voted as an All-Star for the 2nd year running.  Thanks to everyone that voted, but note that this now means I will just continue to post more, and more, and more, ...
Also, I want to congratulate Lonnie and Asle for being voted as All-Stars too!  Well deserved for both of you.


The Palace Hotel was a great venue with easy to access rooms for each of the presentations, learning labs and roundtables.  Quite liked the fact that we had breakfast and had the morning presentation in the same room, only issue with this would be that the stage seemed a little shoved in to the corner.  Nice to visit San Francisco again, but would be nice to have an event/conference on the East Coast of the USA (New York?) or in Europe (my biased opinion coming from Europe).
The Developers lounge was a nice addition to the event, although I didn't get much time in there. 


Learning Labs:
On the face of it a great idea and an opportunity to get hands on with some of the PI products, I saw some people got some real benefit from the labs which was good to see.  Couple of issues for me personally... 1) for future learning labs it might be an idea to give an anticipated level of experience/knowledge of the product, some of them were not as the title described (e.g. Coresight 'under the hood' was just installing Coresight). 2) there were quite a few problems with the match up to the virtual environment and what was on the handouts, missing steps, incorrect steps, and so on.  These need to be more accurate.
Of the learning labs I did like the PI Event Frames lab, it had good content.  For future learning labs how about before the event attendees submit a real world problem and all people that attend a learning lab help to solve a problem (that OSIsoft picks) with some real hands on work of the PI product(s) in focus? 


High quality presentations that were a credit to the event, some got me very excited.  In particular I thoroughly enjoyed the PI Server 2012 presentation.  A lot of features in PI Server 2012 I have needed for a long time now and it is exciting to see they are coming, the presentation was well presented considering it also involved some live demonstrations.  Powershell, Archive data backfiling on the fly, incredible performance updates to some core parts of the PI server (update signup rates, point lists, start up times, ...), etc - already pushing one project I am working on to sign up for the PI Server 2012 Technology Adaption Program.
The next presentation that caught my full attention was a surprise to me, it was the security presentation about STUXNET and security in general.  A real eye opener that got my attention quickly and immediately made me download Metasploit, Armitage and some other tools to take a serious look in to the security aspects of PI System projects that I am involved in.  Great presentation from SCADAHacker and Bryan Owen.
Some others that I watched and enjoyed were the Cloud/Mobile (Lonnie), Event Frame Corrosion Coupon, Ekho (like this system a lot), and human body monitoring presentations.  


Any other presentations of note that you all watched? Please let me know so I can catch the recordings.


Overall, great event, great attendees, great OSIsoft staff and great All-Star goodies!!  Will definitely be attending next year.



As promised in this post I am continuing my travel to the land of C++.


In this post I will try to get a snapshot calling PI Web Services from C++. Similar as with the PI SDK this does requires some more ground work then consuming the PI Web Services in .NET.


The following example makes use of the gSoap toolkit, an open source, cross-platform toolkit for calling web services from C and C++ - so you may start by downloading it from here. I encourage you to take a look at the Getting Started. This example requires basic binding with no security - make sure that you use the web_config_basic_no_security web.config file for your PI Webservice*.


If you have downloaded the gSoap toolkit you start with creating the include files for your C++ application. This is a two step process starting with using wsdl2h to create the gSOAP header file from the WSDL. Adjust the path to the webservice as necessary. Note that you can choose your own name for the web service namespace with the -n argument.


The second step is using the soapcpp2 compiler to create the necessary code snippets to include into your application. The -I indicates the path to the import folder of the gSoap toolkit - you need to adjust that depending of the version and where you have extracted your gSoap toolkit.


soapcpp2.exe -1 -i -IE:\gsoap_2.7.17\gsoap-2.7\gsoap\import -C PITimeSeriesService.h

That is the point now for opening Visual Studio and starting our project:




Soapcpp2 has created some files that we need in our project:




We copy them to our source directory and add the cpp files to the project. Furthermore we need to add stdsoap2.cpp from the gSoap toolkit. Finally it should look like this:




We need to add the gsoap source directory as additional include directory for the C++ compiler:




If we have not done so at the beginning we disable precompiled headers now:




and add the necessary includes:

#pragma once
#include <iostream>
#include "BasicEndpoint.nsmap"
#include "soapBasicEndpointProxy.h"

Now it is time to open our source file and start to write the code. As first step we will get the PI Web Services version and the endpoint:



_tmain(int argc, _TCHAR* argv[])
// gSOAP proxy object for PI Web Services
BasicEndpointProxy wsService;

    // Product version request

    _PIWS1__GetProductVersion wsVreq;
    _PIWS1__GetProductVersionResponse wsVresp;
// Get Version and Endpoint string
int error = wsService.GetProductVersion(&wsVreq, &wsVresp);

if (SOAP_OK == error)
        std::cout <<
"Endpoint: "
                  << wsService.soap_endpoint
                  << std::endl;
        std::cout <<
"PI Web Services Version: "
                  << wsVresp.GetProductVersionResult->c_str()
                  << std::endl;
        std::cout <<
"GetProductVersion fault\n";
        soap_print_fault(&wsService, stderr);

    // free dynamic memory allocated by gSOAP

return 0;

Time for testing - if you have done everything above you should get something similar to:




 Now let us prepare for the snapshot:


// Snapshot request
_PIWS1__GetPISnapshotData wsRequest;
_PIWS1__GetPISnapshotDataResponse wsResponse;
PIWS1__ArrayOfString wsPaths;
// Path to a PI Tag
std::string strPath =
// Add to the Array of Paths
// Path to a PI Tag
strPath =
// Add to the Array of Paths
// Path to a PI Tag
strPath =
// Add to the Array of Paths
wsRequest.paths = &wsPaths;

And the final step is getting the snapshot and printing it out:


error = wsService.GetPISnapshotData(&wsRequest, &wsResponse);

if (SOAP_OK == error)
    std::cout <<
"GetPISnapshotData: "
              << wsResponse.GetPISnapshotDataResult->TimeSeries.size()
              << std::endl;
    PIWS1__ArrayOfTimedValue *wsTimedValues;
for (unsigned int a=0;
         a < wsResponse.GetPISnapshotDataResult->TimeSeries.size();
        wsTimedValues = wsResponse.GetPISnapshotDataResult->TimeSeries[ a ]->TimedValues;
        std::cout << wsResponse.GetPISnapshotDataResult->TimeSeries[ a ]->Path->c_str()
" "
                  << ctime(&wsTimedValues->TimedValue[ 0 ]->Time)
" "
                  << wsTimedValues->TimedValue[ 0 ]->__item
                  << std::endl;
    std::cout <<
"GetPISnapshotData fault\n";
    soap_print_fault(&wsService, stderr);

Again time for a test:




Done! But not with C++ - we will revisit the PI SDK soon...




*ways to secure basicHttpBinding are described in the PI Web Services documentation.


You might recognize STL (Standard Template Library) keywords in the code. gSoap uses this for strings and arrays by default. Good documentation on STL can be found here.

Filter Blog

By date: By tag: