Today I want to show how we can use Enterprise Architect and the Amuse Plug-In to integrate a “classic” WebService (asmx) into a flowchart.

In this example I will use the project from my last example (“LieberLieber AMUSE – Using Statemachines to Build Winforms flows“) and extend this solution to use a ASP.NET-Authentication-WebService.

1. First we will add to the existing .NET solution a new project from the type “ASP.NET Web Service Application” and call it “AMUSEAuthenticationWebService”.

2. Change the name from “Service1.asmx” to “AuthenticationService.asmx”.

3. Now we add another project from type “Class Library” and call it “AMUSEAuthenticationLogic”.

4. Change the name of the class file from “Class1.cs” to “Authentication.cs”.

5. Copy now the “ValidateUser”-method from “AMUSEAuthenticationService”-project to the “AMUSEAuthenticationLogic”-project.

6. Now we build the solution and add the “AMUSEAuthenticationLogic.dll”, as reference, to the “AMUSEEAuthenticationWebService” project.

7. Now we can change the class name and method name from the “AuthenticationService.asmx.cs”:
Class name: AuthenticationService
Method name: ValidateUser(string username, password) and call the “ValidateUser” method from the “AMUSEAuthenticationLogic”

8. We will now change the existing “ValidateUser” method in the “AMUSEAuthenticationService”-project but we before that we should create the web service proxy class, so that we don’t have to use any configuration files further on.

9. To do that we have to start the “AMUSEAuthenticationWebService”.
a) Set the “AMUSEAuthenticationWebService” as StartUp project
b) Set the “AuthenticationService.asmx” as Start Page.
c) F5

10. Open the Visual Studio Command and enter:
wsdl http://localhost:{YOURPORT}/AuthenticationService.asmx /out:[YOURPATH]\AuthenticationServiceProxy.cs

11. Add the generated file now to the “AMUSEAuthenticationService” project.

12. Also add the “System.Web.dll” and the “System.Web.Services.dll” to the project, otherwise you will get exceptions!

13. Now we can implement the “ValidateUser” by calling the “ValidateUser” method from the “AuthenticationService”. You should have now the code as in following screenshot:

14. Now before we go over to the interesting Enterprise Architect and AMUSE part, we will also create the wsdl-file from our “AMUSEAuthenticationWebService”.

15. Start the “AMUSEAuthenticationWebService” again and click the “Service Description” on the opening web site or by just typing the http://YOURURL/AuthenticationService.asmx?WSDL

16. You can now save that content as AuthenticationService.wsdl.
We will need that file now to load it into the Enterprise Architect.

17. Copy now the new “AMUSEAuthenticationService.dll” into the “ExternalReferences” and close Visual Studio.NET.

18. So let’s move now to the interesting part – the Enterprise Architect and AMUSE-PlugIn.

19. Open the Enterprise Architect solution from the last example and import the WSDL:
a) Menu – “Project” – “Web Services” – “Import WSDL”
b) Choose our AuthenticationService.wsdl file and import.
Your “Project Browser” should now look like in the following screenshot:

20. Now let’s try our workflow.

21. The workflow stops with an error?

22. If you look closer at the “Stack Trace” you can find the error:
And if you look at the detail description – double click on the “Error”. You can see that there is no connection to the remote server. To resolve that problem we could start now Visual Studio.NET again or better we start the service from Enterprise Architect!


23. For that reason we create a StartWebDev.bat file and place it into the “External References” folder. We add now following code:
call “C:\Program Files\Microsoft Visual Studio 9.0\vc\vcvarsall.bat”

“C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.exe” /port:[YOURPORT] /path:”[YOURSOLUTIONPATH]” /vpath:/

24. Now we can go to the Enterprise Architect and add the StartWebDev.bat file for the “Run”.

25. a) Right mouse click on the
<<WSDLnamespace>> AuthenticationService”-package.
b) Build and Run
c) Run

26. Now we add a new Build Script:
Name: AuthenticationService
Directory: [YOURPATH]

27. At the “Run” section we can select now the “StartWebDev.bat” file.

28. If you choose now “Run” from the context menu again or press “STRG+Alt+N” the ASP.NET Development Server will start and the workflow works without errors!

To download the project files click here

As we saw in this example it is very easy to use Enterprise Architect and the AMUSE-PlugIn to call existing ASP.NET Web Services and execute them within Enterprise Architect.