Access to WinCC OA from Webservice via C # API

Find and share HowTos to various installations / configurations!
20 posts • Page 1 of 2
juma4
Posts:42
Joined: Thu Jun 30, 2011 2:23 pm

Access to WinCC OA from Webservice via C # API

Post by juma4 »

I have a webservice with which I would like to read data from the WinCC OA. If I now want to access the OaProcessValues, I always get a System.NullReferenceException. Has someone already experiences with the C # API and could give me a tip?
Thanks a lot

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Access to WinCC OA from Webservice via C # API

Post by agruber »

Have you followed the complete C# API example? If not try first to create a small program with the complete example code. If that works try to integrate it into your webservice.

Depends on what you want to do you could also query OA via websockets, this should be fairly easy with C#. On OA side there is a websocket server example here:
https://portal.etm.at/index.php?option= ... 16&id=4985

juma4
Posts:42
Joined: Thu Jun 30, 2011 2:23 pm

Re: Access to WinCC OA from Webservice via C # API

Post by juma4 »

Thanks for the tip. I have created the manager, and it runs. Now I have the .exe as a reference in my webservice integrated. However, I can not access the methods. Do I have to initialize the manager specifically?

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: Access to WinCC OA from Webservice via C # API

Post by tmalone »

Just FYI, I have been very successful using netGet/netPut/netPost() functions from OA to work with various Web Services. I think I am on my 3rd project with these and never had to build my own API Manager

Todd Malone
USA

mhargreaves
Posts:84
Joined: Thu Nov 11, 2010 12:31 pm

Re: Access to WinCC OA from Webservice via C # API

Post by mhargreaves »

Hi Todd

I am trying to use netpost from CONTROL script to submit a post to a webapi server I am hosting.

Do you have any experience with implementing some sort of security on this connection? (Authorization/Authentication)

Mark

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Access to WinCC OA from Webservice via C # API

Post by kilianvp »

auth on external Server or WinCC OA?

for netpost on external Server you can use

Authorization: Basic XY

or

Authorization: Bearer XY

mhargreaves
Posts:84
Joined: Thu Nov 11, 2010 12:31 pm

Re: Access to WinCC OA from Webservice via C # API

Post by mhargreaves »

Thanks - it is to an external server - a WebApi server that I am creating, so I need to implement the authentication on there.

How to get the 'XY' part in WinCC OA? Can you read the password from the user credentials within WinCC OA?

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Access to WinCC OA from Webservice via C # API

Post by kilianvp »

Mark Hargreaves wrote:
Thanks - it is to an external server - a WebApi server that I am creating, so I need to implement the authentication on there.

How to get the 'XY' part in WinCC OA? Can you read the password from the user credentials within WinCC OA?
so you want auth against the external Server with your WinCC OA credentials?

mhargreaves
Posts:84
Joined: Thu Nov 11, 2010 12:31 pm

Re: Access to WinCC OA from Webservice via C # API

Post by mhargreaves »

That was the idea I had - I'm not really familiar with authentication methods. If there is a better way of doing it, I would like to learn this.

I need to post some data to my server using netpost from a button click method. This will post to a URL, but I need to protect that URL so that not just anyone can post to it (using a browser etc), but also I don't want the user to have to enter a username and password everytime they click the button.

Any ideas are welcome!

Thanks
Mark

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Access to WinCC OA from Webservice via C # API

Post by Gertjan van Schijndel »

Reading the password is not possible.

For preventing access for anyone you can use information, that is already available like sender address or user agent. Or add a custom http header.
But against a hacker it will not really help.

20 posts • Page 1 of 2