De-Serializing Classes containing Synergy Types
January 11, 2012CodeGen Goes Open Source
May 22, 2012Apparently there are some people actually reading this BLOG!!! And … it turns out that quite a few of them have been working through my earlier series of posts related to using WCF. Excellent!
It occurred to me that since I wrote the last of those articles we have had a release of a new version, namely Synergy/DE 9.5.3. And that new version included some important new functionality related to consuming WCF services in Synergy .NET applications.
In previous posts I had to talk about the fact that “Add Service Reference” was not implemented in Synergy .NET, and I demonstrated how you could use the svcutil.exe command line utility to generate client proxy code and configuration information, both of which could then be manually added to a Synergy .NET project.
Good news … in 9.5.3 the Add Service Reference wizard has been implemented in all Synergy project types. I’m not going to go into great detail about how to use this new functionality … because it’s exactly the same as in C# and VB projects, and pretty well documented elsewhere. But briefly, in a Synergy .NET project:
1. Right-click on the project in solution explorer and select “Add Service Reference”.
2. Enter the URI of your service and click the “Go” button … or … if the service is in the same solution, click the “Discover” button.
3. Enter the name of the namespace that you wish the generated proxy classes to be placed in.
4. Optionally click the “Advanced…” button and select advanced options. For example, it is common to set “Collection Type” to something a little nicer than System.Array, and very often you’ll want to enable “Generate asynchronous operations” in order to help you build responsive and flexible applications.
5. Finally click the “OK” button in the first dialog to generate the service reference within your project.
When you add a service reference to a project, several things happen:
- The svcutil.exe utility is used to download the WSDL information from the service, and to generate client proxy classes for the service based on the content of the WSDL.
- The resulting generated files are added into the project. By default these files are hidden beneath a single node in Solution explorer which represents the service reference, but you can look at all of the files by enabling the “Show All Files” option in solution explorer.
- Depending on the type of project you are working in, references to several additional assemblies may be added. These referenced assemblies can include System.Runtime.Serialization, System.ServiceModel, and System.Xml.
So … finally … no more manual use of svcutil.exe is required in order to consume WCF services Synergy .NET applications. Thanks development.