This topic explains how to configure and apply the webMethods tool, which allows you to publish and send BrokerEvent objects to Software AG webMethods Broker, as well as subscribe to events and invoke native webMethods IS (Integration Server) services. Sections include:
The configuration steps vary according to the execution mode you want to use (publish, subscribe, request/reply).
The following .jar files always need to be added to the SOAtest classpath:
The .jar files can be found under <WEBMETHODS_INSTALL_DIR>/common/lib/
. For more details, please refer to webMethods Broker Client Java API Programmer's Guide > Getting Started > Using the webMethods Broker Java API.
In some cases, the enttoolkit.jar found under <WEBMETHODS_INSTALL_DIR>/common/lib/ext
is also required.
To add these jar files to SOAtest classpath, complete the following:
To configure the webMethods tool to publish BrokerEvent objects:
(Optional) In Subscription Filter, specify a filter string in order to retrieve only the events with desired field values. For example, you may use expressions such as my_Strin_field="some value" and my_int_value < 5
For more details on the syntax of filter strings, see the WebMethods Broker Client Java API Programmer's Guide, "Using Event Filters" section.
For more information about BrokerEvent objects, please refer to the COM.activesw.api.client.BrokerEvent documentation in the webMethods Broker Client Java API Programmer’s Guide.
During test execution, SOAtest publishes the event by invoking the broker client Java API and providing it with a BrokerEventobject. Any applications that are subscribed to that event type will receive the event that SOAtest published.
To view an XML representation of the events that are published, use the Traffic Viewer tool, which is automatically chained to the webMethods tool. Note that even though actual BrokerEvent objects are sent and received, the viewer uses an XML representation. This makes it easier to read and allows you to chain tools that validate or process the content (for example, the Diff tool or XML Assertor tool).
To configure the webMethods tool to subscribe to BrokerEvent objects:
During test execution, SOAtest starts listening for events that are published to the specified event type.
To view an XML representation of the events that are received, use the Traffic Viewer tool, which is automatically chained to the webMethods tool. Note that even though actual BrokerEvent event objects are sent and received, the viewer uses an XML representation. This makes it easier to read and allows you to chain tools that validate or process the content (for example, the Diff tool or XML Assertor tool).
To configure the webMethods tool to send a BrokerEvent object and wait for a reply before sending another:
For more information about BrokerEvent objects, please refer to the COM.activesw.api.client.BrokerEvent documentation in the webMethods Broker Client Java API Programmer’s Guide.
During test execution, SOAtest sends a request by invoking the broker client Java API and providing it with a broker event object, then it waits for a reply.
To view an XML representation of the request and reply events, use the Traffic Viewer tool, which is automatically chained to the webMethods tool. Note that even though actual BrokerEvent objects are sent and received, the viewer uses an XML representation. This makes it easier to read and allows you to chain tools that validate or process the content (for example, the Diff tool or XML Assertor tool).
When publishing to a Broker or doing a request/reply using scripted input, two arguments will be passed into your custom method. The first argument is a BrokerEvent object for the type name you specified in the tool settings. You need to populate this object with the desired input values (see the webMethods Broker Client Java API Programmer’s Guide for details on how to accomplish this) then return it. The second argument is a test tool com.parasoft.api.Context
object.
Here is a sample Jython script:
from com.parasoft.api import * from COM.activesw.api.client import * def configureBrokerEvent(event, context): event.setUCStringField("s", "something") event.setIntegerField("i", 1) event.setUCStringSeqField("sl", 0, BrokerEvent.ENTIRE_SEQUENCE, BrokerEvent.AUTO_SIZE, ["one", "two", "three"]) return event |
The following .jar file needs to be added to the SOAtest classpath:
It can be found under <WEBMETHODS_INSTALL_DIR>/common/lib/
. In some cases, the enttoolkit.jar found under <WEBMETHODS_INSTALL_DIR>/common/lib/ext/
is also required. To add a .jar file to SOAtest classpath, complete the following:
To configure SOAtest to invoke webMethods IS (Integration Server) services and receive responses:
During test execution, SOAtest sends iData objects to invoke Integration Server services and receives responses.
To view an XML representation of the objects that are sent and received, use the Traffic Viewer tool, which is automatically chained to the webMethods tool. This XML representation uses the iData XML coder format. Note that even though actual iData objects are sent and received, the viewer uses an XML representation. This makes it easier to read and allows you to chain tools that validate or process the content (e.g., the Diff tool or XML Assertor tool).
When using an Integration Server service with scripted input, your custom method will be passed two arguments. The first is an IData object that you need to populate with the desired data and then return. The second argument is a com.parasoft.api.Context object.
Here is a sample Jython script:
from com.wm.app.b2b.client import * from com.wm.data import * def buildIData(idata, context): IDataUtil.put(idata.getCursor(), "in1", "12") IDataUtil.put(idata.getCursor(), "in2", "13") return idata |
The session ID is automatically saved to the WebMethodsSessionId
context variable. It can be accessed from an Extension tool, script, or custom tool using com.parasoft.api.Context.get(String key)
, where String key
is "WebMethodsSessionId".
For example, the following Extension tool (using a Groovy script) accesses the session id that is stored in the sessionId
variable,:
import com.parasoft.api.* boolean useSessionId(input, context) { sessionId = context.get("WebMethodsSessionId") Application.showMessage("sessionId = " + sessionId) // Put code here to do something with the session id return true } |