Forum Discussion

FICO's avatar
FICO
Community Manager
9 years ago

Can't call into the NdStatelessServer with XML input

Hi.

Attempting to upgrade from 6.10 to 7.3

We call into Blaze using the NdStatelessServer:

ruleServer.invokeService("ruleProject", "invocationPoint", null, args);

The operative thing here is 'args'.

args is an Object array (Object[])

In that array, we pass in only a single element:

                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

                    DocumentBuilder dbl = dbf.newDocumentBuilder();

                    Document doc = dbl.parse(new InputSource(new StringReader(myXMLInput)));

                    args[0] = doc;

...where myXMLInput is a JAXB-marshalled XML String (I would have created my true input object, and then marshalled it to XML).

Let's say it looks like this:

<xyz>

   <a>1</a>

</xyz>

The invocation point calls into a Blaze function, and that function takes exactly one parameter -- that is, the Object type my XML String would become if I unmarshalled it.  Let's call this parameter 'xyz'

Now, this all worked just fine in Blaze 6.10.  In 7.3, it appears that I can call into the invocationPoint, but the problem is the parameter passed into the function doesn't seem to have any data in it.

For instance, if I call this from inside my Blaze function:

print("my value is:" xyz.a);

...it would print:

"my value is: unknown"

...which tells me the contents of the XML I am sending in are not unmarshalled correctly by the engine.

However, if I run a brUnit test from inside the Blaze 7.3 IDE (eclipse):

ruleInput is a string initially "<xyz><a>1</a></xyz>";

execute MyInvocationPoint(ruleInput as a XYZ);

...this works

I suspect I am not sending the XML into the engine correctly.  However, I am doing exactly what I did in blaze 6.10

Thanks for any help

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    One thing I have found out...

    I can cast the input object to a string, then cast the string to the object type I need:

    theInput is a string initially xyz as a string;

    gblMyInput = theInput as a XYZ;

    That seems to be a workaround