Communicating with the SAS Metadata Server

The SAS Open Metadata Interface supports two ways to submit requests to the SAS Metadata Server—the standard interface and the DoRequest interface.

Standard Interface

A request is submitted by declaring object variables that represent the method’s parameters in the client, and then referencing the object variables in the method request. In this documentation, we refer to this way to submit requests as the “standard interface.” The standard interface is supported for the SAS Java Metadata Interface and all of the SAS Open Metadata Interface server interfaces.
When you submit a request using the standard interface, the SAS Metadata Server does not require you to use the published parameter names for the object variables. However, if you use different parameter names, the names in the object variable declarations must also be used to represent the method’s parameters in the method request. For example, consider the GetMetadata method.
In the standard interface, a GetMetadata request is submitted as follows:
inMetadata= "<PhysicalTable Id="A5345678.A5000001" Name="" Desc="">
                           <Columns/>
                          </PhysicalTable>";
ns="SAS";
flags=0;
options="";

rc=GetMetadata(inMetadata, outMetadata, ns, flags, options);
You do not have to use the parameter names INMETADATA, OUTMETADATA, NS, FLAGS, and OPTIONS in the object variable declarations. However, the same names that you use in the object variable declarations must be used in the method syntax. The names must be specified in the order in which they are presented in the method’s documentation.

DoRequest Interface

The SAS Open Metadata Interface IOMI server interface and the Status method from the IServer server interface can be submitted to the SAS Metadata Server using the DoRequest interface. The DoRequest interface is based on the IOMI DoRequest method. The DoRequest method is a messaging method whose sole purpose is to submit another method to the SAS Metadata Server. A client declares object variables for the DoRequest method's parameters in the client. Then, the client submits another method in the DoRequest method's INMETADATA parameter. This other method's parameters are formatted in an XML string. For example, consider the GetMetadata method from the previous example, reformatted for the DoRequest method:
outMetadata=" ";
inMetadata="<GetMetadata>
 <Metadata>
   <PhysicalTable Id="A5345678.A5000001" Name="" Desc="">
     <Columns/>
   </PhysicalTable>
 </Metadata>
 <NS>SAS</NS>
 <Flags>0</Flags>
 <Options/>
</GetMetadata>";

rc=DoRequest(inMetadata,outMetadata);
The DoRequest interface provides a standard way for a client to submit method requests to the SAS Metadata Server. Instead of the client parsing the submitted method's parameters, the SAS Metadata Server parses them. The format of the XML string is described in DoRequest. The IOMI reference documentation includes examples of how to format each method for the DoRequest interface.
Because we recommend the SAS Java Metadata Interface to read and write metadata (instead of using the IOMI server interface directly), a Java client would not use the DoRequest interface. However, PROC METADATA accepts IOMI methods that are formatted for the DoRequest method's INMETADATA parameter as its input. For an example of how to submit, from PROC METADATA, an XML string that is formatted for the DoRequest method, see PROC METADATA documentation in SAS Language Interfaces to Metadata.
When creating an XML string for the DoRequest method or PROC METADATA, you must use published parameter names in the XML elements to represent the method parameters (<NS>, <FLAGS>, <OPTIONS>), with one exception. The submitted method's INMETADATA parameter should be represented by a <METADATA> element, as shown in the example. The method parameters do not need to be specified in the order in which they are presented in the syntax.