How I could pass java objects from 1 java service to another in Flow service

Hi All

I have scenario like my 1st Java service returns java objects and the same needs to be used in the 2nd Java service.
Both the services are in order inside the Flow service .

Please suggest how to handle this

Regards
Sankalp

I believe its a normal case, where the first service output can be passed on to the second service. Can you please post the issue you are facing?

/Naidu

The scenario is like that

from 1st Java WS I have been getting an Map object and now I am putting this Map as :

IDataUtil.put( pipelineCursor_1, “map”, map);

and now in second Java WS I am fetching this map as :

Object map = IDataUtil.getString( pipelineCursor, "map " );

here the issue is the original Map is lost

Please suggest

Regards,
Sankalp

Dont use getString, because that will cast to… String
And you have an extra space “map” <> "map "

Just a thought, why cant you have all the implementation/logic implemented in one java service. Or create two java services and in a flow service invoke the two and map it accordingly.

Yes, Niek is correct in his observation.

Try to use - get(IDataCursor cursor, java.lang.String key) instead of getString.

/Naidu

No it is still not working

In the second service, you have to use IDataUtil.get(…) (like proposed above). Then you have to downcas the returned object to the desired type (or, better said, to the type you know the object is of – a Map in your case).

In your 1ts service what is the output type of the map variable? It can either be Object or Map.
Same applies to the second service input.

Will also suggest to debug the service, or at least make sure the output of the first service is not null.

If you want to see how to log debug info manually for java services have a look here:

Are you trying to call one java service from the other or are you calling the java services individually from the flow service?

If you are calling from the flow service, you may return the object from java as output and pass the same as input to the second java service… ?