Use logical names for service locations
Using a logical reference for the Web service, instead of the real URL, in your client application URL binding has advantages for working with and deploying applications.
Genero Web Services provide a repository for Web service locations using FGLPROFILE. To achieve maximum flexibility, you can map a logical reference used by your Web Services client application to an actual URL. This is subject to the network configuration and access rights management of the deployment site.
Create logical reference with an FGLPROFILE entry
ws.myservice.url = "http://www.MyServer.com/fastcgi/ws/r/MyWebService"
Logical reference in the client application
# Location of the SOAP server.
# You can reassign this value at run-time.
PUBLIC DEFINE Calculator_CalculatorPortTypeSoap12Endpoint WSHelper.tGlobalEndpointType
You can use this public variable in your Web Services client application to assign a logical name to the Web service URL:
LET Calculator_CalculatorPortTypeSoap12Endpoint.Address.Uri = "alias://myservice"
When the client application accesses the service, the location will be supplied by the entry in the FGLPROFILE file on the client machine. This allows you to provide the same compiled .42r application to different customers; the entries in the FGLPROFILE file on each customer's machine would customize the Web Service location for that customer.
If you are migrating from a version prior to 2.40, see also Web Services changes.
Logical reference in a legacy client application
GLOBALS
, a global variable for the URL of the Web Service is contained in the
.inc file. For
example:# Location of the SOAP server.
# You can reassign this value at run-time.
DEFINE Calculator_CalculatorPortTypeEndpoint tGlobalEndpointType
You can use this global
variable in your Web Services client application to assign a logical name to the Web service URL: LET Calculator_CalculatorPortTypeEndpoint.Address.Uri = "alias://myservice"
When the client application accesses the service, the location will be supplied by the entry in the FGLPROFILE file on the client machine. This allows you to provide the same compiled .42r application to different customers; the entries in the FGLPROFILE file on each customer's machine would customize the Web Service location for that customer.
If you are migrating from a version prior to 2.40, see also Web Services changes.
Examples of using logical reference in the URL
When you deploy a Genero Web Service with a GAS behind a Web Server, the service can be accessed by two different URLs; for example:
-
For internal clients: http://zeus:6394/ws/r/MyWebService
-
For clients using the Web: http://www.MyServer.com/fastcgi/ws/r/MyWebService
You use a logical name in the URL binding record and map the actual location of the Web Service in your FGLPROFILE file, depending on the location of the client machine.
- For internal clients, the FGLPROFILE entry would
be:
ws.myservice.url = "http://zeus:6394/ws/r/MyWebService"
- For clients using the Web, the FGLPROFILE entry would
be:
ws.myservice.url = "http://www.MyServer.com/fastcgi/ws/r/MyWebService"