- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Generating Metadata from a Compiled Assembly in .NET
Generating Metadata from a Compiled Assembly QR Code Creator In Visual Studio .NET Using Barcode generation for VS .NET Control to generate, create QR Code image in Visual Studio .NET applications. www.OnBarcode.comDecoding QR In .NET Framework Using Barcode recognizer for .NET framework Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comLet s see how we can use the SoapSuds utility to generate a proxy for RemoteCompo nents.dll: Barcode Encoder In .NET Using Barcode creator for .NET framework Control to generate, create bar code image in .NET applications. www.OnBarcode.comRecognize Bar Code In .NET Using Barcode recognizer for .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comSOAPSUDS /ia:remotecomponents /oa:metadata.dll /nowp
Encoding Quick Response Code In Visual C# Using Barcode creator for .NET framework Control to generate, create Quick Response Code image in VS .NET applications. www.OnBarcode.comPainting QR Code In VS .NET Using Barcode creator for ASP.NET Control to generate, create QR-Code image in ASP.NET applications. www.OnBarcode.comThe /ia (Input Assembly) option must be followed by the name of the assembly without the .exe or .dll, whereas the /oa (Output Assembly) option specifies the complete name of the metadata-only assembly you want to create. The /nowp (No Wrapped Proxy) tells SoapSuds to include only the metadata instead of generating a wrapped proxy. (Read on for more information about wrapped proxies.) You can also sign the assembly with a strong name, by using the /sn option: Drawing QR Code ISO/IEC18004 In VB.NET Using Barcode generator for .NET Control to generate, create QR-Code image in VS .NET applications. www.OnBarcode.comMatrix 2D Barcode Creation In .NET Framework Using Barcode generation for Visual Studio .NET Control to generate, create Matrix Barcode image in VS .NET applications. www.OnBarcode.comSOAPSUDS /ia:remotecomponents /oa:metadata.dll /nowp /sn:mykeyfile.snk
Encode PDF-417 2d Barcode In .NET Using Barcode maker for VS .NET Control to generate, create PDF 417 image in VS .NET applications. www.OnBarcode.comEAN / UCC - 14 Maker In .NET Framework Using Barcode generation for .NET Control to generate, create USS-128 image in Visual Studio .NET applications. www.OnBarcode.comIf you explore the new metadata.dll assembly with ILDASM, you ll see that it contains all the classes and methods in RemoteComponents.dll, but method bodies contain only a minimum amount of code. For all practical purposes, the proxy.dll exposes only metadata. Open the client application with Visual Studio .NET, remove the reference to RemoteComponents.dll, and add a reference to the new metadata.dll. Because the old and the Generate UCC - 12 In VS .NET Using Barcode creation for .NET Control to generate, create UPC Symbol image in .NET framework applications. www.OnBarcode.comCode 2/5 Creator In VS .NET Using Barcode generation for VS .NET Control to generate, create Code 2 of 5 image in .NET applications. www.OnBarcode.com 32: QR Code Printer In Java Using Barcode printer for BIRT Control to generate, create QR Code JIS X 0510 image in Eclipse BIRT applications. www.OnBarcode.comCreating DataMatrix In None Using Barcode encoder for Font Control to generate, create ECC200 image in Font applications. www.OnBarcode.comRemoting
Data Matrix ECC200 Creation In Java Using Barcode encoder for Android Control to generate, create Data Matrix image in Android applications. www.OnBarcode.comPrinting Code-39 In Java Using Barcode generator for Java Control to generate, create ANSI/AIM Code 39 image in Java applications. www.OnBarcode.comnew assembly expose classes with the same name (including the namespace) and the same methods, the client application will recompile flawlessly. What happens when you run the program, however, depends on whether the client application registers the remote object programmatically or by means of a configura tion file. If you register the remote type programmatically, you don t have to change anything in the client application to have it work with the remote object. In this case, in fact, the client contains a block of code like this: PDF 417 Creation In Java Using Barcode generation for BIRT Control to generate, create PDF 417 image in BIRT reports applications. www.OnBarcode.comGenerating Universal Product Code Version A In None Using Barcode maker for Software Control to generate, create UPC Code image in Software applications. www.OnBarcode.comDim url As String = tcp://localhost:50000/calculator.rem" UCC.EAN - 128 Generator In Java Using Barcode creator for Java Control to generate, create EAN / UCC - 14 image in Java applications. www.OnBarcode.comScan PDF 417 In Java Using Barcode decoder for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comRemotingConfiguration.RegisterWellKnownClientType(GetType(Calculator), url) Dim calc As New Calculator
The Calculator class is now the one defined in metadata.dll; therefore, the type passed to the RegisterWellKnownClientType method and the type passed to the New keyword match perfectly. If the client application registers the object via a configuration file, you must adjust the identity of the assembly containing the type that is to be requested to the remote server. For example, if the configuration file is <client> <wellknown type="RemoteComponents.Calculator, RemoteComponents url="tcp://localhost:50000/Calculator.rem /> </client> you must edit it as follows to have it work with the SoapSuds-generated assembly: <client> <wellknown type="RemoteComponents.Calculator, Metadata url="tcp://localhost:50000/Calculator.rem /> </client> After this edit, the client application will work correctly.
Generating Metadata from a Running Server
When you expose a remote object through an HTTP channel, the .NET remoting archi tecture can intercept requests at the object s URL and react accordingly. If you append WSDL to the object s URL, the .NET Framework responds by sending you a block of XML text that defines the object. You can prove this easily by launching Internet Explorer and typing this URL in its Address field (after starting the host application if necessary): http://localhost:50000/Calculator.rem wsdl
The XML text returned to the browser is in the same format as the WSDL document that Web services expose. (See Figure 32-7.) The SoapSuds utility can use this WSDL docu ment to generate a metadata-only assembly from a type that is exposed by a remote Part VII: Advanced Topics
server, even if you don t have the original compiled DLL at hand. This feature is espe cially useful if you expose a remote object on your Internet Web site and want to give remote clients the ability to use it. Figure 32-7 The WSDL contract that describes the metadata of a remote object
When using SoapSuds to generate the metadata for a remote assembly, you specify the /url option instead of the /ia option: SOAPSUDS /url:http://localhost:50000/Calculator.rem wsdl /oa:metadata.dll /nowp
Check the .NET Framework documentation for more information about other options you can use with SoapSuds for example, the /domain, /username, and /password options that are necessary when accessing a server that requires authentication, or the /httpproxyname and /httpproxyport options that you must use when accessing a remote system through a proxy server. Generating a Wrapped Proxy
The two examples illustrated in the previous sections used the /nowp option to tell SoapSuds not to generate a wrapped proxy. A wrapped proxy is a local class that the client application can use in lieu of the remote class, because all its methods and prop erties automatically dispatch the call to the remote object. Here s how you can generate a wrapped proxy for an object at a given URL:
|
|