webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Importing and referencing an external java class in wM java service

  • 1.  Importing and referencing an external java class in wM java service

    Posted Tue July 01, 2008 02:09 PM

    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.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Importing and referencing an external java class in wM java service

    Posted Tue July 01, 2008 04:21 PM

    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


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: Importing and referencing an external java class in wM java service

    Posted Tue October 07, 2008 12:15 PM

    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


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Importing and referencing an external java class in wM java service

    Posted Wed October 08, 2008 09:02 AM

    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.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services