3 Replies Latest reply on May 18, 2012 7:25 PM by mhamel

    Start and End time irregularities using PI WebServices over two seperate Servers


      Hello All,


      I was just wondering whether anybody else has come across the following issue as well, or if anyone has a good explanation as to why it may be happening and a possible work around.


      Set Up: I have two serperate networks setup, which are effectivly mirroring each other. Both compramise of 2 Windows 2003 Servers, running PI Server 3.4.380 on one machine, and AF + PIWebServices, on the other. One network, which we shall call Network 1, is running on an esxi server with virtual machines, and the other (network 2) is running on Mac Server running 2 virtual machines.


      End User Scenario:  I have a Silverlight application taking data from PI using PIWebServices 2010 R2 via an AF string, Using the GetPIArchive method. The problem arrises where I have to set the time range, and have a start time and end time. The application uses two date pickers to allow the user to pick a start and end date to retrieve values for.


      The Issue: Connectiong to the first (Network 1), it works fine, the values are retrieved and there are no problems. However, when connectiong to the second network (Network 2), I get an error from the application in the Reference.cs file saying 'The Remote Server Returned an Error: Not Found". This issue becomes more apparent in that when connecting to the second network, if I use a PI date format, eg "*-90d" and "*" instead of the declaring dates, such as from the datepicker, it works and I retrieve the values absolutly fine. Both enviornments seem to have the same setup also.


      Has anybody come across this before? or have a explanation as to why this is happening?


      Many Thanks



        • Re: Start and End time irregularities using PI WebServices over two seperate Servers

          @Chris: It seems your error is hidden under a generic error message returned back to your Silverlight application. I would suggest you use a HTTP sniffer such as Fiddler or WireShark to find out more in details what could be the source of it. You can easily find these free tools by searching over the Web.


          I am curious about how you are passing the date/time from your date picker and the GetPIArchive Web method. TimeRange object argument taken by the GetPIArchive takes a PI absolute time, a PI relative time or an ISO 8601 absolute time. All times using ISO 8601 are passed as UTC time or with the offset from UTC. I have added an example of each below. Absolute time in PI format will be translated correctly according to the time zone. Can you verify this format?

          • May 8th, 2012 is 2012-05-08
          • May 8th, 2012 8:00:15 AM (UTC) is 2012-05-08T08:00:15Z
          • May 8th, 2012 3:00:15 AM (Eastern Daylight Time) is 2012-05-08T03:00:15-5:00

          I have also a few questions to better understand your problem.

          1. Where is located your Silverlight application?
          2. Is it on a Mac or Windows computer?
          3. What version of Silverlight are you using?
          4. What is the hypervisor used to run your virtual machine on the Mac Server?
            • Re: Start and End time irregularities using PI WebServices over two seperate Servers

              Hi Mahieu,


              Many thanks for the reply, I am using Fiddler, it gave me the details of 'Index is out of range. Must be non-negative and less than the size of the collection'. Which is why I started to look into the datetime ranges and with a bit of playing around found the problem.


              The user picks a start and end date from two datepickers which are then passed as a datetime format into my GetPIArchive method. I was using: 


               arcTR.Start = timeStart.ToString();
               arcTR.End = timeEnd.ToString();
               arcReq.TimeRange = arcTR;


               I have now forced the format, as the following:

              arcTR.Start = timeStart.ToString("yyyy-MM-dd HH:mm:ss");
              arcTR.End = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
              arcReq.TimeRange = arcTR;

               which has done the job and it is working now, I was originally trying various formats but none with the year first which I think was my issue.


              I am still a little confused as to why the first method works on one server and not the other though.


              In relation to your final questions, the application is currently being developed in Silverlight 5 on a Windows computer, connected to two Virtual Windows Machines on a Mac Mini Server. We are using Parrells Deskop for Mac to run the virtual machines. We wouldnt normally use a mac server, this is the first time, however we required a method to effectivly take the PI and AF servers with us to show customers and this seemed like the perfect solution as it would almost fit in your pocket :)


              Many thanks for your help though,