Reputation: 31
What is the right way to call an opcua method with camel milo?
I keep doing tests but I always get the inputArguments and not the outputArguments even if checking the MILO log messages I see that the method is called and returns the correct value.
Apache Camel version 3.11.1
I thank anyone who can give me a suggestion!!
public void test() throws Exception {
System.out.println("START CAMEL-MILO TEST");
SpringCamelContext camelContext = applicationContext.getBean(SpringCamelContext.class);
if( camelContext != null )
{
ProducerTemplate producerTemplate = camelContext.createProducerTemplate();
if( producerTemplate != null )
{
String endpointUri = "milo-client:opc.tcp://milo.digitalpetri.com:62541/milo?node=RAW(ns=2;s=Methods)&method=RAW(ns=2;s=Methods/sqrt(x))&defaultAwaitWrites=true";
Double value = 25.0;
Double outputArguments = producerTemplate.requestBody(endpointUri, new Variant(value), Double.class);
if(outputArguments != null)
System.out.println("RESULT: " + outputArguments );
else
System.out.println("ERROR: outputArguments is null");
}
else
System.out.println("ERROR: ProducerTemplateunavailable");
}
else
System.out.println("ERROR: SpringCamelContext unavailable");
}
Upvotes: 2
Views: 276