ImageIf your assembly did not construct you will have to Solve any errors that you might have before you proceed. The most probable cause for errors at this point will be dependencies that aren’t catered for.
Check out what happened on your project. If you look in Solution Explorer you will discover that a new folder called GeneratedCode was created, and also some new source documents have been added to the folder. These new files are in the middle of Interop projects work.
The process source files that you added to the job, in The Approaches folder, have been Traditional Synergy subroutines and functions. An Interop project’s task would be to expose those methods’ performance in precisely the identical manner that xfNetLink .NET’s GENCS utility does, also GENCS generates .NET courses that represent the Synergy methods, and the data structures subjected by these Synergy methods.
The Interop project basically does the Identical thing, except That where GENCS created C# code which uses xfNetLink .NET along with xfServerPlus to call the Synergy methods, that the Interop project generates Synergy .NET code which calls for the Synergy procedures directly.
From the code used in my case the methods that were Synergy that I Added to this project were part of an interface called”SynergyServer”. This was characterized by the xfMethod attributes that exist in each of the source files that I included in the project. You’ll see that the GeneratedCode folder today includes a resource file named SynergyServer.dbl, and if you should look in the source file you would see that it includes a class called SynergyServer, which consequently includes methods named GetAddressForUpdate, GetAllCustomers and so on. These approaches correspond that I originally included in the project.
Additionally you will notice that the GeneratedCode folder Also contains source files that represent the definitions that are subjected by the methods’ parameters. For each record that’s subjected a class has been created by the interop project. These classes are named Address_type, Address, Contact and so Forth.
However, if you were to look in the source files that have Been generated in the GeneratedCode folder that you may observe that these generated classes do not contain some ServiceContract, OperationContract, DataContract or DataMember attributes. In other words, the courses can not currently be subjected through WCF.
Note: You should not make modifications GeneratedCode folder, because this code is going to be recreated whenever you construct the project.
Like I briefly discussed in an earlier post To be exposed using WCF it is necessary to apply several attributes to those courses:
Class containing callable methods ServiceContract
Callable method OperationContract
Class specifying a data arrangement DataContract
Available manhood in a data format DataMember
In an Interop project, these attributes can be Added into the generated courses by enabling a project choice referred to as”Generate WCF Assets”.
In Solution Explorer, right-click your own job and select Properties.
In the project properties dialog select The tab called Interop.
Check the Generate WCF Contracts option.
Generally it’s also a good idea to set the Generate out Parameters property to outside instead of their default value of”ref”.
Save your changes by selecting File > Save from the menu.
Close to the project properties dialog.
In Solution Explorer, right-click on your job and out of The context menu select Build.
Check the output window and make Sure your assembly Built properly.
Note: The default behavior of generating parameters out as Ref is to keep compatibility with that which GENCS does by default, but you would always want output parameters defined as kind out when exposing a WCF service to a new client application.
Now take a look at the a Variety of source documents in the GeneratedCode folder. You should notice that the ServiceContract, OperationContract, DataContract and DataMember attributes are present as required.
Host the Service
That is it, you employed a Synergy. NET Interop job to Define and make a WCF support. Obviously before you can actually do anything you will need to host it. One alternative is to host the service in an asp net hosting uk Web Program as described in my previous post.
But, sometimes developers don’t want to have to setup And keep an IIS web server to host a WCF service. Luckily there are Other methods of hosting a WCF service that is going to be, and that don’t need IIS The topic of the following post.