This post describes a series of Python scripts to convert FGDC XML metadata for WMS and WFS services to ISO 19139 service metadata via GeoNetwork's OGC harvest service. Here are the steps:

Extract WMS and WFS GetCapabilities URLs from FGDC XML metadata and write them to a file.

Create a GeoNetwork Harvest Node from extracted GetCapabilities URLs and let GeoNetwork's OGC WMS/WFS harvester create ISO 19139 metadata from GetCapabilities response. Note: the resulting ISO 19139 metadata is only as good as the one in the GetCapabilities response. In addition, GetCapabilities responses do not include all fields necessary for minimum ISO 19139 metadata.

Our goal is to have working WMS and WFS metadata records in our CSW catalog that can be used to add the described services to analytical software such as ESRI's C-SW Client for ArcGIS Desktop. Following are the reasons why I am currently choosing this convoluted process instead of a direct FGDC to ISO 19139 metadata conversion:

Harvesting the metadata from GetCapabilities responses ensures that the service actually exists and that the resulting ISO 19139 service metadata records conform to some convention - in this case GeoNetwork's.

The source FGDC XML metadata I am working with is sometimes not well formed and almost always not schema conform. More importantly, there seems no standardized vocabulary to describe OGC services in FGDC.

I have not seen any FGDC service metadata to ISO 19139 conversion efforts and my own FGDC XML dataset metadata records to ISO 191139 conversion experience was not very satisfying.

Create and execute GeoNetwork Harvest Node for WMS/WFS services

This script extracts OGC GetCapabilities URLS from file,
transforms them to GeoNetwork's Create OGC Harvest Node request,
executes the request, and runs the GeoNetwork GetCapabilities to ISO
19139 metadata harvest. This scripts reads in a file (OGC_GetCapabilities_URLs.txt) with an OGC service type/version key and a GetCapabilities URL value such as: