Urgent advice

Hi,

I am trying to write a java service (JAVA2), which will import a JAR file and takes inputs from another java program (JAVA1) and gives output to this java program (JAVA1). JAVA1 will make calls to the class files in the JAR. This JAR file internally connects to a DB2 database. I want to expose this JAVA2 as a webservice. Can any one please give their ideas on how to deal with this problem and is it possible? One question is JAR file makes calls to a DB, do I need to create connection pools etc in webMethods. I am assuming all the connection pools are already exists in the class files.

Thanks
Kevin

Hi,

Any thoughts…

Thanks
Prasad

Please advice me…its urgent

Hello,
Well you have to look at it like this, if you have a java service, it is expected to be short lived in the sense of there just being a call and response. So if there was a db pool made inside, it would be worthless as it would be closed at the end of the call.

Since it seems that you have control over the implementation of the JAVA2 portion, I would suggest making JAVA3 as the webservice and gateway between JAVA2 and JAVA1. This would allow JAVA2 to exist long lived as a server to the DB and JAVA3 can manage the transformation of calls into and out of your system.

So for this type of setup, you would have to copies of the jar available, one where the JAVA2 is running as a mini server, and two in a IS jars path so you can access the other classes with the JAVA3 gateway.

Now if you are using a DB that you have open access the a JDBC 4 style driver, you would be best set to use WM IS as a central role piece in managing your pools for you and forgetting about the jar files from this perspective. Good day.

Yemi Bedu

My task is to create a java service (java 2) (finally i will create a webservice out of that)

  1. This java service(JAVA 2) will take input and give output to a java program (JAVA 1)
  2. java service (JAVA 2) will import .jar files (required to process and gives output)

Question

  1. This .jar file will internally connects to a DB2 DB (Connection pools are in WebLogic). Is it possible to do this??

Existing arch

JSP –> Java program (JAVA 1) –> .jar (This .jar internally access DB2 and do some other stuff…which is black box to me

Required arch

JSP –> Java program (JAVA 1) –> WebService (in webMethods) –> .jar (This .jar internally access DB2 and do some other stuff…which is black box to me

My task

Crate WebService

Need some ideas on this…

Thanks for all the help

Kevin

No takers…

Well, what’s inside the black box is actually important. Depending on how the classes in the jar do things like setting up connection pools or maintaining state, it may or may not be a good candidate to run as a java service in IS.

You can use a package’s startup service to call any initialization methods in the class to prepare it to be used by later invocations, but how it was developed has a direct bearing on whether this is feasible.

Assuming for the sake of argument, that it is feasible to do so, you would then create a second java service that invokes the methods in one or more classes included in your jar to do the work. That service would be the one exposed as a web service to be consumed by your JSP.

HTH,

Mark

Mark,

Thanks much…Here I don’t want to change the existing arch. We are just trying to include a webservice written in webMethods (betwen a java and .jar file). So my webservice shouldn’t talk to JSP directly. Do you have any other thoughts. Can you tell what are the advantages of creating webservices using webMehtods…

Thanks alot
Kevin

Kevin,

The deciding factor will be the design of the classes in the jar that accesses DB2. If it is a good fit for a running as an IS java service, then exposing it as a web service to be consumed by some client (java 1 in your case) is fairly straightforward.

What is behind the desire to change architectures? Is some pointy-headed boss (PHB) just looking for a way to use webMethods on your project or are there some reasons (performance, stability, reusability) for the architecture change?

Mark

Mark,

Thanks again for your reply. Client is not sure what they wants. If the code is in simple Java, we can use Apache Axix (JAVA2WSDL) to generate the WSDL file and then create SOAP client out of that WSDL (WSDL2JAVA) and host this WSDL in weblogic server (where all connection pools are there). Using webMethods just to create WSDL out of existing Java is a kind of new to me, if the generated code is in FLOW that makes sense.

Thanks
Kevin

Sounds like a hammer-looking-for-a-nail-project to me.

Mark

If I understand the scenario correctly, and it’s entirely possible that I don’t, you want to know if it’s easier to expose some classes in a .jar file as web services using Integration Server or WebLogic. The classes in the .jar file access a DB2 database, which would benefit from WebLogic connection pooling. Does that sound right?

If so, and given the information presented here, I’d recommend hosting the .jar and the associated web service in WebLogic. Integration Server provides DB connection pooling in a different way than WLS. You can host the .jsp wherever makes the most sense (in WebLogic or Integration Server). You can create a web service connector in Integration Server that can be used by other services to communicate with the WLS-hosted web service.

Hope this provides a little bit of help.

Rob,

Thanks for your input. Client clearly wants to create WSDL (in doc/literal) using webMethods (at this point I am not sure why?) he also wants to host it in webMethods IS (as per Mark in another thread, we can host WSDL in <mypackage>/pub folder). SOAP Client stubs to this WSDL file will be generated using Apache Axis.

Here we are not trying to change the JSP’s/JAVA 1 or JAR files. I want to create a JAVA service (JAVA 2) in webMethods and expose that service as web service (I don’t know any other way to create a web service using webMethods).

  1. This java service(JAVA 2) will take input and give output to a java program (JAVA 1)
  2. java service (JAVA 2) will import .jar files (required to process and gives output to JAVA 1)

I am in a confused state how .jar file (placed in webMethods Package) will get connections from WebLogic (Where connection pools are defined)…I asked my webMethods admin…he is also not clear about it…any thoughts will be greatly appreciated.

Thanks
Kevin

adding to the above…

The purpose of IS is just to create WSDL file and host it. No business logic is implemented…I don’t think we need web service connector

Thanks
Kevin

Kevin,
I believe your client has you going down the wrong path. Creating a doc/literal wsdl in webMethods first with no existing service or documents won’t work. The wsdl generation tool requires those as input. You can put the document input and output for the wsdl together(will have to actually define these in webMethods) and a blank service but I don’t see that serving any purpose. And it would be far easier to do that in some other tool. What’s the point of hosting WSDL(only really needed at the enterprise level where you may have multiple clients needing to look it up) anywhere? If you generate your “stub clients” using axis, you won’t have anything to invoke because the service doesn’t exist.

Your client does know that a wsdl file is nothing more than a text file that defines the contract of a web service right? They know its not an invocable object.

You can certainly do contract first based web services, in other words define the contract first then make the web service conform to the contract. But you don’t need to write java to do this in webMethods. Is there something you can’t do in webMethods that makes you want to use Java? If so I would say stick with Web Logic since your connections and client seem to be already there.

You could also create a webMethods flow service and have it invoke your jar via a webMethods java service that imports the jar. The flow service would be your web service and not the java stuff. This sounds like what your client is probably looking for but may not be articulating correctly. And if it is architected correctly the client should not really care what they are invoking or where it is, which is kind of the point of web services.

And a last final thought, the benefits of connection pooling database connections will be lost completely if you try and implement what you are suggesting.

just my two cents.

markg
http://darth.homelinux.net

Kevin,
One way is to create your WSDL using Java2WSDL and then host it in UDDI using UDDI4J. Both API’s can be called from a Java service within wM 6.1 with the appropriate API jar files in place on wM server in lib/jars.

Mark and Eric

Thanks for your thoughts. They are very useful.

Mark

“You could also create a webMethods flow service and have it invoke your jar via a webMethods java service that imports the jar. The flow service would be your web service and not the java stuff. This sounds like what your client is probably looking for but may not be articulating correctly.”

I was planning to create a wrapper service (flow) with all inputs and outputs required for doc/literal (I am not sure will that be successful or not). This wrapper service will wrap wM Java service (JAVA 2). This wrapper service will be used to generate WSDL. This JAVA 2 will import jar file (which internally talk to DB).

“Is there something you can’t do in webMethods that makes you want to use Java?”

Yes, Client got this jar file working and already in production. Now he wants to introduce a webservice (with out changing anything to DB connections/jar file/JAVA 1) in between JAVA1 and jar file. This web service should be created using webMethods and hosted in webMethods.

I want to introduce a JAVA 2, which decouples JAVA1 and jar file, so that I can wrap it in a wrapper and create a WSDL out of it.

BIG BIG BIG Question is


How the IBM jar hosted in <mypackage>/classes/jars will get connection information from WebLogic???

Is there a way to link webMethods and WebLogic?? (only link I know is to use BrokerJMS acting as message server configured on WebLogic, correct me if I am wrong). In this case it’s not appropriate to use BrokerJMS (I guess)


Eric,

At this point I am not sure about UDDI…I need to do some basic research on this and get back to you…

Thanks all for your input…

Thanks
Kevin

Okay I get now. I think you are on the right track with creating the flow service that will become your web service. The big question is how to make all of these java programs talk and where should they reside.

We have done something not to unlike this. Can you leave the jar files in weblogic? Have weblogic listen to the webMethods broker as a jms client (you can do this via a MDB in weblogic). Onmessage method in the MDB can invoke the necessary jar files, etc.

So from a program execution flow, you would invoke the webMethods web service, that service would place a message on the queue, the MDB in WebLogic would pick it up and process. If you need a reply back then use request/reply.

My two cents however is that you can do all of this in WebLogic. So you are adding a little overhead with putting webMethods into the mix. But it should work okay. Configuration might be a little challenging.

markg
http://darth.homelinux.net

Mark,

Thanks for the quick reply. Client don’t have lic. to wMBrokerJMS. Thats out of my range…

Thanks
Kevin

So I take it, they didn’t license the broker 'cause the JMS piece is not an additional cost. But not to worry, you can do the same thing with the WebLogic JMS provider. webMethods can place the message there. Download the webMethods JMS adapter, not an additional cost. It should do the trick, if you want to go the JMS route.

markg
http://darth.homelinux.net