Ashok_NK

PI Web Services WCF Client

Discussion created by Ashok_NK on Jul 1, 2013
Latest reply on Jul 4, 2013 by Ashok_NK

Hi

 

I am trying to connect to PI Web Services. I added "service reference" to my project. 

 

 

 
Binding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            EndpointAddress endpointAddress = new EndpointAddress("http://bfasdfsd1/PIWebServices/PITimeSeries.svc");
            using (PITimeSeriesClient piTimeSeriesClient = new PITimeSeriesClient(binding, endpointAddress))
            {
                PISummaryDataRequest piSummaryDataRequest = new PISummaryDataRequest();
                piSummaryDataRequest.Path = @"pi:\\piServer1\sinusoid";
                piSummaryDataRequest.TimeRange = new TimeRange() { Start = DateTime.Now.ToString(Iso8601DateTimeFormat), End = DateTime.Now.Subtract(TimeSpan.FromDays(7.0)).ToString(Iso8601DateTimeFormat) };

                var requests = new[] { piSummaryDataRequest };

                TimeSeries[] summaryData = piTimeSeriesClient.GetPISummaryData(requests);

                WriteSummaryData(summaryData);

                Console.ReadKey();
            }

 

 

Calling: 

 
piTimeSeriesClient.GetPISummaryData(requests);

Returns the following error:

 

Content Type text/xml; charset=utf-8 was not supported by service http://bbmwdpdms01/PIWebServices/PITimeSeries.svc.  The client and service bindings may be mismatched.

 

 

 

Is there any other additional setup or configuration requried?

Outcomes