Creating XML Web Services
To create an XML Web service project
- Create an ATL Server project as described in Creating an ATL Server Project.
If you create the project using the ATL Server Web Service icon, an XML Web service will be added to the Web application DLL by default.
If you create the project using the ATL Server Project icon, you can add an XML Web service to the Web application DLL by selecting Create as Web Service on the Application Options page of the wizard.
To add an XML Web service to an existing project
- Follow the instructions in Adding an XML Web Service with ATL Server.
An XML Web service can be added to a wizard-generated ATL Server ISAPI extension DLL or a Web application DLL.
To implement an XML Web service
- Add methods to the interface in the wizard-generated header file. Use only the marshaling attributes and data types described in Supported Types in XML Web Services Created with ATL Server.
- Ensure that structures used in the interface methods are exported by applying the export attribute to them.
- Implement the interface methods in the soap_handler class in the wizard-generated header file. Add the soap_method attribute to each method to tell the compiler that it should be exposed through SOAP.
- If appropriate, apply the soap_header attribute to one or more SOAP methods in the class.
Always use the memory manager returned by CSoapRootHandler::GetMemMgr to allocate memory for [out] or [in, out] parameters and SOAP headers, except BSTRs which must always be allocated with SysAllocString, CComBSTR, or a related function or class.
- Build the project to create the XML Web service DLL.
You can find example code and further information in the following topics:
- SOAP Server Code
- Provides code for a simple XML Web service. Client code can be found in the SOAP Client Code topic.
- Creating an XML Web Service Using ATL Server
- Walks you through the creation of an XML Web service using ATL Server. For comparison, the same XML Web service is also created using Visual Basic, C#, and Managed Extensions for C++. For details, see Creating and Accessing XML Web Services Walkthroughs.
- ATL Server SOAP Samples
- Includes a selection of complete XML Web service samples in the SOAP category.