Error - Java service while passing Node


In my below code, i have input - object Node… ( which was converted from string to Node using the service XMLStringToNode service).

Inthe java service, we are invoking the service nodeToDocument, where the input was the above Node.

IDataCursor pipelineCursor = pipeline.getCursor();

Object node = IDataUtil.get( pipelineCursor, “node” );

IData output = IDataFactory.create();
IDataCursor outputCursor = output.getCursor();
IDataUtil.put( outputCursor, “node”, node );

IData output1 = IDataFactory.create();
IDataCursor outputCursor1 = output1.getCursor();

output1 = Service.doInvoke( “pub.xml”, “xmlNodeToDocument”, output );
catch( Exception e)
IDataUtil.put( pipelineCursor, “Exception”, e.getMessage() );

IData document = IDataUtil.getIData( outputCursor1, “document” );

IDataUtil.put( pipelineCursor, “document”, document );

The problem is that, i get the null document as output.

Please let me know wehre am i wrong

A couple of thoughts:

  • You’re creating a clone of the input var named “pipeline” into a var named “output.” What is the reasoning for doing this? Why not just pass “pipeline” to doInvoke?

  • You don’t need to create output1 yourself. The cursor you create on output1 is basically out of date since the assignment from the doInvoke call replaces output1. Get the cursor after the doInvoke call.

  • Why, oh, why are you doing this in Java?