Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetChild freeopcua method : requested operation has no match to return. (0x806f0000) #384

Open
FaidiSaif opened this issue May 23, 2021 · 2 comments

Comments

@FaidiSaif
Copy link

FaidiSaif commented May 23, 2021

Hello Gents,

I'm trying to use freeopcua c++ GetChild method to get standard dynamic variable node from the root node of freeopcua-modeler using the following code :

      std::vector<std::string> varpath{ "Objects", "Server", "ServerStatus", "CurrentTime" };
      myvar = root.GetChild(varpath); // problem here.

but the i got the _requested operation has no match to return. (0x806f0000) _ error

image

have you any idea how to fix this ?

below the opcua-modeler server interface :

image

Note: using the freeopcua server_example.cpp as OPC UA server works fine with my client ! but it does not work with this python opcua-modeler interface !

this is my complete freeopcua client code (based on freeopcua example_client.cpp):
`
#include <opc/ua/client/client.h>
#include <opc/ua/node.h>
#include <opc/ua/subscription.h>

#include <opc/common/logger.h>

#include
#include
#include

using namespace OpcUa;

class SubClient : public SubscriptionHandler
{
void DataChange(uint32_t handle, const Node & node, const Variant & val, AttributeId attr) override
{
std::cout << "Received DataChange event, value of Node " << node << " is now: " << val.ToString() << std::endl;
}
};

int main(int argc, char ** argv)
{
auto logger = spdlog::stderr_color_mt("client");
try
{
//std::string endpoint = "opc.tcp://127.0.0.1:4840/freeopcua/server/";
std::string endpoint = "opc.tcp://127.0.0.1:48400/freeopcua/uamodeler/";

  logger->info("Connecting to: {}", endpoint);

  OpcUa::UaClient client(logger);
  client.Connect(endpoint);

  //get Root node on server
  OpcUa::Node root = client.GetRootNode();
  logger->info("Root node is: {}", root);

  //get and browse Objects node
  logger->info("Child of objects node are:");
  Node objects = client.GetObjectsNode();

  for (OpcUa::Node node : objects.GetChildren())
    { logger->info("    {}", node); }

  //get a node from standard namespace using objectId
  logger->info("NamespaceArray is:");
  OpcUa::Node nsnode = client.GetNode(ObjectId::Server_NamespaceArray);
  OpcUa::Variant ns = nsnode.GetValue();

  for (std::string d : ns.As<std::vector<std::string>>())
    { logger->info(" namespace =    {}", d); }

  OpcUa::Node myvar;

  //uint32_t idx = client.GetNamespaceIndex("http://opcfoundation.org/UA/");

  std::vector<std::string> varpath{ "Objects", "Server", "ServerStatus", "CurrentTime" };

  myvar = root.GetChild(varpath);

  logger->info("got node: {}", myvar);

  //Subscription
  SubClient sclt;
  Subscription::SharedPtr sub = client.CreateSubscription(100, sclt);
  uint32_t handle = sub->SubscribeDataChange(myvar);
  logger->info("Got sub handle: {}, sleeping 5 seconds", handle);
  std::this_thread::sleep_for(std::chrono::seconds(5));
  logger->info("Disconnecting");
  client.Disconnect();
  logger->flush();
  return 0;
}

catch (const std::exception & exc)
{
logger->error("Error: {}", exc.what());
}
catch (...)
{
logger->error("Unknown error.");
}
return -1;
}

`

@FaidiSaif FaidiSaif changed the title GetChild freeopcua method requested operation has no match to return. (0x806f0000) GetChild freeopcua method : requested operation has no match to return. (0x806f0000) May 23, 2021
@SangKee
Copy link

SangKee commented May 23, 2024

I'm having the same problem.
Anybody solve this issue?

@guojing555
Copy link

guojing555 commented May 23, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants