- Posts: 70
- Thank you received: 0
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.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Can Develop OPC XML DA C++ client in Visual Studio 2015?
Can Develop OPC XML DA C++ client in Visual Studio 2015?
Yes its clear now for me, when comes to COM connection(QuickOPC Component).
I debugged C# apps to know how the connection is happening to XML Server. Now, I don't want to bother much about connection as QuickOPC is taking care of that.
And I still stuck in the same issue as DAVtqPtr is converted in to string (DAVtqPtr->ToString).
DAVtqPtr is having DAVtqResultPtr->Vtq value which null always and am not able to see quality parameter in
ResultArray. Plese help me out.
Please bare with me as i am new to this area and correct me if am wrong.
Thanks.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I do not understand what are you trying to do with remote debugging. You should simply debug locally. And, we are not that much interested in what happens *inside* the ReadItem method itself - we just need to know the details of the exception it throws.
And, I do not understand why - at least according to the picture - you have now switched to debugging the C# demo - you have said that (as opposed to your app) it works well, so why debug it?
Thank you
Please Log in or Create an account to join the conversation.
When I am trying to debug OPC XML DA Csharp application I am getting a remote debugging error, Am I able to enter into easyDAClient1.ReadItem(serverUrlTextBox.Text,new DAItemDescriptor(itemIdTextBox.Text{ NodePath = nodePathTextBox.Text })) this function via remote debugging? Please refer attached image.
As I understand, XML DA client should connect to Webservice to get the data. In our sample code we still use COM components to connect to XML server(reusing OPC DA connection)? How this connection is happening to XML server? COM should not come into the picture right? or this COM component used only to connect XML server?
Please correct my understanding if I am wrong.
Thanks.
Please Log in or Create an account to join the conversation.
The only thing that can bring us closer is examining the exception details (Message, possibly InnerException, etc.). Can you change the code for that, or do you need help with it?
Regards
Please Log in or Create an account to join the conversation.
The OPC XML-DA enabled demo application can read data from XML server, I guess there is no issue with firewall settings. Refer attached image.
As of now I am trying with demo server which OPClabs providing, I can handle exception when I write production code. But, My doubt is that, this code could not fetch the values from demo server, as demo application can fetch. Is it kind of any logical issue or syntax based.
Please help.
Please Log in or Create an account to join the conversation.
It is likely that there was some error during reading. Then, the Vtq in the result object is null, and instead, the Exception property contains the information about the problem.
Do you have firewall open, in order to access our demo server?
To test that, simply run the OPC XML-DA enabled, prebuild demo application that comes with the product. That one DOES have error handling in it, and shows the error properly.
Or, are you already trying to connect to your own server?
The production-ready code should test the Exception property of the result first, and if it is not null, handle it accordingly (you can, for example, print out the Message property of the Exception). Only if the Exception is null, the Vtq is non-null.
Please Log in or Create an account to join the conversation.
I am getting unhandled exception(Unhandled exception at 0x74D0DB18 )on below line,
_variant_t vtqAsString(DAVtqPtr->ToString);
DAVtqPtr pointer is going null while reading DAVtqResultPtr->Vtq.
Any help please.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
For start, take the existing ReadMultipleItems example, and replace the main function with the following one:
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize the COM library
CoInitialize(NULL);
// Instatiate the EasyOPC-DA client object
_EasyDAClientPtr ClientPtr(__uuidof(EasyDAClient));
_DAReadItemArgumentsPtr ReadItemArguments1Ptr(_uuidof(DAReadItemArguments));
ReadItemArguments1Ptr->ServerDescriptor->UrlString = L"http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";
ReadItemArguments1Ptr->ItemDescriptor->ItemId = L"Dynamic/Analog Types/Double";
_DAReadItemArgumentsPtr ReadItemArguments2Ptr(_uuidof(DAReadItemArguments));
ReadItemArguments2Ptr->ServerDescriptor->UrlString = L"http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";
ReadItemArguments2Ptr->ItemDescriptor->ItemId = L"Dynamic/Analog Types/Double[]";
_DAReadItemArgumentsPtr ReadItemArguments3Ptr(_uuidof(DAReadItemArguments));
ReadItemArguments3Ptr->ServerDescriptor->UrlString = L"http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";
ReadItemArguments3Ptr->ItemDescriptor->ItemId = L"Dynamic/Analog Types/Int";
_DAReadItemArgumentsPtr ReadItemArguments4Ptr(_uuidof(DAReadItemArguments));
ReadItemArguments4Ptr->ServerDescriptor->UrlString = L"http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";
ReadItemArguments4Ptr->ItemDescriptor->ItemId = L"Dynamic/Analog Types/Int[]";
CComSafeArray<VARIANT> ArgumentsArray(4);
ArgumentsArray.SetAt(0, _variant_t((IDispatch*)ReadItemArguments1Ptr));
ArgumentsArray.SetAt(1, _variant_t((IDispatch*)ReadItemArguments2Ptr));
ArgumentsArray.SetAt(2, _variant_t((IDispatch*)ReadItemArguments3Ptr));
ArgumentsArray.SetAt(3, _variant_t((IDispatch*)ReadItemArguments4Ptr));
LPSAFEARRAY pArgumentsArray = ArgumentsArray.Detach();
CComSafeArray<VARIANT> ResultArray(ClientPtr->ReadMultipleItems(&pArgumentsArray));
ArgumentsArray.Attach(pArgumentsArray);
for (int i = ResultArray.GetLowerBound(0); i <= ResultArray.GetUpperBound(0); i++)
{
_DAVtqResultPtr DAVtqResultPtr(ResultArray[i]);
_DAVtqPtr DAVtqPtr(DAVtqResultPtr->Vtq);
_variant_t vtqAsString(DAVtqPtr->ToString);
_tprintf(_T("results(%d).Vtq.ToString(): %s\n"), i, vtqAsString.bstrVal);
}
// Release all interface pointers BEFORE calling CoUninitialize()
ResultArray.Destroy();
ClientPtr = NULL;
CoUninitialize();
TCHAR line[80];
_putts(_T("Press Enter to continue..."));
_fgetts(line, sizeof(line), stdin);
return 0;
}
I hope this helps. Le me know when/if you need more.
Best regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Can Develop OPC XML DA C++ client in Visual Studio 2015?