Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Siemens OPC Server: error calling method

More
19 Mar 2018 14:03 #6161 by support
Great :-)

Thanks for letting me know and explaining the problem, and its solution here.

Best regards

Please Log in or Create an account to join the conversation.

More
19 Mar 2018 13:27 #6159 by federica
Thank you for your quick reply!
I solved my problem.

The message I received was:
Description
"OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
StatusCode: {BadUserAccessDenied} = 0x801F0000 (2149515264)
---- REMARKS ----
This error should mean an authorization (permissions) problem, not an authentication problem, but some servers are using it instead of rejecting the identity token (BadIdentityTokenRejected).
If you are identifying the client user by a user name token, it could be that the user name/password combination is incorrect."
ErrorMessage
"Unknown error 0x80131500"

With Siemens OPC Server, I have to authenticate with a user. With anonymous user, I can't call methods and I can't access to the values of the variables.

This code solved my problem:
_EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));
_EasyUAAdaptableParametersPtr  IsolatedParameters = ClientPtr->GetIsolatedParameters(); 
_UASmartSessionParametersPtr SessionParms = IsolatedParameters->GetSessionParameters();
ClientPtr->Isolated = TRUE;
SessionParms->UserIdentity->UserNameTokenInfo->UserName = L"***username***";
SessionParms->UserIdentity->UserNameTokenInfo->Password = L"***password***";

Please Log in or Create an account to join the conversation.

More
10 Mar 2018 06:16 - 10 Mar 2018 06:17 #6132 by admin
Hello.

As there can be many error reasons, you need to obtain and give us more details about the error.

For start, _com_error (msdn.microsoft.com/en-us/library/0ye3k36s.aspx ). For start, what is the error's ErrorMessage?: msdn.microsoft.com/en-us/library/7db325b0.aspx

Best regards
Last edit: 10 Mar 2018 06:17 by admin.
The following user(s) said Thank You: federica

Please Log in or Create an account to join the conversation.

More
09 Mar 2018 21:26 #6131 by federica
Hi,
I'm starting using your SDK (QuickOPC 2018.1, in particular OPC-UA under COM with C++) and I need your help.

I need to read some variables from a Siemens Sinumeric 840D sl.
From the Sinumerik documentation:

"All variables that cannot be accessed via browsing can only be read and written via the 'ReadVar' and 'WriteVar' methods".

So, I'm using "CallMethod" function in order to call "ReadVar" method and read my variables, following the example I found at this address: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...g%20Methods%20in%20OPC-UA.html
[...]
CComSafeArray<VARIANT> inputs(1);
inputs.SetAt(0, _variant_t(L"/Plc/Db1070.dbb0"));
 
CComSafeArray<VARIANT> typeCodes(1);
typeCodes.SetAt(0, _variant_t(TypeCode_String));
 
// Instatiate the client object
_EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));
 
// Perform the operation
SAFEARRAY* pInputs = inputs;
SAFEARRAY* pTypeCodes = typeCodes;;
CComSafeArray<VARIANT> outputs;
ClientPtr->CallMethod(
    L"opc.tcp://**address**:**port**",
    L"ns=2;s=/Methods",
    L"ns=2;s=/Methods/ReadVar",                
    &pInputs,
    &pTypeCodes);
[...]

But when I call "CallMethod", I receive a _com_error.

I think there is a problem in the way I specify the objectNodeDescriptorString and/or the methodNodeDescriptorString and/or the input parameter but I'm not sure and I can't figure out which is the problem and how to solve it.... can anyone help me, please... I have to get my project in production for thuesday. :unsure:

Thanks!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.060 seconds