Authenticating with a UDDI Server

Note: The Microsoft UDDI SDK is not supported by or included in Microsoft Windows versions after Microsoft Windows Server 7. The Microsoft UDDI V3 SDK is included with Microsoft BizTalk Server. For more information about the Microsoft UDDI V3 SDK, see Microsoft BizTalk Server documentation

This section contains information about how to handle authentication with a UDDI server.

The UddiConnection object supports two methods of authentication: Windows Integrated Authentication and UDDI Authentication.

Windows Integrated Authentication

Windows integrated authentication uses the credentials of the current user for publishing operations. This is the default form of authentication used by UDDI Services. Using Windows integrated authentication, the authentication handshake between the client and the UDDI server is automatic and does not require that a GetAuthToken request be sent.

Example Code

The following example shows you how to use the C# programming language to save a business to a UDDI server using Windows integrated authentication:

// Create a connection to a UDDI Server.
UddiConnection myConn = new UddiConnection(
         "http://mySite/uddi/inquire.asmx",
         "https://mySite/uddi/publish.asmx",
         "http://mySite/uddi/extension.asmx");

// Current Windows credentials will be used for the publish requests on the connection.

// Create an object to save a business.
SaveBusiness sb = new SaveBusiness(new BusinessEntity("Fabrikam"));

// Send the save business request.
BusinessDetail savedBiz = sb.Send(myConn);

UDDI Authentication

UDDI authentication requires that the username and password credentials be set before attempting any publishing operations. The AuthenticationMode property can either be set explicitly or it will be set implicitly when a username and password are provided in the constructor method of the UddiConnection object. By default, under the control of the AutoGetAuthToken property, the UDDI operation will automatically send a GetAuthToken request to retrieve an AuthToken that contains the authentication token. The authentication token will be stored in the AuthInfo property and used with each publish message on this connection. Also under the control of the AutoGetAuthToken property, the UDDI operation will automatically retrieve an updated authentication token.

If desired, the authentication token contained in the AuthInfo property for the connection can be overridden with a specific token on a per message basis.

Example Code

The following example shows you how to use the C# programming language to save a business to a UDDI server using UDDI authentication.

// Create a connection to the UDDI server. Replace the contoso.com placeholder URLs with your own UDDI server.
UddiConnection myConn = new UddiConnection(
"http://test.uddi.contoso.com/inquire",
"https://test.uddi.contoso.com/publish",
"http://test.uddi.contoso.com/extension.asmx");

// With UDDI Authentication publish operations require explicit authentication credentials.
string szUsername = null;
string szPassword = null;

// Insert code to retrieve the username and password securely.

myConn.AuthenticationMode = AuthenticationMode.UddiAuthentication;
myConn.Username = szUsername;
myConn.Password = szPassword;

// Create an object to save a business.
SaveBusiness sb = new SaveBusiness(new BusinessEntity("Fabrikam"));

// Send the save business request.
BusinessDetail savedBiz = sb.Send(myConn);

Example Code

The following example shows you how to use the C# programming language to save a business to a UDDI server using an alternate authentication token. The example also uses a constructor that will implicitly select UDDI authentication.

// Variables to hold the user's credentials
string szUsername = null;
string szPassword = null;

// Insert code to securely request the username and password.

// Create a connection to the UDDI server that is to be accessed.
UddiConnection myConn = new UddiConnection(
"http://test.uddi.contoso.com/inquire",
"https://test.uddi.contoso.com/publish",
"http://test.uddi.contoso.com/extension.asmx",
szUsername,
szPassword);

// Create an object to save a business.
SaveBusiness sb = new SaveBusiness(new BusinessEntity("Fabrikam"));

// Create variable to hold the AuthInfo token.
string szToken = null;

// Insert code to get the alternate AuthInfo token.


// Override the connections AuthInfo token for this request.
sb.AuthInfo = szToken;

// Send the save business request.
BusinessDetail savedBiz = sb.Send(myConn);

Send comments about this topic to Microsoft.