How can the creation of WCF or ASMX Web Services be simplified at high quality level?

<p>&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">Is there a way to increase the speed of overall web service development using .NET and preferrable WCF. This overall procedure should include the implementation, the testing, the support for documentation and the maintenance and feature extending in the future.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949; min-height: 15.0px;">&nbsp;</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">Automatic code generation (server &amp; client) using patterns or strict conventions is preferred due to an easier communicatable result, because we use web services in way that they the user easily recognizes which parameters are requested and which are returned without searching through structures and procedures. The generation of tests should be possible at least on "Test shell" basis that can be completed. The generation should never remove own written code.</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">Additonally, the code generation should be possible for WCF and classical (ASMX) Web Services using the same input values.&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">Naturally, we do not want to use the configurability of web services. It must be able to create unsecured / open web services without authtentication, but it should also be possible to secure them. Several different binding variants are used in our system at the moment and we typically publish our services several times on different machines addressing different users. This should be easier to configure and use in the future.&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 12.0px Verdana; color: #494949;">&nbsp;</p><p>&nbsp;</p>
1 answer

Web Service Software Factory to speed up quality WCF and ASMX development

 

   Microsoft provides a module called Web Service Software Factory (WSSF) for Visual Studio 2008. According to preleases this functionality is included in the release of Studio 2010. This can be downloaded at this link (http://msdn.microsoft.com/en-us/library/bb931187.aspx). All produced code follows Message-patterns and many conventions. Furthermore, data contracts and services are visualized in understandable models which allow easy documentation (they have a UML notation - could be a UML profile in backend). The code (including test cases) is generated automatically. .Net in C# and VB.Net is available for the generation. The solution with all projects it automatically set up and can be easily extended by using own code such as references to other modules. The usage of it can be sketched like the following instructions. Please note, that the overall usage needs some training and is not documentable in this CMS system precisely. See the useful walkthrough from CodeProject to fully understand how it could be used in a real project and to identify the benefits: click 

  1. Install the WSSF
  2. Create a new WSSF project (see the walkthrough for better understanding)
  3. Now you can model your service contractdata contract and the host model. Start developing your datacontract. It defines the data types that can be used in your services
  4. Then continue with the Service contract. Several service endpoints with several operations (methods) for each can be defined. This is done by using message from and to the operation. Each message uses data elements from the data contract. 
  5. Specify the Implementation technology - ASMX or WCF (do this like in the walkthrough.. they provide a good step by step solution)
  6. Rightclick on your solution and slect "Add/WCF Implementation Projects." and create an implementation project with the type "Guidance Packages\Service Factory: Modeling Edition"
  7. Add your project to the "Project Mapping Table" of your ServiceContract and DataContract
  8. Open your Host Model (or create it if missing) and create a new Proxy. Then select the implementation Project here as well.
  9. Now you can configure your endpoint as you like.
  10. Finally the code can be generated by right-clicking on the canvas of your data and service contracts and selecting "Generate Code".

  Now you can build and use your service. Several endpoints can be used and configured according your connection requirements. Binding variants such HTTPBinding can be used to bind the service to different addresses using different names etc. Not all binding variants are available in this version (only the desired usages). In your service configuration security constraints such as the authentication mechanism can be set like for classical WCF or ASMX services. Futhermore, test cases could be generated. The models can be exported by using screenshots. The service can easily be modified, because of strict separation of own .NET code and the generated code. For optimal results try to use the modeled data contracts only as templates for the internally used data structures. However, it is sometimes useful to start the development by visually experimenting with this data contracts model.  (Sry for re-posting, but the solution-problem linking got lost)

Taggings: