Skip navigation
All Places > PI Developers Club > Blog > 2011 > January
2011
jlakumb

Rolling your own web services

Posted by jlakumb Jan 19, 2011

I noticed a pattern in several posts where folks are struggling with rolling their own web services or web-based application using PI/AF SDK (see here, here, here, here, here, and here).  I know that some of you are quite comfortable with using our SDKs, and that PI Web Services is a fairly new product, but I want to draw your attention to an important point.  Here is an excerpt from the "Optimizing your PI SDK Applications" whitepaper in the vCampus Library:

 

CONCLUSION

PI SDK applications can often provide the highest performance and scalability for accessing PI data, but this requires careful planning and development using the above techniques. For most users, it may be more efficient to leave these issues to OSIsoft and use PI Web Services instead. PI Web Services leverages all of these PI SDK optimizations and provides a simple query/response interface for programmers, allowing them to focus on what data to read/write to PI, instead of how to do it.

The efficiency and ease of development with PI Web Services may be more cost-effective than doing "raw" PI SDK programming, especially when coding in .NET languages or creating modern web-based applications. The OSIsoft vCampus development license (and the corresponding PI System Access runtime license) allows customers to choose the right tool for the job, so please consider which approach (PI SDK, PI Web Services, or another PI Data Access tool) makes the most sense for your particular situation, and for the long run.

 


 

Hopefully this will convince you to review the functionality of PI Web Services first to determine if it will meet your needs, before trying to roll your own.  If not, please drop us a note (vCampus, Tech Support, etc.) and let us know what enhancements we should consider in future releases.

Ahmad Fattahi

Smart Phone Apps

Posted by Ahmad Fattahi Employee Jan 19, 2011

Smart phones and tablets are getting ubiquitous. In light of this thread and many more similar discussions, I would like to know what our vCampus Community thinks about the need, value, and considerations this topic deserves. The specific questions are as follows:

  • Do you see a strong need in your industry for having custom smart phone applications? If yes, what are those needs? Some examples are trending and Notifications on a smart phone.
  • Who do you see best fit to render this task? Do you think OSIsoft should develop such applications? Or otherwise, given the smaller nature of such products, 3rd party developers and organizations would be better solutions?

 

As evidenced from my first post on the “product lifecycle”, it is a big topic, but today I want to focus on an aspect of that topic which is currently being discussed in engineering.

 

This year OSIsoft will be introducing some new products and many updates. As with many product releases and updates, there is significant interest from partners and customers to get ahold of early bits. From OSIsoft’s point of view, quality feedback on early bits is critical to scoping features and testing efforts and a successful product launch. Our traditional practice is to post CTP or Beta bits for download on vCampus or on the support site. There may be additional criterion which qualifies a partner or customer for access to these bits but ultimately the bits make it to there destination and they may be installed in a timely manner if at all. Then, feedback may come. We have always been fortunate that a few energetic individuals dive in and provide significant feedback on the whole experience – for their effort, they usually get to meaningful steer the product. This process is not “efficient” and the ideal of sending out multiple CTP’s over a short period of time is daunting to everyone. But the potential value cannot be underestimated…

 

So, how can we maximize the overall value?

 

As hopefully everyone is aware, managed PI (mPI) now uses a technology (PI Agent…name will change) to securely connect on premise systems with the OSIsoft Network Operating Center (NOC). This channel allows us to gather PI System health and performance data (currently only available to EA customers). It also allows us to update the agent itself. Another feature which is not currently is use is the ability to distribute bits and potentially install/upgrade and configure those bits. In addition, these “applications” can send usage logs such as installation logs, feature usage, failure logs and other critical telemetry which would give our developers an intimate picture of how their product is being used and how it is behaving.

 

Now, what we are considering is using the mPI secure connect channel as the only vehicle to obtain CTP and Beta bits. It would work like this…if you want to participate in a CTP/Beta, you would have to download and register a PI Agent on the test machine. If you are already an mPI customer you may choose to join your current secure connection or configure a parallel channel for this purpose. When OSIsoft drops new bits, they will automatically be installed on your test system. Initially we are not considering any workflow on your side beyond sending an email a day or so before the event – clearly you will want a non product system for this. Through this approach, we will get comprehensive telemetry about our products without your direct feedback. Of course, there will be feedback we want from you which cannot be so easily instrumented – in particular the end user experience – like feelings (yes, OSI software engineers care about your feelings).

 

Of course we would like to make this available for Release products as well which we intend to do, but we also realize that we will need to provide legacy product distribution mechanisms (read pull technology or even DVD) for a while. We also realize that for Released products we need to provide strict workflow so that you have control over what and when things happen.

 

As with all of my posts, I encourage…okay, maybe even crave your feedback and thoughts on these topics. (If you have thoughts that you don’t want to share in public, please send me a direct communication.)

 

So…is this too “big brother”? Do the hundreds of existing deployments of our secure channel agent make this less daunting? Are you thinking…”about time”? What if the only way for vCampus users to get bits was through this mechanism?

Ever wondered (like I did) when migrating from Unix and Linux as to what happened to the Soft Links and Hard Links? Those little things were so useful to have the same file copied all over the place without having to sacrifice the space you would otherwise need to keep real copies of that file?

 

I do miss them, in fact, I miss them quite a lot.

 

I was sharing some files (from a network share, a simple, samba, windows share) and I wanted a program to be able to access those files as if they were local (think of it kind of what the PI Server needs in order to access the subfolders in its root directory) when I stumbled upon the problem that linking is not available in windows. As such I started experimenting with NTFS and having a blast at the way it is so underused, to my amazement, NTFS does support Linking files!

 

Afterwards I found a program called "Hardlink Shell Extension" (which you can find here: http://schinagl.priv.at/ *) and I played with it a bit. I realized that you can actually fool the operating system into liking windows shared files as normal files, this is useful for locking mechanisms, sharing media, video and data files, and a pletora of things. I wondered, could this be (mis)used  and fooling the PI Server into thinking that the PI Server is not in a share? Could it be a solution to have a shared folder running a cheap cluster? (note that there is no need for this since the PI Server has HA and it works great!) Could this be a solution to moving the configuration files into a single location in order to make editing easier?

 

I found a lot of questions but haven't tried everything that came to mind, however I would like to share this little tool with you, perhaps you find an interesting and useful way to use it.

 

Happy coding!

 

 

 

* please note that this is by no means endorsed by or supported by OSIsoft, Microsoft or any other party and that what is expressed here is the point of view of just one person

Back at the dawn of relational databases for PCs, I managed to issue a query that constituted a Cartesian join.  If you're unfamiliar with the term, I'll wait while you ask a DBA.

 

Yes, it was that bad.  Fortunately, it was a training class and the server came back after a few minutes.  The point is, I was an unpopular fellow for a while.

 

I mention that because there are a couple of ways for good people to attract unwelcome attention from their network administrators.  One way is to open your web service to a denial of service attack (intentional or otherwise) in which a client requests ten thousand tags, each with a different PIArchiveManner.  It makes the XML deserializer unhappy.  It makes PI Web Services unresponsive.  If WCF and the web service process it, it makes your networking people very unhappy when that big, big hunk of data goes sliding back through the network.  If you didn't mean to attack the network (like asking for *-4D, * when you meant *-4H on a busy tag), it will also make your client app slow and stupid.

 

Fortunately, WCF can help.  The various bindings support an attribute called maxReceivedMessageSize.  This is the maximum size, in bytes, of a message that the binding will let through.  A WCF client can use this to guard against a service overloading it, and you can use this in the web.config for PI Web Services to protect the service from a rogue client request. WCF will catch a message that exceeds the given value and not even try to process it.

Filter Blog

By date: By tag: