Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Datasource OPC UA Client error ID:7012

vincentd
2023-02-03
2024-04-05
  • vincentd - 2023-02-03

    I'am testing the OPC UA client (datsasource) using the control win V3 in demo mode (version 3.5.18 patch 40).T
    The opc UA server is a B&R Buscontroler type X20BC008T which is to be connected to an Codesys PLC with a target 3.5.18.40.
    Both 'sign and encript' and loggin are recquired
    When configuring the datasource the OPC UA server is found and the available variables are shown and imported.
    I've created the datasource initialser with the same username and password used to import the variable.
    How ever at runtime the datasource manager trhows an error 7012 'The username that is passed to the userconfiguration at runtime must be the same as the username passed in the Datasource configuration. Error 7012'
    In the logbook there are two lines indicating the error :
    'Diffring username at configuration and runtime. vs BR'
    and
    Datasource_X20BC008T : Error failed (7012) in state connecting'
    What does Diffring mean?
    Is there someting I'm missing

    Below the code for the datasource manager, I've added 'BR' after _password. Is this the wrong way to use it?

    is there somewhere an example using 'sign and encript' in stead of anonymous loggin?
    I've attached 5 screenhots.

    Remark : UA Expert and Ignition SCADA 8.1 seems to have no problem to connect and get the values from the said bus controler.

    {attribute 'call_after_global_init_slot' := '60000'} // Call after the datasources are initialized.
    {attribute 'linkalways'} // This program is always part of the application, even if not directly called.
    PROGRAM Datasource_X20BC008T_Initializer
    VAR
    // The static credentials provider stores the password as part of the application.
    // To provide the password with a visu-dialog use a 'Visu_FbDialogLoginProvider'.
    // To provide a custom implementation, implement the interface 'Datasources.ICredentialsProvider' and return an 'IDatasources.ICredentialsUserPassword'.
    staticCredentialsProvider : Datasources.StaticCredentialsProvider := (
    _username := 'BR',
    _password := 'BR');
    END_VAR
    g_Datasources.GetDatasource('Datasource_X20BC008T').SetCredentialsProvider(staticCredentialsProvider);

     

    Last edit: vincentd 2023-02-03
  • piautomation - 2023-04-13

    Hello vincentd,

    have you already tried to use the hostname? CODESYS does not have the IP Address in their certificates. If the PLC cannot resolve a host name, no connection can be established via certificate. So you need to add the IP to the hosts file (after adding, delete the ARP cache if necessary, if IP is assigned via DHCP, the hosts file may have to be adjusted more often... ) or use the hostname if possible. IP address is just working for non-encrypted communication.

    regards

     
    • vformanek - 2023-11-21

      Hey, I am facing the same problem. Basically UA Expert and other programs work fine with the login credentials. But codesys can not use them properly. I can see the server login to it manually but when I download the program and run the datasource never runs... Currently I am facing the same Error ID: 7012 and cant get it running properly.

       

      Last edit: vformanek 2023-11-21
  • vincentd - 2023-11-21

    I had some help from Codesys to debug this problem. It seems there was a problem within the target (a bug?). I only used for a proof of concept. Possibly it will work with a new version of the target

     
    • vformanek - 2023-11-21

      Sorry to bother but what do you mean by target ?

       
      • vincentd - 2024-04-05

        the target is the codesys software executing the PLC code like ladder / instruction list etc...

         
  • simonh - 2024-04-04

    Hello, did you find the solution for the communication?Has the communication between the two been successful? if yes, can you please share me your solution since i have similar issue now. Thanks.

     
    • vincentd - 2024-04-05

      I have not used this client / server OPC UA combination since. We were only making some kind of proof of concept. I did understand that there could be some kind of bug. I do not know if the supposed bug has been resoved since. Perhaps you could try what piautomation is suggesting

       

Log in to post a comment.