Chapter 2. Using the Metadata Service to Share XML Artifacts

In this chapter we will cover:

  • Creating a file-based MDS repository for JDeveloper
  • Creating Mediator using a WSDL in MDS
  • Creating Mediator that subscribes to EDL in MDS
  • Creating an external reference using a WSDL in MDS
  • Referencing Schematron in MDS for validation
  • Referencing a fault policy deployed to MDS
  • Deploying MDS artifacts to the SOA infrastructure
  • Exporting an MDS partition to the filesystem
  • Deleting XML artifacts from SOA infra MDS

Introduction

The WSDL of a web service is made up of the following XML artifacts:

  • WSDL Definition: It defines the various operations that constitute a service, their input and output parameters, and the protocols (bindings) they support.
  • XML Schema Definition (XSD): It is either embedded within the WSDL definition or referenced as a standalone component; this defines the XML elements and types that constitute the input and output parameters.

To better facilitate the exchange of data between services, as well as achieve better interoperability and re-usability, it is good practice to define a common set of XML Schemas, often referred to as the canonical data model, which can be referenced by multiple services (or WSDL Definitions).

This means, we will need to share the same XML schema across multiple composites. While typically a service (or WSDL) will only be implemented by a single composite, it will often be invoked by multiple composites; so the corresponding WSDL will be shared across multiple composites.

Within JDeveloper, the default behavior, when referencing a predefined schema or WSDL, is for it to add a copy of the file to our SOA project.

However, if we have several composites, each referencing their own local copy of the same WSDL or XML schema, then every time that we need to change either the schema or WSDL, we will be required to update every copy.

This can be a time-consuming and error-prone approach; a better approach is to have a single copy of each WSDL and schema that is referenced by all composites.

The SOA infrastructure incorporates a Metadata Service (MDS), which allows us to create a library of XML artifacts that we can share across SOA composites. MDS supports two types of repositories:

  • File-based repository: This is quicker and easier to set up, and so is typically used as the design-time MDS by JDeveloper.
  • Database repository: It is installed as part of the SOA infrastructure. This is used at runtime by the SOA infrastructure.

As you move projects from one environment to another (for example, from test to production), you must typically modify several environment-specific values embedded within your composites, such as the location of a schema or the endpoint of a referenced web service. By placing all this information within the XML artifacts deployed to MDS, you can make your composites completely agnostic of the environment they are to be deployed to.

The other advantage of placing all your referenced artifacts in MDS is that it removes any direct dependencies between composites, which means that they can be deployed and started in any order (once you have deployed the artifacts to MDS).

In addition, an SOA composite leverages many other XML artifacts, such as fault policies, XSLT Transformations, EDLs for event EDN event definitions, and Schematrons for validation, each of which may need to be shared across multiple composites. These can also be shared between composites by placing them in MDS.

Defining a project structure

Before placing all our XML artifacts into MDS, we need to define a standard file structure for our XML library. This allows us to ensure that if any XML artifact within our XML library needs to reference another XML artifact (for example a WSDL importing a schema), it can do so via a relative reference; in other words, the XML artifact doesn't include any reference to MDS and is portable. This has a number of benefits, including:

  • OSB compatibility; the same schemas and WSDLs can be deployed to the Oracle Service Bus without modification
  • Third-party tool compatibility; often we will use a variety of tools that have no knowledge of MDS to create/edit XML schemas, WSDLs, and so on (for example XML Spy, Oxygen)

In this chapter, we will assume that we have defined the following directory structure under our <src> directory.

Defining a project structure

Under the xmllib folder, we have defined multiple <solution> directories, where a solution (or project) is made up of one or more related composite applications. This allows each solution to maintain its XML artifacts independently.

However, it is also likely that there will be a number of XML artifacts that need to be shared between different solutions (for example, the canonical data model for the organization), which in this example would go under <core>.

Where we have XML artifacts shared between multiple solutions, appropriate governance is required to manage the changes to these artifacts.

Note

For the purpose of this chapter, the directory structure is over simplified. In reality, a more comprehensive structure should be defined as part of the naming and deployment standards for your SOA Reference Architecture.

The other consideration here is versioning; over time it is likely that multiple versions of the same schema, WSDL and so on, will require to be deployed side by side. To support this, we typically recommend appending the version number to the filename.

We would also recommend that you place this under some form of version control, as it makes it far simpler to ensure that everyone is using an up-to-date version of the XML library. For the purpose of this chapter, we will assume that you are using Subversion.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.101.81