WebMethods - Connect to WebMethods Broker Server in Java
by
Jeremy Canfield |
Updated: February 09 2023
| WebMethods articles
Add the following JAR files to your Java Build Path. These JAR files should be located at /opt/webmethods/Broker/common/lib directory on a Linux system.
- wm-brokerclient.jar
- wm-g11nutils.jar
Here is an example class that can be used to connect to the Broker server running on server1.example.com.
import COM.activesw.api.client.*;
public class Main {
public static void main(String[] args) {
try {
BrokerServerClient server_client = new BrokerServerClient("server1.example.com", null);
System.out.println("server_client = " + server_client);
BrokerAdminClient admin_client = new BrokerAdminClient("server1.example.com", null, null, "admin", "WebMethods Admin Client", null);
System.out.println(admin_client);
} catch (BrokerException ex) {
System.out.println("Caught the following exception: " + ex);
}
}
}
If the connection is successful, something like this should be returned.
BrokerServerClient:
broker_host=server1.example.com
broker_port=6849
BrokerClient:
broker_host=server1.example.com
broker_port=6849
broker_name=null
client_group=admin
client_id=/development Broker Territory/Broker #1/#vclient329-749
app_name=WebMethods Admin Client
is_connected=true
Did you find this article helpful?
If so, consider buying me a coffee over at