Question

I am new to WEBMethods. I have been working on a Java service for a project. I really need to be able to write some code in regular Java for some quick testing of reading in a simple text expression with some regular expressions. Nothing at all that fancy with the Java part. But eclipse currently is set up for WEBMethods and I need to be in a regular Java mode for Eclipse (If there is such a thing). At home I have the standard eclipse version and have no trouble writting code. But at work I have WEBMethods installed in the Eclipse (Software AG Designer). I think that if I can write the code in regular Java then I can just copy and paste it into the WEBMethods Java services and set up the INPUT and OUTPUT variables and it should work. But currently I cannot find a way to just write Java code like I do from my home computer.

Question: How can I write just a regular Java program (classes, packages, ...etc...) with a machine with WEBMethods installed? Do I have to install another session of Eclipse on my hard drive? (I tried this a while back and there was an issue with having more than one session of Eclipse on the machine).

Java Web Services Code:

package DssAccessBackup.services.flow;

import com.wm.data.*;
import com.wm.util.Values;
import com.wm.app.b2b.server.Service;
import com.wm.app.b2b.server.ServiceException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public final class new_javaService_SVC

{

    /** 
     * The primary method for the Java service
     *
     * @param pipeline
     *            The IData pipeline
     * @throws ServiceException
     */
    public static final void new_javaService(IData pipeline)
            throws ServiceException {
        // pipeline
        IDataCursor pipelineCursor = pipeline.getCursor();
            String  inputFileName = IDataUtil.getString( pipelineCursor, "inputFileName" );
        pipelineCursor.destroy();

        // pipeline
        IDataCursor pipelineCursor_1 = pipeline.getCursor();
        IDataUtil.put( pipelineCursor_1, "fileName", "fileName" );

        // outDoc
        IData   outDoc = IDataFactory.create();
        IDataUtil.put( pipelineCursor_1, "outDoc", outDoc );
        pipelineCursor_1.destroy();

        String fileName = new String();
        fileName = null;

        try {
            BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\itpr13266\\Desktop\\TestFile.txt"));
            String line = null;
            //Will read through the file until EOF
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            System.out.println("Try-Catch Message - " + e.getMessage());
            e.printStackTrace();
        }

    }

    // --- <<IS-BEGIN-SHARED-SOURCE-AREA>> ---



    // --- <<IS-END-SHARED-SOURCE-AREA>> ---
}
Was it helpful?

Solution

You don't need to install another Eclipse for Java development. WebMethods Designer (v9) comes with Java tooling. Just open the Java perspective and use it.

Adding Java perspective

Besides that you should use the Service Development perspective, when developing WebMethods Java Services, because WM Designer handles Java services in a special way, which could make importing standard Java files difficult.

OTHER TIPS

There is no problem running multiple instances of Eclipse at the same time as long as they point to different workspaces.

Normally you get a dialog to choose the workspace when Eclipse starts up. If not, check this answer on how to enable that dialog: https://stackoverflow.com/a/8616216/1599890

So if you download, unzip and set up Eclipse for Java development and point it to another workspace than Software AG Designer uses you should be good to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top