Using the ServiceModel Metadata Utility Tool with the BizTalk Adapter for Oracle Database. 4 minutes to read.In this articleYou can use the ServiceModel Metadata Utility Tool (svcutil.exe) to generate a WCF client class or a WCF service contract (interface) for operations that the Microsoft BizTalk Adapter for Oracle Database exposes.
![]()
After you run svcutil.exe to generate either a WCF client class or a WCF service contract, you can include the generated file in your code and create instances of the generated class or implement a WCF service from the contract to perform operations on the Oracle database.Using svcutil.exe requires you to supply a connection URI that contains credentials. Because, by default, the Oracle Database adapter disables credentials in the connection URI, you must configure svcutil.exe to use a non-default binding for the Oracle Database adapter.The following sections show you how to configure svcutil.exe and how to use svcutil.exe to generate WCF client code or a WCF service contract with the Oracle Database adapter. Configure svcutil.exe for a non-default bindingTo configure svcutil.exe to use a non-default binding, you must create a local copy of svcutil.exe and then create or modify a local copy of the svcutil.exe.config configuration file.Create a folder, and copy svcutil.exe into the new folder. You can typically find svcutil.exe at the Windows SDK installation location, specifically, C:Program FilesMicrosoft SDKsWindowsv6.0Bin.Create a file named svcutil.exe.config in the new folder.Add a binding and a client endpoint to the svcutil.exe.config file. You must run svcutil.exe from the new folder to ensure that the correct configuration is used. ImportantThe name attribute of the client endpoint must specify the scheme used in the connection URI. This value is case-sensitive.
NoteYou can set any of the binding properties of the Oracle Database adapter in the binding configuration.For more information about configuring a non-default binding for svcutil.exe, see the 'Custom Secure Metadata Endpoint' topic in the WCF documentation at. Configure a Non-Default Binding for the POLLINGSTMT OperationTo use svcutil.exe to create a WCF service contract for the POLLINGSTMT operation, you must configure the non-default binding to include the pollingStatement property, in addition to acceptCredentialsInUri. The pollingStatement must contain the SELECT statement that targets the table. The Oracle Database adapter uses this property to generate the class that represents the strongly-typed result set that the POLLINGSTMT operation returns.
This MobileSdkGen tool can create both Java (Android) and Objective-C (iOS) output files. Since this tool is written as a.NET application, you will need a development computer running.NET Framework 4.0 or later to build the tool from the provided source code. This tool is similar to the CrmSvcUtil tool provided in the.NET version of the CRM SDK.
The following example shows a binding configuration that is used to generate a WCF service contract for a POLLINGSTMT operation that targets the /SCOTT/EMP table. Create a WCF Client Class or WCF Service Contract with svcutil.exeTo use svcutil.exe to generate WCF client code or a WCF service contract (interface) for the Oracle Database adapter, you must supply a connection URI that specifies an WS-Metadata Exchange (MEX) endpoint and the operation or operations for which you want svcutil.exe to generate code. You must also specify connection credentials for the Oracle database in the connection URI.
NoteBefore you can use svcutil.exe with the Oracle Database adapter, you must configure it to use a non-default binding; for information about how to do this, see.You specify a MEX endpoint and target operations in the Oracle Database adapter connection URI in the following manner:.You must include the 'wsdl' parameter in the querystring. If it is the first parameter in the querystring, it is specified just after the question mark (?). If it is not the first parameter, it should be preceded with an ampersand (&).You must follow the 'wsdl' parameter by one or more 'op' parameters. Each 'op' parameter is preceded by an ampersand (&) and specifies the node ID of a target operation.The following three examples show how to target various operations by using svcutil.exe.This example creates a WCF client class for an Insert operation on the /SCOTT/EMP table.svcutil 'oracledb://User=SCOTT;Password=TIGER@ADAPTER?wsdl&op=example creates a WCF client class for the Insert and the Delete operations on the /SCOTT/EMP table.svcutil 'oracledb://User=SCOTT;Password=TIGER@ADAPTER?wsdl&op=example creates a WCF service contract for the POLLLINGSTMT operation.
(To use svcutil.exe to generate a WCF service contract for the POLLINGSTMT operation, you must configure a non-default binding for svcutil.exe that includes a polling statement.).svcutil 'oracledb://User=SCOTT;Password=TIGER@ADAPTER?wsdl&op=http://Microsoft.LobServices.OracleDB/2007/03/POLLINGSTMT'. ImportantYou must place the connection URI in quotation marks on the command line. Otherwise, svcutil.exe attempts to retrieve metadata for operations that the Oracle Database adapter does not support. The results of such an attempt are undefined.By default, svcutil.exe places the generated code in the output.cs file; however, you can change the name of the output file and many other options that svcutil.exe uses by setting command-line switches. For more information about the options that svcutil.exe supports, see the 'ServiceModel Metadata Utility Tool (Svcutil.exe)' topic in the WCF documentation at.Svcutil.exe does not provide the capability to search for operations (for example, by using wildcard characters).
You must explicitly specify node IDs for the specific operations you want to target. You cannot specify node IDs that refer only to categories. For more information about the node IDs that the Oracle Database adapter surfaces, see.The Add Adapter Service Reference Visual Studio Plug-in provides advanced browse and search capabilities that can greatly simplify generating a WCF client class and WCF service contract. For more information about the Add Adapter Service Reference Plug-in, see. See AlsoRelated Articles.
155-4627-b722-d6cedb9fa8c6How to: Use Svcutil.exe to Download Metadata DocumentsYou can use Svcutil.exe to download metadata from running services and to save the metadata to local files. For HTTP and HTTPS URL schemes, Svcutil.exe attempts to retrieve metadata using WS-MetadataExchange. For all other URL schemes, Svcutil.exe uses only WS-MetadataExchange.By default, Svcutil.exe uses the bindings defined in the xref:System.ServiceModel.Description.MetadataExchangeBindings class. To configure the binding used for WS-MetadataExchange, you must define a client endpoint in the configuration file for Svcutil.exe (svcutil.exe.config) that uses the IMetadataExchange contract and that has the same name as the Uniform Resource Identifier (URI) scheme of the metadata endpoint address.!CAUTIONWhen running Svcutil.exe to get metadata for a service that exposes two different service contracts that each contain an operation of the same name, Svcutil.exe displays an error saying, 'Cannot obtain Metadata from.' For example, if you have a service that exposes a service contract called ICarService that has an operation Get(Car c) and the same service exposes a service contract called IBookService that has an operation Get(Book b). To work around this issue, do one of the following:.
![]()
Rename one of the operations. Set the xref:System.ServiceModel.OperationContractAttribute.Name%2A to a different name. Set one of the operations' namespaces to a different namespace using the xref:System.ServiceModel.ServiceContractAttribute.Namespace%2A property.To download metadata using Svcutil.exe.Locate the Svcutil.exe tool at the following location:C:Program FilesMicrosoft SDKsWindowsv1.0.bin.At the command prompt, launch the tool using the following format. Svcutil.exe /t:metadata. You must specify the /t:metadata option to download metadata. Otherwise, client code and configuration are generated.The argument specifies the URL to a service endpoint that provides metadata or to a metadata document hosted online. The argument specifies the path to an XML file that contains a WS-Addressing EndpointAddress for a service endpoint that supports WS-MetadataExchange.For more options about using this tool for metadata download, see.
ExampleThe following command downloads metadata documents from a running service.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |