Tuesday, December 12, 2023

How to debug a Java Service.?

Please read my previous blog on Java Service Implementation to understand basics.

After you have implemented Java Service successfully and execute it. It's a full service execution. 

We can't debug it like flow service.

Don't worry, there is a way to debug custom Java Service.

  • Right click on the “addTwoString” java service and click on the generated code option.
  • After clicking the “Generate Code” option, a window will appear, prompting you to select the option for generating the code. 



  • After clicking the “Finish” button, a .java file will be generated with the name of your service. This file will be used for debugging purposes..
        Note: Specify server, username, password based on your environment.


Finally, put a break point in "addTwoString".

That's it.

Now, debug the auto generated code. Right click> Debug as > Java Application



It will prompt you to enter UserName, Password. Once you have entered those values. This will initiate debugging ..

Enter StrA, StrB values..as per your logic


It will open in Debug perspective, check run-time pipeline values. 



Use traverse button - Step into, Step over, Terminate, Resume and check the flow, run-time values on right side.



Auto-generated service is located in WorkSpace>package>src, check below screenshot.

Note: This code is not required for PROD move.

Thanks for reading :-)

Saturday, September 30, 2023

SFTP Connection creation in IS Admin Page

FTP (File Transfer Protocol)

It is a protocol that is used to transfer or copy the file from one machine to another. And in FTP, a secure channel is not provided to transfer the files between the hosts or systems. 

Default port -21. 

FTP is used for transferring of web pages and used for downloading the files from other different servers. Basically, it is used for transferring the files from one system to another system more reliably and efficiently.

SFTP(Secure File Transfer Protocol)

It is a protocol that provides a secure channel, to transfer or copy the file from one machine to another. SFTP establishes the control connection under SSH protocol. SFTP encrypts the data before sending.

Default port -22. 

In this blog, we will use some free SFTP server for PoC purpose. But in real-time, you will receive these details from your Infra team.

test.rebex.net:22
User Name: demo
Password: password




Now, use some SFTP client like FileZilla or WinSCP to test the connection.

I am using FileZilla to test the connection.

Once you have logged in successfully, you can see the remote files / directories



Now, we will see how to create SFTP connect in IS admin page.

Login into IS Admin page:
Note: At the time of writing this blog, I am using wM latest version is 10.15

External Servers>SFTP


Click on Create Server Alias:

Specify Alias, Remote Host, Port details and click on Get Host Key


Now, create User Alias Settings


Specify Alias, Username, password and SFTP Server Alias (from drop down - just created in above step)


Save the connection and test it.

Now, create a simple flow in Designer



WmPublic package contains all the built-in services to do SFTP operations like list, get, put etc.


Once you have received the files and content, you can validate it and send it to DB, Salesforce based on your business requirement.


Thanks for reading :-)

Broker Messaging (Legacy) - Native

 What is webMethods Broker.?

In the webMethods system, Integration Servers exchange documents via publication and subscription. One Integration Server publishes a document and one or more Integration Servers subscribe to and process that document.

The Broker forms the globally scalable messaging backbone of webMethods  components. 

It provides the infrastructure for implementing asynchronous, message-based solutions that are built on the publish-and-subscribe model or one of its variants, request/reply or publish-and-wait. webMethods Broker serves as an intermediary that routes data from publishers to subscribers. 

Information producers publish data to webMethods Broker and then move on to other activities, while information consumers subscribe to and retrieve the data when convenient. 


Broker Architecture:

A webMethods Broker environment consists of two main components: 
  • Broker Server, the run-time component with which publishers and subscribers interact. 
  • Broker user interface, the administrative component that runs on My webMethods Server 
The Broker Monitor is automatically installed when you install Broker Server, it monitors all of the Broker Servers running in the webMethods Broker environment. It will automatically attempt to restart any Broker Server that stops running in its environment.

Broker Server & Broker
Broker Server is the container within which one or more Brokers reside. A Broker Server performs the communication-related work of receiving client requests, dispatching requests to the requested resource (which in this case, is a Broker), and returning responses to clients. It also manages memory and disk resources for all the Brokers that reside on it.

Broker is an entity that resides on a Broker Server. When a client connects to Broker Server, the client specifies the Broker with which it wants to interact. 
A Broker encompasses the following types of objects:
  1. Document types
  2. Client Groups
  3. Client State Objects

What is Document Type?
Document Type name consists of two components: a folder path and a base document type name. folderName::subFolderName::documentTypeName
If the document type is created through Designer, the Broker document type name includes the preface "wm::is::" before the folderName::documentTypeName convention
Example:  wm::is::Training::docs::testBrokerDoc

Document Type Properties - Each document type has properties associated with it that determine how the Broker handles instances of that document type at run time.

Time to live(TTL) specifies how long Broker maintains instances of this document type once they are published.
Validation indicates whether Broker validates instances of this document type and if so, if the document can contain fields that are not defined in the document type.
  • Full. The document can contain fields declared in the document type only.
  • Open. The document can contain fields that are not declared in the document type.
  • None. Broker does not validate instances of this document type.
Storage type determines whether instances of this document type are stored in memory or on disk.
  • Volatile documents are stored in local memory only.
  • Guaranteed  documents are persisted to disk so that they can be recovered in the event of a power failure or a server restart.
Client:
A client is an object on the Broker that represents the connection between a client program and the Broker. A client program creates a client to publish or retrieve documents. 

For example, a customer-facing Web application might create a client to publish sales order documents. The back-end accounting system and the order fulfillment systems might create their own clients to subscribe to the sales order documents. Broker routes the documents published by the Web applications client to the clients for the accounting and order fulfillment systems.

What is Publish & Subscribe Model.?
The publish-and-subscribe model is a specific type of message-based solution in which applications exchange messages (called documents in webMethods) through a third entity called Broker.
In solutions based on this model, applications that produce information (publishers) send the information to the Broker entity and applications that require the information (subscribers) connect to the Broker and retrieve the information they need.

Most important services
  • pub.publish:publish
  • pub.publish:deliver
Publishing to Broker


Publishing when the Broker is down or not available


Other useful services, but in real-time usage is very less
  • pub.publish:publishAndWait 
  • pub.publish:deliverAndWait
  • pub.publish:reply 
  • pub.publish:waitForReply



Subscription Path


How to connect Integration Server (IS) to Broker

Broker Monitor (Mon) should be up and running, then connect IS with Broker.

  • Open the Integration Server Administrator.
  • In the Settings menu of the Navigation panel, click Messaging.
  • Under Broker Configuration, click Broker Settings.
  • Click Edit Broker Settings.
If Broker is installed on Win, then start Broker Monitor from Windows> services


Note: You can configure IS with only one Broker, but one Broker can be connected with multiple IS.
Once you have updated the Broker details, then restart the IS.

Note: At the time of writing this blog, I am using wM IS 10.15 and Broker version 7.x (But it's deprecated). So IS UI may be different in lower or higher version.

Now, create a simple flow in designer to publish a document to Broker

Create a small document and change Publishable type as True and select provider alias as Broker_Local (which I have created in IS admin page)
Create a flow service and drag a publish build in service to publish a document to Broker.


Subscription Flow
Create a Native trigger to subscribe the document and invoke flow service for processing it.
Simple flow for processing the subscribed doc


Execute the publish flow service and see the result.



Source: https://documentation.softwareag.com

Thanks for reading :-)

Administration Support - Activities

If you are the webMethods Integration Server Administrator, you might be involved in some or all of the following activities.


  • Installing and upgrading the server : which includes tasks such as equipping the server computer with appropriate hardware and software, downloading and installing the server program, and implementing upgrades as needed.
  • Starting and stopping the server : which includes shutting down the server when necessary (e.g., for routine maintenance or reconfiguration) and restarting it afterwards. It also includes performing your site's standard recovery procedures following a hardware or software failure of the server computer. For information about these activities, see Starting and Stopping the Server.
  • Configuring server settings : which includes setting basic operating parameters such as the maximum session limits, log file options, and port assignments. For information about these activities, see Configuring the Server.
  • Administering users and groups : which includes defining user names and passwords for authorized users and assigning them to groups. For information about this task, see Managing Users and Groups. Alternatively, you can configure the server to acquire user and group information from an external system (e.g., LDAP). For more information, see Configuring a Central User Directory or LDAP.
  • Administering server security : which includes identifying other administrators, assigning access controls to individual services, and configuring the server's use of digital certificates. For more information about this task, see Customizing Authentication Using JAAS, Configuring Integration Server for Secure Communication, Customizing Authentication Using JAAS, and Configuring Integration Server for Secure Communication.
  • Managing packages and services : which includes tasks such as activating/deactivating/copying packages and updating services and/or packages as necessary. For more information about this task, see Managing Packages and Managing Services.

  • Administering multiple instances of the server : which includes performing all or some of the activities listed above to manage two or more Integration Servers running on the same machine. For more information about running multiple instances of Integration Server on the same machine, see Running Multiple Integration Server Instances.
  • Deployment : which includes build creation and deployments from Dev to QA, QA to Pre-Prod and to PRD
  • CI/CD: which includes Code Repo installation and setup of (Git, SVN), Jenkins, SAG ABE , Nagios for code repository ..etc.

Source: https://documentation.softwareag.com/

Thanks for reading :-)

Java Service { } Implementation

What is a Java Service?

Java service in webMethods refers to a service implemented using the Java programming language within the webMethods.

Java services allows us to write custom code using Java to extend the functionality of webMethods Integration Server. They provide a way to incorporate complex business logic or perform custom operations that are not easily achievable using the built-in services provided by webMethods.

A Java service is a public static method in a Java class file on webMethods Integration Server.

webMethods Designer provides an Integrated Development Environment (IDE) that you can use to create, compile, and publish Java services.

Java services follow a simple naming scheme:
  • The interface name represents the fully qualified Java class name.
  • The service name represents the Java method name.

All Java services that reside in the same folder are methods of the same class.

When you build a Java service with Designer, it automatically combines your service into the class file associated with the folder in which you created it.

Java is the native language for services Used to implement the complex logic

Basic stages involved in creating a Java service:

  • Specify the inputs and outputs of the service.
  • Create the Java service using Designer.

How to compile a Java Service.?
When you save the source file, the IDE automatically compiles it and registers it on the server.  

Editable Sections of a Java Service 
  • imports : where you can specify the names of additional Java packages whose classes you want to make available to the current class. 
  • extends : where you can specify a super class for the implementation. 
  • implements : where you can specify the Java interfaces that the Java service implements. 
  • source code : where you add the code for the primary Java service method.
  • shared code : where you can specify declarations, methods, etc. that will be shared by all services in the current folder. 

IData 
The IData object is the universal container that services use to receive input from and deliver output to other programs. 
It contains an ordered collection of key/value pairs on which a service operates.

IDataCursor
IDataCursor interface defines the methods you use to access, traverse, and manipulate the contents of an IData object

IDataUtil
The IDataUtil class provides various utility methods for populating, converting, copying, and merging the elements within an IData object.

IDataFactory
This class provides methods for creating an IData object.

Creating IData objects:
IData obj=IDataFactory.create();

Create IDataCursor:
IDataCursor pipelinecursor=pipeline.getCursor();

Read from the pipeline: 
IData docint = IDataUtil.getIData( pipelineCursor, "docint" );
IData[] docint1 = IDataUtil.getIDataArray( pipelineCursor, "docint1" );

Invoke a service:
IData output = Service.doInvoke(<Folder Name>, <Service Name>, <IData input>);

Put IData to pipeline:
IDataUtil.put(pipelineCursor, "outputValue1", sampleOutput);


Let's see how to create a Java service in webMethods.
I am using wM 10.15 at the time of writing this blog. If you're using older or newer versions of wM, the Designer IDE views might be different.

How to create a simple Java Service.?

Create a Java service  from File>Package>Folder> Java Service (as you do for flow services)


Specify inputs / outputs based on your requirement.



Next, go to source tab then right select Generate Code


Then select "For implementing this service" to generate code for this service only.


And save the code, code will be compiled automatically. If there are no errors means you're good to go. Else we need to check and fix the errors.

The Output is :


In next blog, we will see How to debug a Java Service.?

Thanks for reading :-)

Designer IDE - 10.x Tips

In this blog, we will see some useful stuff in Designer apart from flow implementation.

How to connect Integration Server from Designer:
In real-time, we may need to connect multiple Integration Servers based on your environments like Dev IS, QA IS..etc.

Open Designer if not opened already
Go to Window> Preferences > Sofware AG > Integration Servers.
Click on Add and specify Host, Port and User Name and Password and then connect and click on Apply and Close it.


If you're using BPM, then ensure to configure function alias in IS Admin page and then configure Process Audit Database.

Recently Used Services:
You can customize recently used services based on your usage.

webMethods Microservices Runtime


Run/Debug
You can customize Colors based on your choice and comfort.


Web Service Descriptor Editor


webMethods.io Integration


API Gateway and API Portal

Java 
To set build path and you can do lot of things based on your requirement for implementing Java services

Appearance
You can choose Theme and color and Fonts ...

Short-cut Keys
You can customize short-cut keys

To change Perspective
Toggle between perspectives between Service Developments - Debug - Process Development.

                    Ctrl+F8
Its default, you can change it as shown above.

To find services in available packages

                    Ctrl +F

Change Views / Perspectives



Sync Document Types
Due to some reasons, some of the documents are out of sync then you can sync those documents with provider (Broker / UM) as shown below

Switch WorkSpace


If you know any other stuff, please comment here..I will update it.

Thanks for reading :-)

How to debug a Java Service.?

Please read my previous blog on Java Service Implementation to understand basics. After you have implemented Java Service successfully and e...