In this section: |
When the server accesses a RESTful Web Services provider, it needs to know how to pass parameters and accept responses for each REST request. In most RESTful Web Services, the Web Services provider documentation is used in determining the parameters to pass and the expected response. Therefore, the Create Synonym process sends a REST request including parameters to determine the response from the Web Service. A WADL (Web Application Description Language) file, which is in XML format, is sometimes used to define the request and response for each REST request.
How to: Reference: |
A synonym defines a unique logical name (also known as an alias) for each Web Services operation. Synonyms are useful because:
Creating a synonym generates a Master File and an Access File. These are metadata files that describe the Web Services request to the server.
Each synonym you create represents a single operation.
Note: Each synonym describes the Web Services operations of a particular provider. If the operation parameters are changed, the synonym must be recreated.
To create a synonym, you must have previously configured the adapter. You can create a synonym from the Applications or Adapters pages of the Web Console.
The Applications page opens.
The Select adapter to configure or Select connection to create synonym pane opens.
The first of a series of synonym creation panes opens.
The Status pane indicates that the synonym was created successfully.
The synonym is created and added under the specified application directory.
Note:
The following list describes the parameters for which you will need to supply values, and related tasks you will need to complete in order to create a synonym for the adapter. These options may appear on multiple panes. To advance from pane to pane, click the buttons provided, ending with the Create Synonym button, which generates the synonym based on your entries.
Select one of the following REST operations:
Is an extension to the Base URL used to perform specific functionality from the RESTful Web Service.
The Base URL is concatenated with the Service URL Extension at run time to make the REST request. This parameter must have a value. For example:
postalCodeSearch
Are the parameter name and value pairs that will be used in making a REST request in order to create metadata from the response.
The input parameter names will also be included in the metadata.
It is important to note that with certain RESTful Web Services, different parameters and/or parameter values could return a different structured response. Therefore, different synonyms should be created for each differently structured response. For example:
postalcode=9011&maxRows=10&username=demo
This parameter becomes visible only if Insert or Update is selected as the operation.
It is used in conjunction with the Service URL Parameters field by passing the Body portion of the REST request to create the metadata. The body can be made up of any combination of name-value pairs, XML, and JSON. For example:
IBIRS_action=put&object=<object _jt="IBFSUserObject" description="Rest Userid" email="restid@informationbuilders.com" password="rest" type="User"> <status _jt="IBSSUserStatus" name="ACTIVE"/> </object>&IBIRS_replace=true
Select the Validate check box if you wish to convert all special characters to underscores and perform a name check to prevent the use of reserved names. (This is accomplished by adding numbers to the names.) This parameter ensures that names adhere to specifications. See Validation for Special Characters and Reserved Words for more information.
When the Validate option is unchecked, only the following characters are converted to underscores: '-'; ' '; ' \'; '/'; ','; '$'. No checking is performed for names.
Select the Make unique check box if you wish to set the scope for field and group names to the entire synonym. This ensures that no duplicate names are used, even in different segments of the synonym. When this option is unchecked, the scope is the segment.
Enter a name to assign to the synonym.
Select an application directory. The default value is baseapp.
If you have tables with identical table names, assign a prefix or a suffix to distinguish them. For example, if you have identically named human resources and payroll tables, assign the prefix HR to distinguish the synonyms for the human resources tables. Note that the resulting synonym name cannot exceed 64 characters.
If all tables and views have unique names, leave the prefix and suffix fields blank.
To specify that this synonym should overwrite any earlier synonym with the same fully qualified name, select the Overwrite existing synonyms check box.
Note: The connected user must have operating system write privileges in order to recreate a synonym.
Once you have created a synonym, you can right-click the synonym name in the Adapter navigation pane of either the Web Console or the Data Management Console to access the following options.
Option |
Description |
---|---|
Open |
Opens the Master File for viewing and editing using a graphical interface. If an Access file is used it will be also available. |
Edit as Text |
Enables you to view and manually edit the Master File synonym. Note: To update the synonym, it is strongly recommended that you use the graphical interface provided by the Open option, rather than manually editing the Master File. |
Edit Access File as Text |
Enables you to view and manually edit the Access File synonym. Note: This option is available only when an Access File is created as part of the synonym. |
Sample Data |
Retrieves up to 20 rows from the associated data source. |
Data Profiling |
Data Profiling provides the data characteristics for synonym columns. Alphanumeric columns provide the count of distinct values, total count, maximum, minimum, average length, and number of nulls. Numeric columns provide the count of distinct values, total count, maximum, minimum, average value, and number of nulls. |
Refresh Synonym (if applicable) |
Regenerates the synonym. Use this option if the underlying object has been altered. |
Data Management |
Followed by these options, if applicable: Recreate DBMS Table. Recreates the data source table. You are asked to confirm this selection before the table is regenerated. (Note that the table will be dropped and recreated. During the process, data may be lost.) Delete All Data. Deletes all existing data. You are asked to confirm this selection before the data is deleted. Drop Table. Drops the table so that it is removed from the DBMS. Insert Sample Data. Inserts specified number of sample records, populating all fields with counter values. Show/Modify Data. Opens a window that shows the data in the data source with buttons you can click to insert values, filter values, reload the data source, and customize the view. Reorganize. Recreates the data source table preserving original data. Note: This option is not available in the Web Console. |
Impact Analysis |
Generates a report showing where this synonym is stored and used, with links to the synonym instances. Impact Analysis reports enable you to evaluate changes before they are made by showing which components will be affected. See the Server Administration manual for details about Impact Analysis reports. |
Dependencies Analysis |
Generates a report showing information about the synonym and other synonyms and objects that are referenced within it. |
Copy |
Copies the synonym to the clipboard. |
Delete |
Deletes the synonym. You are asked to confirm this selection before the synonym is deleted. |
Cut |
Deletes the synonym and places it on the clipboard. |
Privileges |
Shows the security subjects on the server and the privileges they have to this synonym. |
Properties |
Displays the properties of the synonym, including physical location, last modified date, description, and privileges. |
Attribute |
Description |
---|---|
PROPERTY |
Indicates whether the field corresponds to an XML attribute or an XML element. |
REFERENCE |
Identifies the parent element of the field in the XML hierarchy, as defined by the Web Services XML schema document. The format is segmentname.fieldname where:
|
Attribute |
Description |
---|---|
SEGNAME |
Value must be identical to the SEGNAME value in the Master File. |
CONNECTION |
Indicates a previously declared connection. The syntax is: CONNECTION=connection
|
OBJECT |
Service URL Extension as defined during the Create Synonym process. |
HEADER |
The GROUP name in the Master File that defines the parameters for the REST request. |
SERVICETYPE |
The Service Type which will always be REST. |
HTTPMETHOD |
The HTTP method used in the REST request, for example, GET or POST. |
RESTRESPONSE |
The type of response returned from the REST request. Valid values are XML or JSON. |
HTTPBODY |
If HTTPMETHOD=POST, setting HTTPBODY=ENCODE will encode the body of the request. |
The following synonym was generated using the following connection and synonym creation parameters:
http//api.geonames.org
The base URL is entered on the Add Connection page.
The remaining entries are on the Create Synonym page.
Select Get.
Enter the following parameters:
postalcode=10121&country=US&maxRows=10&username=demo
Enter postalCodeSearch.
In addition, check the Validate and Make Unique check boxes, then click Create Synonym.
postalCodeSearch Master File
FILENAME=M6ILO, SUFFIX=REST , $ SEGMENT=M6ILO, SEGTYPE=S0, $ GROUP=HEADER, ALIAS=Header, ELEMENTS=4, $ FIELDNAME=POSTALCODE, ALIAS=postalcode, USAGE=A30, ACTUAL=A30, ACCESS_PROPERTY=(NEED_VALUE), XDEFAULT='10121', $ FIELDNAME=COUNTRY, ALIAS=country, USAGE=A30, ACTUAL=A30, ACCESS_PROPERTY=(NEED_VALUE), XDEFAULT='US', $ FIELDNAME=MAXROWS, ALIAS=maxRows, USAGE=A30, ACTUAL=A30, ACCESS_PROPERTY=(NEED_VALUE), XDEFAULT='10', $ FIELDNAME=USERNAME, ALIAS=username, USAGE=A30, ACTUAL=A30, ACCESS_PROPERTY=(NEED_VALUE), XDEFAULT='demo', $ FIELDNAME=__RESPONSE, USAGE=TX80L, ACTUAL=TX, ACCESS_PROPERTY=(INTERNAL), $ SEGMENT=RESPONSE, SEGTYPE=S0, SEGSUF=XML , PARENT=M6ILO, POSITION=__RESPONSE, $ FIELDNAME=GEONAMES, ALIAS=geonames, USAGE=A1, ACTUAL=A1, ACCESS_PROPERTY=(INTERNAL), PROPERTY=ELEMENT, $ FIELDNAME=TOTALRESULTSCOUNT, ALIAS=totalResultsCount, USAGE=P33, ACTUAL=A33, REFERENCE=GEONAMES, PROPERTY=ELEMENT, $ FIELDNAME=CODE, ALIAS=code, USAGE=A1, ACTUAL=A1, ACCESS_PROPERTY=(INTERNAL), REFERENCE=GEONAMES, PROPERTY=ELEMENT, $ FIELDNAME=POSTALCODE1, ALIAS=postalcode, USAGE=P33, ACTUAL=A33, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=NAME, ALIAS=name, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=COUNTRYCODE, ALIAS=countryCode, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=LAT, ALIAS=lat, USAGE=P20.3, ACTUAL=A20, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=LNG, ALIAS=lng, USAGE=P20.3, ACTUAL=A20, REFERENCE=CODE, PROPERTY=ELEMENT, $
FIELDNAME=ADMINCODE1, ALIAS=adminCode1, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=ADMINNAME1, ALIAS=adminName1, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=ADMINCODE2, ALIAS=adminCode2, USAGE=P33, ACTUAL=A33, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=ADMINNAME2, ALIAS=adminName2, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=ADMINCODE3, ALIAS=adminCode3, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $ FIELDNAME=ADMINNAME3, ALIAS=adminName3, USAGE=A55, ACTUAL=A55, REFERENCE=CODE, PROPERTY=ELEMENT, $
postalCodeSearch Access File
SEGNAME=M6ILO, CONNECTION=geonames, OBJECT=postalCodeSearch, HEADER=HEADER, SERVICETYPE=REST, HTTPMETHOD=GET, RESTRESPONSE=XML, $
WebFOCUS |