webMethods API Development Guide
webMethods API Development Guide
15 July 2025
22:24
In the context of APIs, especially REST APIs, different HTTP methods (also called verbs) are used to define
what action the API performs on resources like data, documents, or services.
PATCH Partially update existing data Modify only specific fields ❌ Not always
🔹 1. GET
Purpose: Read data.
Example:
/api/customers/123 → Returns customer with ID 123.
🔹 2. POST
Purpose: Create a new resource.
Example:
POST /api/orders with a JSON body → Creates a new order.
🔹 3. PUT
Purpose: Replace a resource entirely.
Example:
PUT /api/products/567 → Replaces product 567 with the new payload.
🔹 4. PATCH
Purpose: Partially update a resource.
Example:
PATCH /api/customers/123 with {"email": "new@[Link]"} → Updates only the email.
🔹 5. DELETE
Purpose: Remove a resource.
Example:
DELETE /api/users/999 → Deletes user with ID 999.
📌 Summary Table
Method Description Safe Idempotent
understanding the difference between SOAP and REST is crucial when working with web services and APIs.
✅ What is SOAP?
SOAP (Simple Object Access Protocol) is a protocol for exchanging structured information in web services
using XML.
Based on XML messaging
Operates over HTTP, SMTP, or others
Highly structured and strict
Requires a WSDL (Web Services Description Language) file
Supports security, transactions, and reliable messaging
✅ What is REST?
REST (Representational State Transfer) is an architectural style used to build lightweight web services that
communicate over HTTP using standard methods like GET, POST, PUT, DELETE.
Based on HTTP and URI resources
Uses JSON, XML, or any media type
Lightweight and flexible
Stateless communication
Widely used in modern APIs
Error Handling SOAP Fault (standardized XML) HTTP status codes (e.g., 404, 500)
Use Cases Enterprise systems, banking, B2B Mobile apps, public APIs,
microservices
🧠 Example Messages
🔹 SOAP Request (XML):
xml
CopyEdit
<soapenv:Envelope xmlns:soapenv="[Link]
xmlns:web="[Link]
<soapenv:Header/>
<soapenv:Body>
<web:getCustomer>
<customerId>123</customerId>
</web:getCustomer>
</soapenv:Body>
</soapenv:Envelope>
🔹 REST Request (HTTP + JSON):
http
Response:
json
{
"id": 123,
"name": "John Doe",
"email": "john@[Link]"
}
🧩 When to Use
Use Case Recommended
What is OAuth?
OAuth 2.0 is an authorization framework that allows secure, token-based access to APIs without sharing user
credentials.
It’s widely used in modern APIs to protect access and delegate rights.
pgsql
CopyEdit
Client → [POST] /token endpoint → (with client_id + client_secret)
← Receives Access Token
Client → [GET/POST] Protected API → with Bearer Token in Header
← Response if token is valid
pgsql
CopyEdit
Security → OAuth → Authorization Servers
3. Create a new OAuth2 Authorization Server
o Define the /token endpoint
o Set token expiration
o Choose JWT or opaque tokens
🔹 Step 2: Register Client Applications
1. Go to:
sql
CopyEdit
Applications → Add Application
2. Choose:
o Client ID
o Client Secret
o Allowed scopes
o Associated APIs
📌 These credentials are what clients will use to request access tokens.
mathematica
CopyEdit
APIs → Select API → Policies Tab
2. Add a "Identify & Authorize - OAuth2" policy.
3. Link it to the OAuth Authorization Server.
Now your API requires an access token for access.
bash
CopyEdit
curl -X POST [Link] \
-d "grant_type=client_credentials" \
-d "client_id=abc123" \
-d "client_secret=xyz456"
Response:
json
CopyEdit
{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600
}
bash
CopyEdit
curl -H "Authorization: Bearer eyJhbGciOi..." \
[Link]
API Gateway will:
Validate the token
Check scopes/permissions
Forward the request to IS if valid
🧠 Summary
Feature OAuth
[Link] try & catch block in webMethods? / how to handle error in code ?
nginx
CopyEdit
getLastError
🧠 Example
plaintext
CopyEdit
Sequence (Main)
│
├── Sequence (Try block) — exit on SUCCESS
│ ├── Service A
│ ├── Service B
│ └── Service C (may fail)
│
└── Sequence (Catch block) — exit on FAILURE
├── getLastError
├── log the error
└── send notification or default response
[Link]:throwExceptionForRetry Forces Integration Server to retry the flow service (used in trigger
services)
🔐 Best Practices
Tip Reason
Always use exit on = FAILURE for catch blocks Ensures the catch logic only runs on error
Don’t suppress errors silently Always log or rethrow them when needed
plaintext
CopyEdit
Sequence (Main)
├── Try Sequence (exit on SUCCESS)
├── Catch Sequence (exit on FAILURE)
└── Finally Sequence (exit on DONE) → always executes
Scope Internal systems within one organization External systems across organizations
Communication Fast, often real-time (over LAN or internal Slower, via internet or VAN
bus)
Standards Custom/internal formats (IDocs, JDBC, JMS) Standard protocols (EDI, AS2, RosettaNet,
cXML)
Security Usually within firewall, less strict High security (signing, encryption, certs)
🧠 In webMethods:
Integration Type Tools Used
In webMethods, JDBC Notifications are a powerful feature of the JDBC Adapter that allow your Integration
Server (IS) to automatically detect and respond to changes in a database — like inserts, updates, or deletes —
without polling constantly.
📦 Key Components
Component Description
both Loop and Repeat are control structures used in Flow services, but they function in different ways. Here's
a detailed comparison of the two:
2. Repeat
The Repeat step allows you to repeat a set of actions a fixed number of times or until a specific condition is
met. It is more focused on repetition rather than iterating over a collection.
Repetition of actions: Repeat is designed to perform the same set of actions a predefined number of
times.
Condition-based exit: You can specify a condition for when to stop the repetitions.
How it Works:
The Repeat step runs the specified actions for the fixed number of times or until the exit condition
becomes true.
The exit condition or count limit will stop the loop from repeating further.
Example:
You can use a Repeat step to send a reminder email 5 times if a certain task is still pending.
Usage:
When you need to repeat an action a certain number of times or until a specific condition is met.
You don’t necessarily need to iterate over a collection, just repeat the actions X times.
Condition Can break when a specific condition is Stops when a condition is met or reaches
met (e.g., end of list) a fixed repetition count
Use case Iterate over an array, list, or collection Repeating tasks like retry attempts,
(e.g., customers) sending reminders, etc.
Iteration over Yes, ideal for collections No, it's just repeated actions
collections
Control/Exit Control when to stop based on list size or Control by number of iterations or
custom conditions conditional exit
Example Process each item in a list of orders Retry an operation up to 5 times if it fails
The Exit step in webMethods Flow services is used to terminate the execution of a flow at any point during its
execution. It's essentially used to exit the flow or break out of a loop or repeat structure before all steps have
been executed.
You can use the Exit step to control the flow of execution based on certain conditions or requirements.
✅ Important Notes:
The Exit step will terminate the flow service and control is passed back to the caller.
When used inside a Loop or Repeat step, the Exit will only exit from the current loop or iteration and
not the entire service.
The Exit step can be useful in error-handling scenarios, like breaking out of the flow when an
exception occurs.
You can combine the Exit step with custom conditions (for example, using an If step) to control when
the flow should exit early.
🧠 Summary
Feature Description
Exit Code Custom exit code indicating the reason for termination
Use Case Can be used to break out of loops or repeat steps or terminate the flow
Typical Usage Early exit in case of errors, certain conditions met, or loop termination
Condition An expression or condition that evaluates to a Boolean value (true/false). You can define
multiple conditions.
Branches Each condition leads to a different branch (path) of execution. You can have one or more
branches.
Default Branch If none of the conditions are true, the default branch (else branch) is executed.
plaintext
CopyEdit
+-------------------+
| Branch Step |
+-------------------+
|
+-- Condition 1: orderAmount > 1000 --> High-value order processing
|
+-- Condition 2: customerType == 'VIP' --> Apply VIP discount
|
+-- Default --> Process as regular order
✅ Important Notes:
Multiple Conditions: You can have multiple conditions to evaluate, and you can use logical operators
(AND, OR) to combine them.
Exit Points: If the Branch step leads to a different path, execution will continue from there. It does not
return to the main flow unless explicitly defined.
Default Path: Always make sure to define a default branch to handle unexpected situations or
conditions.
Default Branch Optional path when none of the conditions are true
Use Case Direct flow based on conditions (e.g., different processing for VIP and non-VIP customers)
In webMethods, both savePipelineToFile and savePipeline are used to save the pipeline data (the set of
variables available in the service's pipeline) for debugging purposes or to capture the current state of the
pipeline. However, they are used differently and have different behaviors.
1. savePipeline
Purpose: This function saves the pipeline data to a log file on the Integration Server’s local file
system.
Usage: It saves the pipeline in the service logs (or as part of the service's execution logs) for
debugging purposes.
Where the Data is Saved: The saved pipeline data is not written to a physical file on the file system; it
is logged as part of the Integration Server's internal logs.
Visibility: The saved pipeline is visible in the server logs and can be accessed through the IS Admin
console (if enabled for logging). This is typically used to trace the flow of data through the service
during development or troubleshooting.
2. savePipelineToFile
Purpose: This function saves the pipeline data to a physical file on the Integration Server's file
system.
Usage: It writes the pipeline data to an actual file, which can then be accessed externally or stored for
further analysis.
Where the Data is Saved: The pipeline is saved to the file system, typically in an XML format. The
location is specified when calling the function or configured in the service.
Visibility: The saved file is directly accessible in the specified file system location, unlike the
savePipeline method which logs the data in the server logs.
Use Cases:
savePipeline:
o When to use: You typically use savePipeline for simple debugging or logging purposes when
you need to review the pipeline data while the service is running. It’s handy for quickly
checking what variables are in the pipeline at a given point.
o Example: You might want to log the pipeline just before the service completes to verify that
all expected data was processed correctly.
savePipelineToFile:
o When to use: You would use savePipelineToFile when you need to capture the pipeline data
in a file, either for long-term storage, to archive data, or when the file will be sent to an
external system for processing.
o Example: You might use this to save pipeline data into a file as part of an audit or for future
reprocessing. For example, saving the pipeline data as XML for debugging after processing a
batch job.
Summary:
savePipeline logs the pipeline to the server logs (useful for quick inspection during debugging).
savePipelineToFile writes the pipeline to a physical file on the file system (useful for more permanent
storage or external processing).
[Link] is tracePipeline?
In webMethods, the tracePipeline function is used to log the pipeline data (variables and their values) at a
specific point in a service's execution. It’s typically used for debugging purposes to see the state of the pipeline
at various steps of a service.
Purpose of tracePipeline
Debugging: The tracePipeline function is primarily used for debugging services. It allows you to
capture the state of the pipeline at a particular step and log the data for troubleshooting or
verification.
Logging Pipeline Variables: It gives visibility into the flow of data by logging the values of pipeline
variables (input and output) at runtime.
When you use tracePipeline, the pipeline data is logged, and you can see the values of various variables in the
Integration Server’s logs.
Summary of tracePipeline:
Function: Logs the current state of the pipeline.
Primary Use: Primarily for debugging and troubleshooting by making the pipeline data visible in the
logs.
Visibility: Output is visible in the Integration Server logs for developers to check.
No Modifications: Does not modify the pipeline data; it just logs it for reference.
[Link] is the purpose of clearPipline?
In webMethods, the clearPipeline function is used to clear or remove all variables from the current pipeline.
This essentially resets the pipeline by removing any existing data (variables, values, etc.) that was set before
the function is called.
Purpose of clearPipeline:
Resetting the Pipeline: It allows you to clear the pipeline of all variables and data. This can be useful
when you want to ensure that no previous values or data interfere with the current execution of the
service.
Preventing Data Leakage: In some cases, you may want to clear sensitive data or avoid passing
irrelevant data between different steps in the service. This helps in preventing data leakage and
ensures that only relevant variables remain in the pipeline.
Memory Management: In some cases, clearing the pipeline can help reduce memory usage by
removing unnecessary variables after they are no longer needed.
Important Notes:
Does Not Affect Flow Execution: Clearing the pipeline does not affect the flow’s execution or cause
the service to terminate; it just removes the variables in the pipeline.
Temporary Effect: The effect of clearPipeline() is temporary for the current service execution. Once
the service completes and a new execution starts, the pipeline will be populated again with new data.
Selective Clearing: If you need to clear specific variables rather than all of them, it’s better to use
removeFromPipeline() or set specific variables to null.
Summary:
Feature Description
Effect Removes all variables from the pipeline for the current service execution.
In IBM WebMethods Designer (part of the webMethods Integration Server suite), appending a document to a
list is an essential operation that is typically done using the Flow services. Here's how you can do it within the
IBM WebMethods Designer.
Best Approach to Append a Document to a List in webMethods Designer:
In webMethods Designer, you can append a document to a list using the List Append built-in step. You would
typically use this in a Flow Service to manipulate the pipeline data.
Example Flow for Appending a Document to a List:
1. Create or Get the List: First, ensure you have a List in the pipeline. If it's not already there, create a
new List.
2. Create or Get the Document: Prepare the document that you want to append to the list.
3. Append the Document to the List: Use the List Append built-in service to append the document.
Step-by-Step Example:
1. Create a Flow Service to Append Document to a List:
In WebMethods Designer, navigate to your Package and create a New Flow Service.
2. Add the List and Document to the Pipeline:
You can either initialize the list within the service or pass it from outside the service via the pipeline.
Similarly, create the document you want to append to this list.
3. Use List Append Service:
Here are the steps to append a document to a list:
1. Create or Initialize the List:
o Use the [Link]:createList service to create an empty list if needed.
2. Create the Document to Append:
o For example, create a document newDocument containing some data fields that you want
to append to the list.
3. Append the Document to the List:
o Use the [Link]:appendToList service to append the document to the list.
Example Flow Service:
Assume you are working with a list of Order Documents and you want to append a new order to it.
Flow Service Steps:
1. Create a List:
o Use [Link]:createList to create an empty list, if you don't have one.
2. Create the Document:
o Use [Link]:createDocument to create a document that represents the Order (e.g.,
OrderID, CustomerName, Amount).
3. Append the Document to the List:
o Use [Link]:appendToList to append the Order Document to the list.
Flow Example:
plaintext
CopyEdit
1. [Link]:createList -> list (this will create an empty list)
2. [Link]:createDocument -> newOrder (this creates a new order document)
Example fields: OrderID=101, CustomerName=John Doe, Amount=150.00
3. [Link]:appendToList -> (appends newOrder to list)
4. You can then continue processing the list or pass it on for further actions.
Conclusion:
The best practice for appending a document to a list in webMethods Designer is using the
[Link]:appendToList service. This ensures that the list is updated efficiently with each document added. This
service is preferred because it maintains the list in the pipeline, which allows for easy handling of multiple
documents.
Example in webMethods:
For instance, let’s say you are integrating an Order Management System (OMS) with a Customer Relationship
Management (CRM) system. The OMS might send an order in one format (e.g., XML), while the CRM expects a
different format (e.g., JSON).
The canonical document would act as the standard data structure (e.g., a canonical XML or JSON
format) that both systems agree on. When data is received from the OMS, it is mapped to the
canonical format.
Then, when sending data to the CRM, the canonical format is transformed into the format expected
by the CRM.
xml
CopyEdit
<order>
<orderID>123</orderID>
<customerName>John Doe</customerName>
<orderAmount>100</orderAmount>
</order>
3. System 2 (CRM): Expects JSON format:
json
CopyEdit
{
"orderID": "123",
"customerName": "John Doe",
"orderAmount": 100
}
In this scenario, a canonical document would be defined in webMethods to represent the order information in
a standard format, which is then transformed into the format needed by the CRM.
In webMethods, an ACL (Access Control List) is used to manage and control access to resources or services
within the webMethods Integration Server. It defines which users or groups are allowed to perform certain
actions (such as read, write, or execute) on different webMethods assets (e.g., services, packages, folders, and
other resources).
How to Define and Configure ACL in webMethods:
1. Understanding the Components of ACLs:
An ACL consists of:
Resources: These are the assets or objects that you want to protect, such as services, folders, or
entire packages.
Principals: These are the users or groups to whom access control rules are applied. Principals can be
individual users or predefined groups in the system.
Permissions: These define what actions (read, write, execute, etc.) the principal is allowed to perform
on the resource.
Actions: These are the operations that can be performed on the resource (e.g., read, write, execute).
2. Types of Permissions in ACLs:
webMethods supports the following permissions for each resource:
Read: Allows the user to read the resource.
Write: Allows the user to modify the resource.
Execute: Allows the user to execute the resource (e.g., call a service).
Delete: Allows the user to delete the resource.
Subscribe: Allows the user to subscribe to a resource (relevant for messaging).
3. Steps to Define an ACL in webMethods:
Step 1: Access the webMethods Administrator Console:
To define and manage ACLs, you need to log in to the webMethods Administrator Console.
Navigate to the Security section, where you will find options for managing ACLs.
Step 2: Create or Modify an ACL:
1. Go to Security > ACLs (Access Control Lists).
2. Here, you can either create a new ACL or modify an existing ACL.
Step 3: Define the Resources:
Resources are the webMethods assets that need access control. You will select the services,
packages, folders, or other resources that you want to control access for.
For example, if you want to control access to a specific service, navigate to the service and select it as
a resource.
Step 4: Assign Principals (Users or Groups):
Principals refer to the users or user groups to whom you want to assign specific permissions.
You can assign permissions to individual users or to user groups (such as Admin, Developers, or any
custom group you have defined).
Step 5: Define Permissions for the Resource:
For each resource, you can specify which actions the principal (user/group) is allowed to perform. The
available actions are Read, Write, Execute, and Delete.
For example, if a user should only be able to read a service but not execute or modify it, you would
assign them the Read permission.
Step 6: Save the ACL:
After defining the resources, principals, and permissions, save the ACL configuration.
Step 7: Apply ACLs to Assets:
Once the ACL is defined, it will be automatically applied to the specified resources. The users or
groups defined in the ACL will now have the access permissions you’ve assigned.
4. Example of Setting ACLs:
Let's say you want to grant the following permissions:
User: JohnDoe
Group: Developers
Resources: MyPackage and MyService
Permissions: Read, Write, Execute
You would follow these steps in the webMethods Administrator Console:
1. Create a new ACL or select an existing ACL.
2. Add JohnDoe as a Principal with Read, Write, and Execute permissions for the MyService resource.
3. Add the Developers group as a Principal with Read and Execute permissions for the MyPackage
resource.
4. Save the ACL configuration.
5. ACL Propagation:
ACLs can be defined at different levels, such as at the service level, package level, or folder level.
When you define an ACL at the folder or package level, it may propagate to the child services or
resources within that folder/package.
ACLs are typically inherited by sub-resources unless explicitly overridden.
6. Best Practices for ACL Configuration:
Granularity: Define ACLs as granular as possible to ensure fine-grained access control. Instead of
giving broad permissions, assign permissions specifically to services, packages, or resources that need
to be accessed.
Use Groups: Assign permissions to user groups rather than individual users to simplify the
management of ACLs, especially in large environments.
Review Permissions Regularly: Periodically review and audit ACL configurations to ensure that
permissions are still appropriate based on user roles and responsibilities.
Minimize Write Access: Restrict Write and Execute permissions to only those who need it, as these
actions can significantly affect the system.
Avoid Over-assigning Permissions: Be careful not to grant excessive permissions, such as providing
Write or Execute access to everyone, as it could introduce security vulnerabilities.
7. Managing ACLs Through Integration Server Settings:
In some cases, you may need to manage or modify ACLs programmatically. This can be done using Integration
Server Services:
[Link]:checkAccess: Checks whether a user has specific access to a resource.
[Link]:addPrincipal: Adds a user or group as a principal.
[Link]:removePrincipal: Removes a user or group as a principal.
8. Audit and Troubleshooting:
You can enable audit logging for ACLs to track access attempts and detect any unauthorized access or
security breaches.
If access issues arise, verify the ACLs configured for the resources and ensure that the correct
users/groups have the right permissions for those resources.
Conclusion:
In webMethods, ACLs are used to manage user access and permissions for resources within the integration
server. They define which users or groups can perform specific actions on the resources (like services,
packages, and folders). By configuring ACLs, you can ensure secure, controlled access to critical resources,
reducing the risk of unauthorized access and maintaining the integrity of your integration environment.