Exposing WCF Services using xfNetLink .NET
✕
  • Solutions
    • Legacy Application Modernization
    • Modern UI/UX
    • Data Visibility
    • Enterprise Application Integration
    • Development Environment Optimization
    • Cloud Migration
    • Security
    • High Availability and Resilience
  • Products
    • Language
    • Development Environment
    • Connectivity and Open-Source Tools
    • Release Strategy
    • Roadmap
  • Services and Support
    • Professional Services Group
    • Developer Support
    • Application Support
  • Learning
    • Conference
    • SynergexU
    • Education Library
    • Blog
    • Synergy-e-News
  • Company
    • Leadership
    • Careers
    • Contact
  • +1-916-635-7300
  • Get Support
  • Documentation
  • Resource Center
✕
            No results See all results
            Exposing WCF Services using xfNetLink .NET
            • Solutions
              • Legacy Application Modernization
              • Modern UI/UX
              • Data Visibility
              • Enterprise Application Integration
              • Development Environment Optimization
              • Cloud Migration
              • Security
              • High Availability and Resilience
            • Products
              • Language
              • Development Environment
              • Connectivity and Open-Source Tools
              • Release Strategy
              • Roadmap
            • Services and Support
              • Professional Services Group
              • Developer Support
              • Application Support
            • Learning
              • Conference
              • SynergexU
              • Education Library
              • Blog
              • Synergy-e-News
            • Company
              • Leadership
              • Careers
              • Contact
            • +1-916-635-7300
            • Get Support
            • Documentation
            • Resource Center
            ✕
                      No results See all results
                      Exposing WCF Services using xfNetLink .NET
                      • Solutions
                        • Legacy Application Modernization
                        • Modern UI/UX
                        • Data Visibility
                        • Enterprise Application Integration
                        • Development Environment Optimization
                        • Cloud Migration
                        • Security
                        • High Availability and Resilience
                      • Products
                        • Language
                        • Development Environment
                        • Connectivity and Open-Source Tools
                        • Release Strategy
                        • Roadmap
                      • Services and Support
                        • Professional Services Group
                        • Developer Support
                        • Application Support
                      • Learning
                        • Conference
                        • SynergexU
                        • Education Library
                        • Blog
                        • Synergy-e-News
                      • Company
                        • Leadership
                        • Careers
                        • Contact
                      • Home
                      • Blog
                      • Software Development
                      • Exposing WCF Services using xfNetLink .NET
                      Building Distributed Apps with Synergy/DE and WCF
                      June 22, 2011
                      Hosting WCF Services in an ASP.NET Web Application
                      July 1, 2011

                      Exposing WCF Services using xfNetLink .NET

                      Published by Steve Ives on July 1, 2011
                      Categories
                      • Software Development
                      Tags
                      • .NET
                      • ASP.NET
                      • Silverlight
                      • SPC
                      • Synergy/DE 9.5
                      • Visual Studio
                      • Web Development
                      • Web Services
                      • xfNetLink
                      • xfServerPlus

                      Following a recent enhancement to the product in Synergy 9.5.1, developers can now use xfNetLink .NET to create and expose Windows Communication Foundation (WCF) services. In this post I will describe how to do so.

                      This is the second in a series of posts relating to the various ways in which Synergy developers can use of Windows Communication Foundation (WCF) when building their applications. The posts in the series are:

                      1. Building Distributed Apps with Synergy/DE and WCF
                      2. Exposing WCF Services using xfNetLink .NET (this post)
                      3. Hosting WCF Services in an ASP.NET Web Application
                      4. Exposing WCF Services using Synergy .NET Interop
                      5. Self-Hosting WCF Services
                      6. Exposing WCF services using Synergy .NET

                      The basic approach is pretty easy; in fact it’s very easy. In 9.5.1 we added a new -w command line switch to the gencs utility, and when you use the new switch you wind up with a WCF service. I told you it was easy!

                      So, what changes when you use the gencs –w switch? Well, the first thing that changes are the procedural classes that are generated, the ones that correspond to your interfaces and methods in your method catalog, change in the following ways:

                      1. Three new namespaces (System.Runtime.Serialization, System.ServiceModel and System.Collections.Generic) are imported.
                      2. The class is decorated with the ServiceContract attribute. This identifies the class as providing methods which can be exposed via WCF.
                      3. Methods in the class are decorated with the OperationContract attribute. This identifies the individual methods as being part of the service contract exposed by the class, making the methods callable via WCF.
                      4. If any methods have collection parameters, the data type of those parameters is changed from System.Collections.ArrayList to System.Collections.Generic.List. Changing the collection data type is not strictly necessary in order to use WCF, but results in a more strongly prototyped environment which is easier to use, and offers more benefits to developers in terms of increased IntelliSense, etc.

                      The next thing that changes are any data classes, the ones that correspond to the repository structures that are exposed by the parameters of your methods, that are generated. These data classes change in the following ways:

                      1. Two new namespaces are imported. These namespaces are System.Runtime.Serialization and System.ServiceModel.
                      2. Each data class (which corresponds to one of your repository structures) that is generated is decorated with the DataContract attribute. This identifies the data class as a class which can be used in conjunction with a WCF service, and which can be serialized for transmission over the wire.
                      3. Each public property (which corresponds to a field in the structure) is decorated with the DataMemeber attribute. This attribute identifies each property within the class as one which will be serialized, and as a result will be visible to client applications which use the WCF service.

                      By the way, if you use a Workbench “.NET Component Project” to create your xfNetLink .NET assemblies then there isn’t currently an option in the component information dialog to cause the new –w switch to be used. So, for the time being, what you can do is add the switch to the Workbench “Generate C# Classes” tool command line. To do this you would go into project properties for the component project, go to the Tools tab, select the “Generate C# Classes” tool, then add the –w at the end of the command line, like this:

                      We’ll be adding a new checkbox to the component information dialog in 9.5.3 later this year.

                      By the way, by using the gencs –w switch you make it possible to use the resulting classes as a WCF service, but you don’t have to do so … you can continue to use the classes as a regular xfNetLink .NET assembly also. Why would you want to do that? Well, I sometimes use gencs –w just to turn my collection parameters into generic lists!

                      I have submitted a working example to the Synergy/DE CodeExchange, contained within the zip file called ClientServerExamples.zip. Within the example, the following folders are relevant to exposing and consuming a WCF Service using xfNetLink .NET:

                      Folder / Project

                      Description

                      xfServerPlus

                      Contains the Workbench development environment for xfServerPlus and the exposed Synergy methods. If you wish to actually execute the examples then you must follow the setup instructions in the readme.txt file.

                      xfNetLink_wcf

                      Contains the Workbench project used to create the xfNetLink .NET client assembly with the WCF attributes.

                      3_xfpl_xfnl_wcf_service

                      Contains the Visual Studio 2010 solution containing an ASP.NET web application used to host the WCF service, as well as three example client applications, written in Synergy .NET, C# and VB.

                      So, the gencs –w command line switch you make it possible to use the resulting classes to directly expose a WCF service, but there is still the matter of how to “host” the service in order to make it accessible to remote client applications, and that’s what I will begin to address in my next posting.

                      Share
                      20

                      Leave a Reply Cancel reply

                      This site uses Akismet to reduce spam. Learn how your comment data is processed.

                      • Announcing SDI 2023.05.1212
                      • Announcing Synergy/DE 12.1.1.3292
                      • Announcing SDI 2023.04.1150
                      • Synergex Acquired by FOG Software Group
                      • Announcing SDI 2023.03.1080
                      • Announcements
                      • Beta Testing
                      • Code Exchange
                      • CodeGen
                      • CTO's Thoughts
                      • Development Tools
                      • DevPartner Conference
                      • Education
                      • Events
                      • Harmony Core
                      • Hiring
                      • Industry News
                      • Just for Fun
                      • Licensing
                      • Open Source
                      • OpenVMS
                      • President's Thoughts
                      • Release Notifications
                      • Security
                      • Software
                      • Software Development
                      • Success Stories
                      • Tech Article
                      • UI
                      • Uncategorized

                      STAY CONNECTED with Synergex

                      • Facebook
                      • LinkedIn
                      • Twitter
                      • YouTube
                      SOLUTIONS
                      • Legacy Applications Modernization
                      • Modern UI/UX
                      • Data Visibility
                      • Enterprise Application Integration
                      • Development Environment Optimization
                      • Cloud Migration
                      • Security
                      • High Availability
                      PRODUCTS
                      • Language
                      • Development Environment
                      • Connectivity and Open-Source Tools
                      • Release Strategy
                      • Roadmap
                      SUPPORT
                      • Professional Services Group
                      • Developer Support
                      • Application Support
                      LEARNING
                      • Conference
                      • SynergexU
                      • Education Library
                      • Blog
                      • Synergy-e-News
                      COMPANY
                      • Customers
                      • Leadership
                      • Careers
                      • Contact
                      Exposing WCF Services using xfNetLink .NET

                      Privacy  |  Security  |  Terms  |  © 2023 Synergex

                                No results See all results