One moment please...
 
Exact Globe+   
 

How-to: Consuming Exact Globe Next entity metadata services

Introduction

The metadata service is used to retrieve information regarding entities. The information about the entities includes the list of the entities that are exposed through the service, their properties, and the data values contained in these properties. For more information on Exact Globe Next entity services, see Exact Globe entity services startpage.

To consume the metadata services, you can use Exact.Services.Client wrapper DLL, which handles most of the binding and serialization protocols and data formats for the service. You can either reference it from the bin folder (located at the installation directory of Exact Globe Next) or copy it to the project folder.

Note: When you are copying Exact.Services.Client wrapper DLL to the project folder, it is recommended that you copy it to the base project folder, as the contents of the bin folder will be erased after a rebuild or clean up in the system.

Description

This document gives you the step-by-step procedure for obtaining metadata on specific entities using Exact Globe Next entity metadata services.

  1. Open Microsoft Visual Studio 2008.
  2. Create a project with the following information:
    • Project type: Windows
    • Templates: Windows Forms Application
    • Name: TestServiceClientMetadata
  3. Create the following references:
    • Exact.Services.Client.dll
      Note: You can find this file under the bin sub folder of the Exact Globe Next installation folder. For example, C:\Program Files (x86)\Exact Software\bin.
    • System.Runtime.Serialization.dll
    • System.ServiceModel.dll

The references that are created are shown in the following screen:

Defining entities using metadata class

The service binding is exposed through the Exact.Services.Client.Metadata.MetadataEG class. The existing entities are defined as Exact.Services.Client.Metadata.DefinedEntity and the details specific to an entity is defined as Exact.Services.Client.Metadata.MetadataEntity.

Private metaClient As Exact.Services.Client.Metadata.MetadataEG

Private exposedEntities() As Exact.Services.Client.Metadata.DefinedEntity

Private metaEntity As Exact.Services.Client.Metadata.MetadataEntity

Private metadataKeyProperty As String

Defining metadata instances

To instance the service binding, the service URI must be provided to the MetadataEG constructor. Currently, the entity services are exposed as self-hosted web services under the services virtual folder of the machine. The port number can be either “8000” or “8010”, depending on the Exact Globe Next and Exact Synergy Enterprise installation types. As the metadata services do not depend on any database, you do not need to provide any SQL server name or database name to operate.

Private Function ConnectMetaData() As Boolean

Dim serviceURL As String

Dim portNumber As String = portNumberTextBox.Text

If portNumber.Trim().Length = 0 Then

portNumber = "8010"

portNumberTextBox.Text = "8010"

End If

If Not IsNumeric(portNumber) Then

ErrorProvider1.SetError(portNumberTextBox, "Port: Must be: Number.")

Return False

End If

  If serviceLocationTextBox.Text.Trim().Length = 0 Then

serviceLocationTextBox.Text = "localhost"

serviceURL = String.Format("http://{0}:{1}/services", "localhost", portNumber)

Else

serviceURL = String.Format("http://{0}:{1}/services", serviceLocationTextBox.Text, portNumber)

End If

Try

metaClient = New Exact.Services.Client.Metadata.MetadataEG(serviceURL)

Catch ex As Exception

MessageBox.Show("Exception occurred trying to open meta data: " & ex.Message)

Return False

End Try

Return True

Retrieving entity details using metadata instances

The MetadataEG instance can be used to retrieve all the available entities and also the metadata of specific entities.

The available entities can be retrieved using the method DefinedEntities, as shown in the following:

exposedEntities = metaClient.DefinedEntities()

The details of a specific entity can be retrieved using the method Retrieve, as shown in the following:

Private Function RetrieveMetadata(ByVal entityName As String, ByRef keyProperty As String) As Boolean

keyProperty = ""

If entityName.Length = 0 Then

Return False

End If

If metaClient Is Nothing Then

If Not ConnectMetaData() Then

Return False

End If

End If

Try

metaEntity = metaClient.Retrieve(entityName)

Catch ex As Exception

MessageBox.Show("Exception occurred reading meta data: " & ex.Message)

Return Nothing

End Try

keyProperty = metaEntity.Interface.KeyProperty

Return True

End Function

Note: The contents of MetadataEntity.Interface.Properties can be parsed to define their expected data values.

Related documents

 

     
 Main Category: Support Product Know How  Document Type: Online help main
 Category: On-line help files  Security  level: All - 0
 Sub category: Details  Document ID: 19.530.677
 Assortment:  Date: 26-09-2022
 Release:  Attachment:
 Disclaimer

Attachments
How-to-Consuming Exact Globe Next entity metadata services.docx 278.3 KB View Download