Usage of Metadata Exchange (MEX)
This samples demonstrates
- How to enable a Metadata Exchange (MEX) request for an arbitrary service.
- How to use MEXClient to retrieve metadata from a service that supports MEX requests.
- How to write your own data retrievers to configure the metadata of your service.
Building the Sample
Find the sample discussed here in <AS_HOME>/samples/MEX directory. You need Apache Ant to build the sample.
The steps are as follows:
1. Install and run the WSO2 Application Server. Refer to the Installation Guide for instructions.
2. In a command prompt, switch to the sample directory:
For example, in Windows: cd <AS_HOME>\samples\MEX.
3. From there, type ant .
Configuring Services
To enable MEX request support for samples services, follow these steps:
1. Login to Application Server Management Console and access the Deployed Services . (Manage -> Services -> List).
2. Click on the HelloWorldService1 link. The service's Dashboard will appear.
3. Click on the Module Configurations link in the "Quality of Services" panel of the service dashboard.
4. Select wso2mex from the drop down list and click the engage button.
5. An alert box would be displayed if the module is engaged successfully.
Running the Client
1. Switch to <AS_HOME>/samples/MEX directory.
2. Run the client. (run-client.bat in Windows or run-client.sh in Linux).
3. Enter the URL of the target service. You will be prompted for the URL of the service from which you wish to retrieve metadata.
For example:
Please enter the service URL: http://localhost:9763/services/HelloWorldService1
Choose the type of metadata you wish to retrieve. For example, if you wish to retrieve XML Schema documents you need to type 1 and press enter when the following is prompted.
Choose type of Metadata [1] XML Schema [1] WSDL [3] WS-Policy 1
4. Specify the Identifier. This is optional. You can skip it by just pressing enter.
5. The results will be printed on the Console.