yawlfoundation / yawl

Yet Another Workflow Language
http://www.yawlfoundation.org
GNU Lesser General Public License v3.0
88 stars 35 forks source link

Custom service (InterfaceB) URL cannot be HTTPS #608

Closed mlawry closed 7 years ago

mlawry commented 7 years ago

I've developed a custom service that connects to YAWL engine via Interface B. The service runs on a different server and the connection is fine over plain HTTP.

However, I want to encrypt the transit traffic but when I type in a HTTPS URL (e.g. https://myservice.com/ib) in Resource Service's, I get an error "Invalid URL: URL does not begin with 'http://'.

I traced the issue to the class org.yawlfoundation.yawl.util.HttpURLValidator line 77 where it explicitly requires plain HTTP:

if (!urlStr.startsWith("http://"))
    throw new MalformedURLException("URL does not begin with 'http://'");

Is there a reason why HTTPS is not allowed?

yawlfoundation commented 7 years ago

No, just an oversight.

Fixed in latest updates. Please confirm issue is resolved.

mlawry commented 7 years ago

Yep. Tested it and it works!

mlawry commented 7 years ago

Hi, sorry about re-opening this issue but I did some more testing and found a problem with using HTTPS.

The issue is that when a new case is started by my custom service, new work item announcements (YEngineEvent.ITEM_ADD) do not get sent to my custom service.

I traced the issue to the ObserverGatewayController class (package org.yawlfoundation.yawl.engine). In the following method:

protected void announce(final YAnnouncement announcement)

For an ITEM_ADD announcement to be fired, the code uses the scheme returned from YAnnouncement.getScheme() to find an ObserverGateway instance, which is then asked to perform the announcement.

From my tests, the scheme value is "https" which I assume is because my custom service URL is HTTPS. However, the getGatewaysForScheme(scheme) call returns empty because the _gateways Hashtable looks like this:

2017-07-06 06:58:49,046 [WARN ] ObserverGatewayController :- stored gateways are: {http=[org.yawlfoundation.yawl.engine.interfce.interfaceB.InterfaceB_EngineBasedClient@3038eaae]}

So now I'm wondering why the _gateways Hashtable only has a "http" key. The reason looks like it is because only one ObserverGateway is ever added to the engine, as suggested here in YAnnouncer, where it adds an instance of InterfaceB_EngineBasedClient that always returns "http" hard coded.

This problem looks complicated and I can't see an obvious fix. What do you think?

yawlfoundation commented 7 years ago

I have introduced a new controller class in the latest update that supports https services. Please advise & close if this fixes the issue. Thanks for your patience.

mlawry commented 7 years ago

Working well now. Hopefully no more issues!