Get input and output parameter names of a given service

Greetings,

In my scenario, I have to retrieve the input and output parameters of a service. Like the Designer does displaying under the Inputs/Outputs tab. How can I perform such a task?

Regards,
Jozsef

I’m sure there are services in the WMRoot package for this, but you are not allow to use it.
Check with SAG first

Of course I’m allowed to use services from WmRoot. It won’t conflict with the licenses. If you know such a service I’m opened to solutions. I haven’t found any service that would give me such information so far.

If you think you are entitled to use internal services, pls talked to SAG support, they should provide the services for you.

No offense but if you can’t give reliable information why do you even write in the thread? The purpose of this forum is to ask information about WebMethods. If I came here asked a question the last one was to get an answer to go to SAG support and ask them. If you don’t know it’s okay don’t write I won’t get mad. No offense don’t take it too deep but I’m trying to get information not redirections.

my point is that you are not allow to use internal APIs without SAG consent.
And no one should spread internal APIs info without SAG consent either. Good luck with your effort.

You can use the Java code below to get service signature.


IDataCursor pipelineInputCursor = pipeline.getCursor();
String serviceName = IDataUtil.getString(pipelineInputCursor,"serviceName");
pipelineInputCursor.destroy();

NSNode nsNode = Namespace.current().getNode(serviceName);
if (nsNode instanceof NSService){
	   NSService serviceNode = (NSService)nsNode;
	   NSSignature serviceSignature = serviceNode.getSignature();
	   if (serviceSignature != null){
		   NSRecord serviceInput = serviceSignature.getInput();
		   NSRecord serviceOutput = serviceSignature.getOutput();
		   IDataCursor pipelineOutputCursor = pipeline.getCursor();
		   IDataUtil.put(pipelineOutputCursor, "serviceInput", serviceInput);
		   IDataUtil.put(pipelineOutputCursor, "serviceOutput", serviceOutput);
		   pipelineOutputCursor.destroy();
	   }
}

The result format may not what you expected, but it does include everything you need, I think you are able to parse it, so not show you the detail anymore.

Hi All,

wM 7.1.2

Try this WmRoot/wm.server.services:serviceInfo

It displays all the information. :lol:

Try at your own risk… as this is in WmRoot package. :lol:

@ Xiaowei Wang

I tried compiling your code on wM 7.1.2 and I ended up with the below error:


symbol : method current()
location: class com.wm.lang.ns.Namespace
NSNode nsNode = Namespace.current().getNode(serviceName);
^
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

I cross checked the java API for wM 7.1.2 but I am unable to find the method current() and also made sure that com.wm.lang.ns.* is present in the Imports

Can you let me know what needs to be done to fix this error on wM 7.1.2

wm.server.services:serviceInfo doesn’t include service signature.

The fully qualified name of Namespace is com.wm.app.b2b.server.ns.Namespace, sorry for forget it, and I test the code in version 8.2, not sure for version 7.1.2.

In my java code I also included com.wm.app.b2b.server.* but still it does not work in wM 7.1.2.

Not com.wm.app.b2b.server., it is com.wm.app.b2b.server.ns., and I suggest to use the fully qualified name com.wm.app.b2b.server.ns.Namespace.

Thanks… :lol: It worked…

I misunderstood that wM will understand and import com.wm.app.b2b.server.ns.Namespace by giving this com.wm.app.b2b.server.* because of the .* at the last.

Thanks Xiaowei. Have a great day…

Thanks for both of you. Good to see that there are knowledgable guys around here :). Worked like a charm!

Hi M@he$h,

for me i am getting the below error. placed import “com.wm.app.b2b.server.ns.Namespace”

cannot find symbol
symbol : class NSNode
location: class Architect.Flow
NSNode nsNode = Namespace.current().getNode(serviceName);
^

Try to import com.wm.lang.ns.NSNode.

Hi Akash,

I tired the below on wM 7.1.2

Provide the below two imports:

com.wm.app.b2b.server.ns.Namespace
com.wm.lang.ns.*

Input: serviceName
Ouput: serviceInput, serviceOutput

Copy paste the code as plain text 8)

I should work :smiley:

Any idea why Namespace.current().getNode(NSName.create(“folder.path.to.service:serviceName”)); returns null for me? I’m trying to use this from a stand-alone java application with the following dependency jars:

enttoolkit.jar
mail.jar (SoftwareAG/common/lib/ext)
wm-isclient.jar (SoftwareAG/common/lib)
wm-isserver.jar (SoftwareAG/eclipse/v36/plugins/com.softwareag.is.serverjars_8.2.1.000-0150)

The java program is pretty straightforward:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package wmnodehandler;

import com.wm.app.b2b.client.Context;
import com.wm.app.b2b.client.ServiceException;
import com.wm.app.b2b.server.ns.Namespace;
import com.wm.lang.ns.NSName;
import com.wm.lang.ns.NSNode;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author johorvat
 */
public class WMNodeHandler {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Context connection = new Context();
        try {
            connection.connect("10.125.112.20:10301", "johorvat_adm", "johorvat_adm");
            NSNode node = Namespace.current().getNode(NSName.create("jozsi_test.functional_test:getInputs"));
            if (node == null) {
                System.out.println("Node not found!");
            }
        } catch (ServiceException ex) {
            Logger.getLogger(WMNodeHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

If I run wm.server.ns:getNode from designer with the “jozsi_test.functional_test:getInputs” name-parameter I get the result Node. Any idea?

Hi Jozsef
The sample code must run in IS runtime as a java service, not in a java main.

Ah well that’s not so nice. Any chance to get it working from java app outside of IS? Just like Designer does it.