Author Topic: ODWEK Middleware with Spring Boot  (Read 2459 times)

michaelwda

  • Guest
ODWEK Middleware with Spring Boot
« on: June 09, 2018, 08:40:33 AM »
Hi all,

I saw a few posts here and there about writing ODWEK Java servlet middleware. I have actually recently done this for a customer and decided to share the process of getting my environment set up and coding a Spring Boot API to run under Tomcat. I wrote up a quick tutorial complete with a public github repository and want to share it. Our need for this arose because we were previously scraping the CGI from C#. I'm not an on-demand guru, just a developer trying to share some knowledge :)

Main things I ran into were

  • Getting my paths set correctly. You have to set several to get everything running correctly under windows. The easiest way to get started and make sure everything is working correctly is to code a plain old java application before jumping into Spring.

  • Under Spring you'll need to register your ODAPI.jar with Maven so you can include it in your project / classpath and also have it packaged into your distributable war/jar.

  • If you're reading application/line off of the iSeries, it will be in EBCDIC! I don't really dig deep into this because I'm handling it in C# code that is consuming my Java API middle-tier.

  • Opening the connection is expensive. I just cached my opened connection in a static within my utility class. If this is going to be handling a significant amount of throughput, it may make sense to implement some kind of a connection pool. I don't dive into this, but seems like a fun project. Would be interesting to explore thread-safety and how the document retrieval callback methods work.

I don't go too deep into how to set up Spring Tool Suite, deploy to a Tomcat Application Server, or call the API from a client. I can certainly expand on my post if there's a need.

Guide: https://www.michaelwda.com/post/odwek_middleware_springboot
Github: https://github.com/michaelwda/ODWEKServlet

Github has my plain java code for testing and my full Spring Boot project.

Happy Coding!
« Last Edit: July 08, 2020, 11:28:08 AM by michaelwda »

Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: ODWEK Middleware with Spring Boot
« Reply #1 on: November 22, 2018, 10:16:57 AM »
I've just come across your nice post.

Thank you to share your experience. I wanted to add some things that could be important.

First, if you are doing the caching of connections, be sure to cache the ODServer object, and NOT all the sub classes (like ODFolder, etc...). Because of how ODWEK Java API is created, and its use of JNI (C/C++ native libraries) if you don't do the caching on the ODServer object, you can have lots of problems on complex setup.

Second, from an IBM perspective, the only way ODWEK application is officially supported is to have ODWEK installed on your tomcat server. To package ODApi.jar in your war/ear/... is NOT officially supported, even if you package the native libraries and the codepage files and other stuff...

Cheers
Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML