Importing and referencing an external java class in wM java service

HI,

I have created a java class whose methods I need to access via wM java service.

My java class name is “TestABC.class” which does not have any qualified package name.
I created a jar file for this class and placed it under IntegrationServer/lib/jars folder and also under my custom webMethods package (MyPackage/code/jars). I restarted Integration Server after this and reloaded “MyPackage”.

Now I need to access a method of this external class (TestABC.myMethods()) in a wM java service(testJavaService) that I’m going to create under my custom wM package (i.e. MyPackage.utils:testJavaService). I tried specifying the class name (i.e. TestABC.*) in the import section of the shared tab of the java service. But with this, the java service would not compile. The java service compilation process is not able to recongnize this external class.

Can you please let me know how can I import this external class into my java service?
A code snippet showing how to access TestABC.myMethods(); in the java service that I’m going to build would really help a lot.

Please help me out with your expert answers.

Thanking you in advance.

Actually, I think you have to create a package or the IS doesn’t pick it up…

So place your class file in a folder eg “/myJar/TestABC.class”, make a jar file of the folder myJar and import myJar.*

I think that should do the trick

hth

Hey thr,

just put your external jar file in your appropriate custom package/code/jars and then import your package with class name in shared tab.

For example testPackage.TestClass

Now you can use any method related to class you are importing in java service.

It is working for me and hope it will work for u.

All the Best,
Istiyak Vasiwala

It seems you are not using package structure for your class. It would be good if you define your class in a package structure and then create Jar for complete structure.You can either keep it in IS/lib/jars or packages//code/jars folder and after a restart, you should be able to import into the java service.