Hi all,
I read on jdbc adapters documentation that the only way to invoke a java service that needs access to a connection is using ExecuteService.
Now, I’d like to know if I can change dinamically the service invoked (as written in the “Service to Invoke” tab) and how to read “targetServiceInput” object passed as parameter. I didn’t find any clue here or on advantage.
The first thing I would review is whether or not you really need a Java service. Chances are, you do not. Thus, you likely can have a FLOW service that does the work it needs, which then invokes a JDBC adapter service. This would be the preferred approach, unless you absolutely must use Java to do what is needed (highly unlikely–at a minimum the part that needs to be Java can probably be reduced greatly in scope).
Another approach is to use the Service.doInvoke method within your Java service to call a JDBC adapter service. You can review the Java API docs from Developer under Help | Java API Reference.
Your Java service can accept the name of the adapter service to invoke, and if you pass through the pipeline, then you won’t need to explicitly read the inputs or write the outputs–but the service that calls your Java service will need to put the right vars in the pipeline, call your service, then assume which output vars are present (based on the JDBC service signature).
Can you elaborate on what your service needs to do? Perhaps you’re pursuing a solution path that is more difficult than it needs to be.
Hello Rob,
thanks for the reply. We are migrating an old WmDB stack to JDBC Adapter, and at the moment the plan is to keep the things like they are now, then change them in the future (business time constraints).
The specific services I’m investigating now performs an insert on a table, but that table has a LONG field; we tried to develop an InsertAdapter to insert on that table, but we were not able to do it successfully.
Anyway, we need to migrate other services (<10, we are using them as few as possible, ad we will rewrite “simplest” one, but will not able to rewrite all of them), so we would like to know how if I can change dynamically the service invoked (as written in the “Service to Invoke” tab) and how to read “targetServiceInput” object passed as parameter.
WTH! “targetServiceInput” is a document and not an object!! We discovered that inspecting the ExecuteService source code, where it maps “targetServiceInput” to an IData.
Thus, if you need to pass some parameters to a java service using ExecuteSevice, just define a document, place at its first level all the variabile name/values the java service has as input, then map the document to the “targetServiceInput” object of ExecuteService and you’ve done.
Hope this will help someone else in need of the same solution.
““targetServiceInput” is a document and not an object!!”
True. All inputs and outputs to adapter services are documents (IData objects)–wierd that that wasn’t obvious from looking at the services with Developer. They are marked as documents.
“We discovered that inspecting the ExecuteService source code, where it maps “targetServiceInput” to an IData.”
Strictly speaking, it isn’t “mapping” that to an IData. That var is an IData object.
“we tried to develop an InsertAdapter to insert on that table, but we were not able to do it successfully.”
Can you post what you’ve tried? Perhaps we can solve that issue. The first thought that comes to mind is modifying the type of the input var that will be placed in the long column. Did you try passing in a string? How about a Long object?