To promote reuse, it's best to create reusable parts that represent the services you connect to. For example, you'd want to create a FileServices reusable part, with the following methods:
It's recommended that you have one base class for all your services, so you can specify common properties, such as the service URL, in this base class. This way, you have your common properties centralized in one place, instead of having them scattered all over (and if your service URL changes, you only need to change it in one place).
Let's now create a reusable part called ExternalServiceBase.
Create a method called SetupUrlBuilder. This method sets the URL properties that are common for all services (scheme, hostname, and port number, base path). If you are not using the default Tomcat HTTP port (8080), adjust the port as required in the code below.
Mthroutine Name(SetupUrlBuilder)
Define_Map For(*INPUT) Class(#XPRIM_UriBuilder) Name(#UrlBuilder) Pass(*BY_REFERENCE)
#UrlBuilder.SetScheme( 'http' )
#UrlBuilder.SetHost( 'localhost' )
#UrlBuilder.SetPort( 8080 )
#UrlBuilder.AddPathComponent( 'lansa-tutorial' )
Endroutine
The code above sets up the base URL as http://localhost:8080/lansa-tutorial.