Solved

Trigger flow using Webhook

  • 8 January 2024
  • 3 replies
  • 92 views

Userlevel 5
Badge +1

Hi

 

I want to trigger a simple flow using a webhook.

 

When I call it via Postman

POST /connector/AtlasTrackingToServiceBus/Webhook1/webhook.rsb HTTP/1.1
Host: jpREDACTED01:80XX
Content-Type: application/xml
Authorization: Basic RGF0-REDACTED-5eTFn
Content-Length: 13

<root></root>

I’m not interested in the message body, I just want to trigger the flow

 

I can see the Webhook being triggered and that looks SUCCESSful.

 

The Webhook flows into a MySQL Connector, but the MySQl Connector reports that the message is not “Finalised”

 

[2024-01-08T11:38:56.632] [Info] Arc Version: 23.3.8698.0
[2024-01-08T11:38:56.632] [Info] System Version: Microsoft Windows Server 2022 Standard
[2024-01-08T11:38:56.632] [Info] VM Version: 4.0.30319.42000
[2024-01-08T11:38:56.632] [Error] The message Webhook1-20240108-113856335-cK_v is not finalized.
[2024-01-08T11:38:56.632] [Info] Message Webhook1-20240108-113856335-cK_v is finalized.
Name: Webhook1-20240108-113856335-cK_v.xml, Type: Input, Status: Error, Message: The message Webhook1-20240108-113856335-cK_v is not finalized., Processing Time: 0ms.
 

 

Normally I run the MySQL connector manually using Output > Receive. But I’d like to allow a colleague to be able to trigger it easily.

What am I doing wrong?

 

icon

Best answer by James B 8 January 2024, 15:09

View original

3 replies

Userlevel 6
Badge

Is the MySQL connector here using a SELECT mapping? 

 

You can still achieve what you're looking for here, but if you have a database connector that has a SELECT mapping configured, it is not intended that this operation be triggered on a message driven basis (e.g., you would only start a flow with a SELECT mapping, but feeding messages into it from a flow wouldn’t trigger the SELECT).

 

It is still possible to trigger the receive action of a connector in your flow, if you do so as part of the receiveFile API call (note that this requires a license of CData Arc that supports the Admin API, such as a Professional edition license):

 

https://cdn.cdata.com/help/AZG/mft/API-Actions.html

 

I think the simplest way to manage this would be to use this code within the Response event of the Webhook connector. This code, for example, triggers the receive action of the Script1 connector: 

 

<!-- Code goes here -->
<arc:call op="api.rsc/receiveFile?connectorId=Script1" httpmethod="post" 
          authtoken="xxxxxxxxxxxxx" />
<arc:set attr="_response.write">Script1 invoked!</arc:set>

 

The authtoken here is the authtoken of a user configured in the application with privileges to call the admin API:

https://cdn.cdata.com/help/AZJ/mft/User-Roles.html#admin-api-access

 

Finally, note that your Webhook is still going to output whatever body is posted to it. If the input message is unimportant, I recommend that you use a Script connector without any code to “dispose” of the incoming messages:

 

 

Userlevel 5
Badge +1

Thanks, I don’t think we have the Professional Edition. It’s not a very important feature so I’ll work around it.

Userlevel 5
Badge +1

I lied. We do have Professional, and the method above works perfectly.

 

thanks!

Reply