Using UDDI v3 from C#

Microsoft support for UDDI seems to have disappeared of late - just try tracking down anything on MSDN and you will see what I mean from all the 404's and mis-leading information you will stumble across.

UDDI is a really useful part of any SOA, and the Oracle Service Registry contained within the Oracle SOA suite (version 10.1.3) supports version 1, 2 and 3 of the specification (by the way installation of the Oracle Service Registry is not the easiest thing you will ever do).  The easiest version of the spec to implement in .NET is the version 3.

Firstly download the WSDl and supporting schema from http://uddi.xml.org.

http://uddi.org/schema/uddi_v3.xsd
http://uddi.org/wsdl/uddi_api_v3_binding.wsdl
http://uddi.org/wsdl/uddi_api_v3_portType.wsdl

download additional supporting schema from http://www.w3.org

http://www.w3.org/2001/xml.xsd
http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd

saving to the same location.

Technorati Tags: ,

Edit xmldsig-core-schema.xsd and comment out the doctype definition - as this declaration makes svcutil barf as described in http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3065329&SiteID=1).

Generate the service proxy using svcutil, making sure to reference all required WSDL and schema.

svcutil /t:code /out:svcuti.cs uddi_api_v3_binding.wsdl uddi_api_v3_portType.wsdl uddi_v3.xsd xml.xsd xmldsig-core-schema.xsd

You will need to amend the svcutil generated config to include the endpoint for the UDDI service (just add the address attribute to the endpoint config). Then you can use the proxy to access the registry.

UDDI_Inquiry_PortTypeClient proxy = new UDDI_Inquiry_PortTypeClient("UDDI_Inquiry_SoapBinding_UDDI_Inquiry_PortType");
 
find_binding fb = new find_binding();
fb.serviceKey = "uddi:systinet.com:uddi:service:v3_inquiry";
 
bindingDetail detail = proxy.find_binding(fb);
foreach (bindingTemplate template in detail.bindingTemplate)
{
   accessPoint ap = template.Item as accessPoint;
   Console.WriteLine(ap.Value);
}

The sample code defines a simple search based on the defined key of a registered service (in this case "uddi:systinet.com:uddi:service:v3_inquiry" which is a key of the UDDI inquiry service as registered in the sample data from the Oracle Service Registry install). The code then enumerates the endpoint address for each registered endpoint listed within the returned binding detail.

For more information on the use of UDDI API read http://www.uddi.org/pubs/uddi_v3.htm

Comments are closed