Java code adding

When i create a new java service already available java service code is adding to the new java service in webmethods.How can i resolve it.

Hi Naveen,

not quite sure what your exact question is, but I will try to sched some light on this:

A java service is just a method in a java class.
The service is stored in a node.ndf (the signature) and a java.frag (the implementation) file.
The class also contains informations from the node.idf of the folder, where the services are located.
In this file is the shared code stored as well as the import-statements for the class.

When opening a Java Service in Designer it will show the complete resulting java source file, which contains the shared part as well as all java services in this folder, but only the shared part and the selected java service will be editable.

See Service Development Help for further informations.

If you have more qeustions regarding this provide a more detailed description of the issues you are encountering.


Thanks Holger.

But my question is when i tried to create a new java service in webmethods ,some methods and code already available in other java classes is adding to this new class.Is there any option for avoiding this.

The java services within the folder will share "<<IS-START/END-IMPORTS>>" and <<IS-START/END-SHARED>>

For your resolution, create your java service in a specific folder. Let us know if you have further questions.

Hi Mahesh,

Thanks, Now i am able to create new java service into a specific folder.Is there any other solution to avoid old code.


I think it’s by design. Let see what other experts have a say on this.

HI Naveen,

as I tried to explain before, a Java Service in designer is not really a class by itself, but it is a method in a class which is represented by the folder in which the services are placed.

Therefore all Java Services in one folder will share the imports and common methods marked by the tags Mahesh has mentioned.

Can you describe what is your concern why you want to avoid this sort of code sharing?

When there seems to be old or outdated code amongst the shared methods make sure that this is not used by other java services in this folder and you can remove it then.