Example of Flow and Java Service

Hi,

I’m a learner for webMethods. I am trying to create a sample Flow service and Java service using WMDeveloper.

Can someone provide me with simple example so that I can proceed further?

Thanks,
Asawari

Hi Asawari,

Let us say that you want to concatenate two strings. You can write a java service as :

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String str1 = IDataUtil.getString( pipelineCursor, “str1” );
String str2 = IDataUtil.getString( pipelineCursor, “str2” );
pipelineCursor.destroy();
String strFinal = str1 + str2 ;
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “strFinal”, strFinal );
pipelineCursor_1.destroy();

or you can write a flow service as :
Using try catch block —

SEQUENCE (exit on Success) MAIN
----SEQUENCE (exit on failure) TRY
--------pub.string:concat
----SEQUENCE (exit on done) CATCH
--------getLastError

Please go through the documentation to know more about the services available.

Regards,
Sandesh

Thanks for your help.

Is there any user manual / tutorial from where I can get the help when needed?

You can download webMethods_Documentation_Library_6.1.zip from advantage.webmethods.com . This should suffice.

Regards,
Sandesh Tak

I’d also recommend downloading the Developer 4.6 Tutorial from Advantage. There are a few differences in the Developer user interface and some services have been renamed, but the core Flow language is still the same.

Mark

Hi
In string concatenation example in Flow service, it is giving “null” as concatenated value. Where I am going wrong?

  • I created one document type which contains 2 string inputs. Set its Publishable property as TRUE.
  • Created new flow service. Added that document type as Input for flow service. For output, created one string variable.

[SIZE=2]Use try catch block —
–SEQUENCE (exit on failure)
–pub.string:concat
–SEQUENCE (exit on done)
–getLastError

[/size]- Clicked on Run. It asked me for input ie. 2 strings to concat.

  • I entered 2 strings and clicked on OK.
  • It showes me str1 as “asa”, str2 as “wari” and value (ie. output) as “null”.

What can I do? Or let me know the fresh procedure to do the same.
How to specify Try-catch block in Flow service code?

Thanks
Asawari

Hi Asawari,

Since your pipeline variable names (str1 & str2) are different from Service In variable names (instring1 & instring2) you need to link those explicitly in the pipeline.

With same variable names there is no need to link explicitly in the pipeline.

Bharat Varma

thanks. It worked.

Hi Mark ,
What is Advantage.Is it some portal that is retired ?Or is it called Empower now?

Hi Ankit,

yes, Advantage has been retired after Software AG acquired webMethods.

Documentations is now available in Empower or in the TechCommunity.

Developer ist now called Service Development and is one part of Designer.

Regards,
Holger

1 Like