Click here to Skip to main content
11,718,016 members (84,610 online)
Click here to Skip to main content
Add your own
alternative version

Temperature Convert:An XML Web service Using ATL Server and MFC Client

, 6 Mar 2007 31.4K 524 20
An XML Web Service using ATL Server and Called by MFC Client
tempconvert.zip
TempConvert
TempConvert.suo
TempConvert
TempConvert.disco
TempConvert.vcproj.ALADDINKING.Administrator.user
TempConvertClient
res
TempConvertClient.ico
temp
results.discomap
TempConvert.wsdl
TempConvertClient.aps
TempConvertClient.vcproj.ALADDINKING.Administrator.user
TempConvertService
results.discomap
TempConvert.wsdl
TempConvertIsapi
TempConvertIsapi.def
TempConvertIsapi.vcproj.ALADDINKING.Administrator.user
tempconvert_binary.zip
TempConvert_Binary
TempConvert
TempConvert.disco
TempConvert.dll
TempConvertIsapi.dll
TempConvertClient_2003
TempConvertClient.exe
TempConvertClient_2005
TempConvertClient.exe
// TempConvert.h : Defines the ATL Server request handler class
//
#pragma once

namespace TempConvertService
{
// all struct, enum, and typedefs for your webservice should go inside the namespace

// ITempConvertService - web service interface declaration
//
[
	uuid("0A38DB02-B685-403A-B302-12A8B393D74D"), 
	object
]
__interface ITempConvertService
{
	// declare a web service method and its in-parameters and out-parameters
    //Convert Fahrenheit to Celsius
	[id(1)] HRESULT ConTempFah2Cel(
     [in] double dFahrenheit,
     [out, retval] double* pdCelsius);
	//Convert Celsius to Fahrenheit
	[id(2)] HRESULT ConTempCel2Fah(
     [in] double dCelsius,
     [out, retval] double* pdFahrenheit);
};


// TempConvertService - web service implementation
//
[
	request_handler(name="Default", sdl="GenTempConvertWSDL"),
	soap_handler(
		name="TempConvertService", 
		namespace="urn:TempConvertService",
		protocol="soap"
	)
]
class CTempConvertService :
	public ITempConvertService
{
public:
	// This is a sample web service method that shows how to use the 
	// soap_method attribute to expose a method as a web method
	[ soap_method ]
	HRESULT ConTempFah2Cel(
    /* [in]*/ double dFahrenheit,
    /* [out, retval] */ double* pdCelsius)
	{
		if(!pdCelsius)
			return E_INVALIDARG;

		*pdCelsius=((dFahrenheit-32)*5)/9;
		return S_OK;
	}
	
	[ soap_method ]
	HRESULT ConTempCel2Fah(
    /* [in]*/ double dCelsius,
    /* [out, retval] */ double* pdFahrenheit)
	{
		if(!pdFahrenheit)
			return E_INVALIDARG;

		*pdFahrenheit=dCelsius*9/5+32;
		return S_OK;
	}
}; // class CTempConvertService

} // namespace TempConvertService

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

James, Lu Zuheng
Web Developer
China China
I am favor to use C\C++,MFC,ATL,COM and JavaScript to program, and interesting in network security as well.In my spare time,I like playingbasketball,Climbing.I now live in Beijing,China.It is nice to go along the red walls around the Forbitten City.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150901.1 | Last Updated 6 Mar 2007
Article Copyright 2007 by James, Lu Zuheng
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid