7 Replies Latest reply on Oct 19, 2010 12:10 AM by rrn

    InsertPIData method error

    rrn

      Hi,

       

      I have 2 questions regarding PI webservices

       

      1. One of our clients is trying to use InsertPIData method to update tags on our PI server. He is receiving an error:

       

       <Message>Malformed path: pi:TAGNAME</Message>

       

      What could be the possible source of this error? The tag security is set for WRITE data permission only.

       

      2. The client is able to use Get-Data methods successfully and is able to retrieve data. However, I do not see any events in the PI Message log for successful PI connection when he accesses our PI server. How will I know when someone is connected to our PI server in absence of these log events? I am using Windows Authentication method. In IIS, PI website is mapped to an AD account which is a member of one of the PI Identities groups in AD. If I use PI trust connection instead of AD, I can see the connection messages in PI logs.

       

      Thanks,

       

      Rashmi

        • Re: InsertPIData method error
          Ahmad Fattahi

          Rashmi,

           

          As for the first question, how are you specifying the path to the tag? Also what happens if you grant read and write permissions on the tag to the identity that is being mapped from the AD user? You would also need to make sure that WIS is selected as the highest on the list of authentication on the PI server (any connection manager menu).

           

          And for the second question, do you see any messages corresponding to the very first attempt of connecting to the PI server or nothing at all? When using trusts, do you disconnect and reconnect to the PI Server?

            • Re: InsertPIData method error
              rrn

              The path = "pi:\\piservername\tagname"

               

              The read/write permissions are already mapped to the PI Identity of which the AD user is a member. I am not sure what you mean by WIS.

               

              Secondly, I don't see any messages at all with AD authentication method. For trust, I do see messages when user connects/disconnects.

               

              --Rashmi

                • Re: InsertPIData method error
                  rrn

                  The pi webservice is installed on a server other than PI server.

                    • Re: InsertPIData method error
                      hanyong

                      WIS means Windows Integrated Security. Using mappings to map Windows users/groups to PI Identities, means that you are using WIS

                       

                      You should see some message from the PI server message log even if you are using mappings of AD user to PI Identities. One of the messages is generated by PI Net Manager when I have test a connection myself:

                       Successful login  ID: 20. Address:  . Name: w3wp.exe. Identity List: PIEngineers | PIWorld. Environment Username : NT AUTHORITY\NETWORK SERVICE. Method: Windows Login (SSPI,NTLM) 

                      We can see the list of PI Identities that the incoming connection is mapped to. You can double check the PI Identities that the application gets trusted as from here.

                       

                      The error message "Malformed path" does suggest that it is a problem with the path definition in the request, which is weird since what you are using is ok. Where are you invoking PI Web Services from? Your own program based on VB.Net or C#? or some Web Services Analysing/Testing Tools?

                        • Re: InsertPIData method error
                          rrn

                          Thanks Han! Good to hear from you.

                           

                          Actually, the webservice is hosted on a separate server and has an AD account attached to it in ISS. This AD account is a member of a AD group which is attached to an PI Identity. With this set up I am not able to see any message for successful login in PI SMT. I was wondering if you are using some different set up.

                           

                          Is it possible to give a sample code snippet for IsertPIData() ? I am not a regular programmer so it will be helpful. I found one for GetPIArchivedata method but that method is quite different from IsertPIData method.

                            • Re: InsertPIData method error

                              Consider the following code, assuming that _proxy is the Web service client proxy you created (you can use the same as you used for you GetPIArchiveData call):

                              // Create an array of TimeSeries object 
                              // and populate it with 1 TimeSeries

                              TimeSeries[] tss = new TimeSeries[1];
                              TimeSeries ts = new TimeSeries();
                              tss[0] = ts;

                              // Create an array of TimedValue objects 
                              // and populate it with 1 TimedValue
                              TimedValue[] tvs = new TimedValue[1];
                              TimedValue tv = new TimedValue();
                              tvs[0] = tv;

                              // Populate the TimeSeries with the TimedValue
                              ts.TimedValues = tvs;

                              // Set the Path for the TimeSeries
                              // (could be done on the individual TimedValue instead)
                              ts.Path = txtPath.Text;

                              // Set the Value and Timestamp for the TimedValue
                              tv.Time = DateTime.Parse(txtTimestamp.Text);
                              tv.Value = txtValue.Text;

                              // Call the method and return eventual errors
                              TimeSeries errors;
                              errors = _proxy.InsertPIData(tss, InsertPIDataDuplicateSwitch.InsertDuplicate);

                              Then you need to handle errors, if any, returned by the web service call:

                              // The web service returns a single TimeSeries.
                              // Any entries in this TimeSeries denote failed insertions.
                              // The series status property will have a count of successful insertions.
                              // An array of length zero is returned if everything succeeds.
                              if (errors.TimedValues.Length > 0)
                              {
                                  // Do something with errors with 'errors.ErrDesc'
                                  // and any individual TimedValue in 'errors.TimedValues'
                              }
                              else
                              {
                                  // All insertions succeeded;
                              }

                              Note, this is for demonstration purposes... you need to make sure you implement appropriate error handing (try..catch), at least around the web service call.

                               

                              Hope this helps!