You might want create and use XML WebServices as a part of your application. AxCMS.net makes extensive use of WebServices. Most of them are hosted in the AxCMSPublishService application. We recommend to run your custom WebServices as a part of AxCMSPublishService application. The advantages are:
- You don't have to manage another configuration file.
- You don't have to deploy CMS DLLs into another /bin folder.
- You can reuse WSE infrastructure.
Typical AxCMS.net-solution include an ExtraServices web project, which resides physically under AxCMSPublishService/ExtraServices, thus inheriting all the configuration from the AxCMSPublishService project.
You can develop your WebServices in the ExtraServices project as usual. To configure and run your services consider the following:
- Put all the configuration needed for your WebServices into the web.config from AxCMSPublishService
- After each compilation the DLLs are created under AxCMSPublishService/ExtraServices/bin. AxCMSPublishService/ExtraServices is not an independent application, but just a folder and AxCMSPublishService application. Due to this fact, you have to copy all the project output from AxCMSPublishService/ExtraServices/bin to AxCMSPublishService/bin. You can do it manually, but preferably you can extend PostBuild.build script to copy the dlls needed after each compilation.
When you develop your service hosted in AxCMSPublishService, you have to protect your service with the AxCMSWsePolicy. To do so, put the Propery attribute for your service class. Please ensure that Microsoft.Web.Services3-dll is included as reference.
public class MyService : System.Web.Services.WebService
We recommend to reuse the AxCMS.net framework for your service clients (the web service proxy classes). To create such client, please follow the following procedure.
(If you are a AxCMS.net developer, you have to follow it)
- Ensure you have WSE 3.0 (full edition including VS 2005 plugin) installed.
- Right click on your project, where you want to add a web reference, select 'WSE Settings 3.0' and check the checkbox under gereral tab (Enable this project for Web Services Enhancements).
- Use the web reference wizard to add a new web reference to your client project. You'll end up with a Reference.cs file generated by wizard.
- Make this file a normal class definition file by moving it directly under the project root and renaming it to YourServiceProxy.cs.
- Ensure you have two classes there: YourService and YourServiceWse. If not, go to point 1.
- Edit both classes: ensure they have a parameterless and empty constructor; remove the following generated members: useDefaultCredentialsSetExplicitly, Url, UseDefaultCredentials, CancelAsync and IsLocalFileSystemWebService (they are not needed).
- Create an interface IYourService containing all operations of your service. Implement this interface in your in step 6 created and modified classes.
- Create the following factory method to instantiate a proxy class:
public static IYourService YourService
WebServiceGatewayConfiguration configuration =
(If you are a AxCMS.net developer, create this member in AxCMSWebApi)
- Extend your web.config with following section:
<section name="YourService" type="Axinom.AECMS.Gateway.GatewayConfiguration, AxCMS.BL" />
- Extend your web.config with the following custom section definition:
<!-- seconds -->
- That's it.
11. Don't forget to remove the web reference files generated by the VS 2005 wizard. You don't need them.