webMethods.io: Transformation Service

In my last post, I talked about avoiding custom code for complex projects. It's time to get your hands dirty creating the first Flow Service for the integration project.

After login to your Webmethods.io Integration environment, you will see a screen similar to the screenshot below. About a month ago, we toured the environment facilities, so if you are unfamiliar with IBM webMethods.io, I recommend you glance at my previous post.

After logging in to your environment, select your integration project and switch from Workflows to Flow Services.

Switching to Flow Services in the Project "First Steps."

The empty scene welcomes you with a big blue button, inviting you to create the new service. Press the button or click the new Flow service link below it. The Flow Service design and user experience completely differ from the conventional "drag-and-drop" Workflow canvas.

Newborn Flow Service

Almost every element of this minimalistic design is interactive. To change the service name, click on the word "Untitled," and it turns into the input field. Give it some sound name, avoiding spaces and special characters. I've named mine "StripCompletions." Now, click on the description below the service name and add the service description. Since the service should drop all ChatGPT service information and remove extra quotes and spaces from the LLM responses, I came up with the "Strips ChatGPT service attributes and trims completion strings."

With Flow Services, you can define input and output variable types from scratch or create a new document type using the same functionality as Workflow integration definitions.

⁉️
Although the document type designers are the same, Flow Services cannot access Workflow documents even if both integrations are in the same project. At least project services could share document types.
  1. To create new document types, click the I/O icon at the top of the service edit screen.
  2. In the input and output fields, Select the "Document Reference" option, then from the "Choose Document Reference" drop-down, select the "Add Document Type" link. It will take you to the project configuration.
Flow Service Configuration Shortcut.
  1. To define a new document type, click the "Add Document Type" button at the top of the empty Document Types table. Keep the "None, build from scratch" option in the pop-up dialog selected and click the "Ok" button.
💡
If you have XML Schema definitions for your documents, you could save time and import your types into the system.
  1. Even if we do not have predefined document types, we could save some time using OpenAI API Reference sample documents. Give the new document name and description, and then click the "Load JSON" button.
  2. Paste the ChatGPT Response document and fix some JSON formatting errors. When you see no error flags on the right of the text area, click Load JSON.
  3. Now, walk through the data fields and alter their definitions to match your scenarios and actual data. In this case, I care only about the choices list and its time definitions, so I made all other fields optional.
Imported ChatGPT Response Type
  1. Click the "Save" button to complete the document type definition.
  2. Return to the previous browser tab with the Flow Service definition and return to the I/O definition dialog. Select Document reference and choose the OpenAICompletionType from the drop-down list. The service input fields will be populated using the document type.
  3. Select "Output Fields" after the "Specification reference" radio button.
  4. This time, for service output, we skip the document definition and load the OpenAI response using the "Load JSON" button.
  5. Paste the same response document one more time, keeping only the choices list with the message field.
The only Field to Return.
  1. Click the "Done" button to complete the input/output definition.
  2. Click on the "Save" icon in the Flow service editor to preserve your progress.

Now, we have an empty Flow service with input and output definitions and a document type based on the OpenAI response message. In the next post, we will use them for service execution steps.


Previous posts in the Flow service series: