MichaelvdV@Atos

Some thoughts about PI Webservices

Discussion created by MichaelvdV@Atos on Feb 9, 2010
Latest reply on May 5, 2010 by cescamilla

I would like to share some thoughts I have about the PI Webservices product.

 

<disclamer>

 

In no way I'm trying to be smart or anything, but these are things that are crossing my mind. And since one of the purposes of vcampus is to have a direct link to OSIsoft developers, what better way of sharing them here. I'm not trying to criticize the product or the design decisions, but I'm merely trying to start up a discussion to get some insight.

 

</disclamer>

 

After the presentation about PI Webservices on vCampus Live!, reviewing the documentation and playing around with the product I have some concerns.

 

My main concern is the design of the service itself. From what I get, the team is trying to create an API which is very versitale, and can do lots of things with a few operations.

 

This creates a lot of challenges: WCF does not support everything you would like it to support (overloading, serialization of type object, etc.). For instance: every value (which is a VARIANT) is returned as a string, because there is no real substitute for a VARIANT/object in the WCF world.

 

By choosing WCF there has been made a decision to create an RPC based service (as supposed to a REST based approach). The 'design' concern here is that by normalizing the operations, there are only 3 operations, which could do basically everything with timelines. While this is a nice thought, I am concerned about the implications for users (us, the programmers).

 

In the current version, every call accepts arrays of objects that describe the request. While this is a good approach, a direct consequence is that every request has to be packed in request objects, which have to be packed in an array. IMO this creates a lot of code overhead on the client side.

 

One of the biggest advantages of the PI Webservices product is (IMO) that it provides a way to create Silverlight based PI applications, using an interface/API supported by OSIsoft. While developing Silverlight based PI products, "untill now" I had to create my own WCF/REST services. If I could use a Webservice supported by OSIsoft, this would certainly make my developer live a lot easier.

 

But, at this moment: I would not use the PI Webservices product. I would rather create my own WCF service. The main reason behind this is the code overhead in the Silverlight client.

 

What I would like to see in such a product is more operations. For each task an operation , something like this:

[OperationContract]
PiPoint GetPiPoint(string tagName);

[OperationContract]
List<PiPoint> GetPiPointRange(string[] tagNames);

[OperationContract]
PiValue GetSnapshot(string tagName);

[OperationContract]
List<PiValue> GetSnapshotRange(string[] tagNames);

[OperationContract]
PiValue GetValue(string tagName, string startTime, string endTime, ..., ...);

[OperationContract]
List<PiValue> GetValueRange(string[] tagNames, string startTime, string endTime, ..., ...);

or maybe somewhat more in line with the current product (supporting single/range operations):

[OperationContract]
TimeSeries[] GetPIArchiveDataRange(PIArcDataRequest[] requests);

[OperationContract]
TimeSeries GetPIArchiveData(PIArcDataRequest request);

[OperationContract]
TimeSeries[] GetPIAggregateDataRange(PIAggregateDataRequest[] requests);

[OperationContract]
TimeSeries GetPIAggregateData(PIAggregateDataRequest request);

This would already make it more user friendly for programmers! I cannot think of any drawback in supporting many/multiple operations

 

or maybe even using basic type parameters

[OperationContract]
TimeSeries[] GetPIArchiveDataRange(PIArcDataRequest[] requests);

[OperationContract]
TimeSeries GetPIArchiveData(string path, string startTime, string EndTime, PIArcManner manner);

[OperationContract]
TimeSeries[] GetPIAggregateDataRange(PIAggregateDataRequest[] requests);

[OperationContract]
TimeSeries GetPIAggregateData(string path, string startTime, string EndTime, PIAggregateManner manner);

Something along that line. What do you guys think of this?

 

ps: I was wondering why there doesn't seem to much happening in the "Web Services and PI" subforum. Webservices is a hot item, and should be something we PI programmer geeks would 'want' from OSIsoft. Why is that?

 

tl;dr; In my opinion the PI Webservices product should provide more, and more distinct operations. IMO the current implementation is not user friendly for (Silverlight) programmers to implement

Attachments

Outcomes