When a tenant hosts a service to be used by external parties, it should ideally have a short URL. Shorter URLs are easier to be memorized and typed, which eliminates the need to log-in to access the service. Also, tenant information and other descriptive attributes are hidden in shorter URLs, and they are more convenient in hard-copy productions.
Context mapping capability for services (Axis2, Jar, Spring, Data Services etc.) facilitates this requirement.
By default, a service's endpoint URL is of the format http://localhost:port/services/service_context
and service endpoint of a tenant is of the format http://localhost:port/services/t/tenant_domain/service_context
. The URL mapping feature provides a way to access your hosted service endpoint with a shorter URL such as http://serviceid.localhost:port
in standalone products. For example, if the actual URL of a service endpoint is https://localhost:9443/services/admin/RESTSample
, with a URL mapping name as servicetest
, you get a shorter endpoint URL as https://servicetest.localhost:9443
.
The steps below explain how to use URL mapping.
1. Log on to the product's m anagement console and select "Services -> List" under the "Main" menu.
2. The "Deployed Services" page appears which lists out all the currently active services. Select a service and click on it to view its dashboard. For example,
3. If the "URL Mapper" feature is installed in the product, you can find the "URL Mappings" link in the service's dashboard.
Click the "URL Mappings" link.
4. The "URL Mappings" window opens. Click the "Add New Mapping" link.
5. Enter a URL mapping name. For example,
6. The added URL mapping appears in the "URL Mapping" window.
Here the suffix "localhost" comes from CARBON_HOME/repository/conf/etc/url-mapping-config.xml. You can configure your own suffix and 'URL mappings limit' per service in the mentioned configuration file. By default, the suffix is "localhost" and 'URL mappings limit' is one.
7. The service's wsdl files, tryit tool and rest calls can be accessed with the shortened endpoint URLs as follows:
- http://examplemap.localhost:port?wsdl - to access the wsdl of your service
- http://examplemap.localhost:port?tryit - to access the tryit tool of your service
- http://examplemap.localhost:port /getQuote - to access rest call of your service
To access your own domain, a cname is required. If a cname is not available at the moment, you can use /etc/hosts file in ubuntu or Windows\Syst em32\drivers\et c\hosts file in windows to put your domain entries pointing to the local ip. For example,
127.0.0.1 exampleapp.localhost
This is applicable only for testing purposes.