Proxy Services¶
Introduction¶
Proxy services are virtual services that receive messages and optionally process them before forwarding them to a service at a given endpoint. This approach allows you to perform necessary transformations and introduce additional functionality without changing your existing service.
Just as REST APIs and Inbound Endpoints, the proxy service uses mediators and sequences to define the mediation logic for processing messages. You can also enabling WS-Security to a proxy service, so that it serves as a security gateway to your actual services. The In sequence handles incoming requests and sends them to the back-end service, and the Out sequence handles the responses from the back-end service and sends them to the requesting client. You can also define a fault sequence to handle any errors that may occur while mediating a message through a resource.
Any available transport can be used to receive and send messages from the proxy services. A proxy service is externally visible and can be accessed using a URL similar to a normal web service address.
Properties¶
See the topics given below for the list of properties that can be configured when creating a proxy service.
General Properties¶
Listed below are the main properties that are required when creating a proxy service of any type.
Property | Description |
---|---|
Proxy Servive Name | A unique name for the proxy service. |
Transports | The transport protocols that are used to receive messages. Once you have selected the required transports, you can later add service parameters relevant to each transport type. |
Target Endpoint |
The proxy service uses an Endpoint artifact inline to define the location to which messages should be routed. You can choose one of the following options to specify the endpoint.
|
Logging Properties¶
The following properties are required when creating a logging proxy service:
Property | Description |
---|---|
Target Endpoint | See the descriptions of general properties |
Transports | See the descriptions of general properties |
Request Log Level |
This is the log level used for logging the request message.
|
Response Log Level |
This is the log level used for logging the response message.
|
WSDL Properties¶
The following properties are required when creating a WSDL-based proxy service:
Property | Description |
---|---|
Transports | See the descriptions of general properties |
WSDL URI |
The URL and the URN of the WSDL. The URL defines the host address of the network resource (can be omitted if resources are not network homed), and the URN defines the resource name in local namespaces. For example, if the URL is ftp://ftp.dlink.ru and the URN is /pub/ADSL/ , you would enter ftp://ftp.dlink.ru/pub/ADSL/ for the URI.
|
WSDL Service | The WSDL service name. |
WSDL Port | The port of the WSDL. |
Publish Same Service Contract | Select this option if you want to publish this WSDL. |
Transformer Proxy Properties¶
The following properties are required when creating a transformer proxy service:
Property | Description |
---|---|
Transports | See the descriptions of general properties |
Target Endpoint | See the descriptions of general properties |
Request XSLT | Specify the location of the XSLT you want to use for transformining incoming request messages. |
Transform Responses | Select this option if you want the Micro Integrator to transform response messages that are sent back to the client. |
Response XSLT | Specify the location of the XSLT you want to use for transformining response messages. |
Service Parameters¶
-
See the list of transport parameters you can configure at service level for a proxy service:
-
You can also configure the following service-level property to expose an Inbound Endpoint through a proxy service:
Service Parameter Description inbound.only Whether the proxy service needs to be exposed only via inbound endpoints. If set to true
all requests that the proxy service receives via normal transport will be rejected. The proxy service will process only the requests that are received via inbound endpoints. The default setting isfalse
. -
To publish a custom WSDL for a proxy service, select one of the WSDL types.
WSDL Type Description INLINE Enter the WSDL definition in the WSDL XML field. SOURCE_URL Enter the URI of the WSDL in the text box, and then click Test URI to ensure it is available. A URI consists of a URL and URN. The URL defines the host address of the network resource (can be omitted if resources are not network homed), and the URN defines the resource name in local "namespaces."
For example URI =
ftp://ftp.dlink.ru/pub/ADSL , w
here URL =ftp://ftp.dlink.ru
and URN =pub/ADSL
REGISTRY_KEY If the WSDL is saved as a registry entry, select this option and choose the reference key of that registry entry from the governance Registry or configuration Registry.
ENDPOINT - Following are additional service parameters you can use to configure the service WSDL.
Parameter
Description
useOriginalwsdl
If this parameter is set to
true
, the original WSDL published via thepublishWSDL
parameter is used instead of the custom WSDL.modifyUserWSDLPortAddress
If true (default), the port addresses will be modified to the current host. Effective only with
useOriginalwsdl=true
.ApplicationXMLBuilder.allowDTD If this parameter is set to true, it enables data type definition processing for the proxy service.
Data type definition processing is disabled in the Axis2 engine due to security vulnerability. This parameter enables it for individual proxy services.enablePublishWSDLSafeMode
If this parameter is set to
true
when deploying a proxy service, even though the WSDL is not available, you can prevent the proxy service from being faulty. However, the deployed proxy service will be inaccessible since the WSDL is not available.Note that this is only applicable when you publish the WSDL (i.e., via the
publishWSDL
property) either as a URI or as an endpoint.showAbsoluteSchemaURL If this parameter is set to true
, the absolute path of the referred schemas of the WSDL is shown instead of the relative paths.showProxySchemaURL If this parameter is set to true
, the full proxy URL will be set as the prefix to the schema location of the imports in proxy WSDL.If your WSDL has dependencies with other resources (schemas or other WSDL documents), you can link them using the Wsdl Resources property. Click the browse icon and enter the registry key and the location of the dependent resource: The location is available in the WSDL. When you have the location, you can find registry key corresponding to the location from the registry.
In the following example, the WSDL imports a metadata schema from the metadata.xsd file. Therefore, the location is metadata.xsd.
<xsd:import namespace=http://www.wso2.org/test/10 schemaLocation="metadata.xsd" />
In the following example, the WSDL is retrieved from the registry using the key
my.wsdl
. This WSDL imports another WSDL fromhttp://www.standards.org/standard.wsdl
. This dependent WSDL is retrieved from the registry using thestandard.wsdl
registry key.<publishWSDL key="my.wsdl"> <resource location="http://www.standards.org/standard.wsdl" key="standard.wsdl"/> </publishWSDL>