⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mailservice.h

📁 Vc.Net入门与提高源码
💻 H
📖 第 1 页 / 共 2 页
字号:
	-1,
	SOAPFLAG_NONE | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL};

extern __declspec(selectany) const _soapmapentry __CMailService_Login_atlsoapheader_entries[] =
{
	{ 0x00000000 }
};

extern __declspec(selectany) const _soapmap __CMailService_Login_atlsoapheader_map = 
{
	0x481233A8,
	"Login",
	L"LoginResponse",
	sizeof("Login")-1,
	sizeof("LoginResponse")-1,
	SOAPMAP_HEADER,
	__CMailService_Login_atlsoapheader_entries,
	0,
	0,
	-1
};

struct __CMailService_GetMessages_struct
{
	int lUserID;
	BSTR bstrSessionID;
	int lMax;
	_MSGDATA *msgData;
	int __msgData_nSizeIs;
};

extern __declspec(selectany) const _soapmapentry __CMailService_GetMessages_entries[] =
{

	{
		0x483271B8, 
		"lUserID", 
		L"lUserID", 
		sizeof("lUserID")-1, 
		SOAPTYPE_INT, 
		SOAPFLAG_NONE | SOAPFLAG_IN | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL,
		offsetof(__CMailService_GetMessages_struct, lUserID),
		NULL,
		NULL,
		-1,
	},
	{
		0x3D124BCC, 
		"bstrSessionID", 
		L"bstrSessionID", 
		sizeof("bstrSessionID")-1, 
		SOAPTYPE_STRING, 
		SOAPFLAG_NONE | SOAPFLAG_IN | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL,
		offsetof(__CMailService_GetMessages_struct, bstrSessionID),
		NULL,
		NULL,
		-1,
	},
	{
		0x003C8D72, 
		"lMax", 
		L"lMax", 
		sizeof("lMax")-1, 
		SOAPTYPE_INT, 
		SOAPFLAG_NONE | SOAPFLAG_IN | SOAPFLAG_OUT | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL,
		offsetof(__CMailService_GetMessages_struct, lMax),
		NULL,
		NULL,
		-1,
	},
	{
		0xDA3BF021, 
		"msgData", 
		L"msgData", 
		sizeof("msgData")-1, 
		SOAPTYPE_UNK, 
		SOAPFLAG_NONE | SOAPFLAG_OUT | SOAPFLAG_DYNARR | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL,
		offsetof(__CMailService_GetMessages_struct, msgData),
		NULL,
		&___MSGDATA_map,
		3+1,
	},
	{
		0xDA3BF021,
		"__msgData_nSizeIs",
		L"__msgData_nSizeIs",
		sizeof("__msgData_nSizeIs")-1,
		SOAPTYPE_INT,
		SOAPFLAG_NOMARSHAL,
		offsetof(__CMailService_GetMessages_struct, __msgData_nSizeIs),
		NULL,
		NULL,
		-1
	},
	{ 0x00000000 }
};

extern __declspec(selectany) const _soapmap __CMailService_GetMessages_map =
{
	0x238E4C27,
	"GetMessages",
	L"GetMessagesResponse",
	sizeof("GetMessages")-1,
	sizeof("GetMessagesResponse")-1,
	SOAPMAP_FUNC,
	__CMailService_GetMessages_entries,
	sizeof(__CMailService_GetMessages_struct),
	2,
	-1,
	SOAPFLAG_NONE | SOAPFLAG_PID | SOAPFLAG_DOCUMENT | SOAPFLAG_LITERAL};

extern __declspec(selectany) const _soapmapentry __CMailService_GetMessages_atlsoapheader_entries[] =
{
	{ 0x00000000 }
};

extern __declspec(selectany) const _soapmap __CMailService_GetMessages_atlsoapheader_map = 
{
	0x238E4C27,
	"GetMessages",
	L"GetMessagesResponse",
	sizeof("GetMessages")-1,
	sizeof("GetMessagesResponse")-1,
	SOAPMAP_HEADER,
	__CMailService_GetMessages_atlsoapheader_entries,
	0,
	0,
	-1
};
extern __declspec(selectany) const _soapmap * __CMailService_funcs[] =
{
	&__CMailService_GetUnreadCount_map,
	&__CMailService_GetLaunchURL_map,
	&__CMailService_GetMessageCount_map,
	&__CMailService_Login_map,
	&__CMailService_GetMessages_map,
	NULL
};

extern __declspec(selectany) const _soapmap * __CMailService_headers[] =
{
	&__CMailService_GetUnreadCount_atlsoapheader_map,
	&__CMailService_GetLaunchURL_atlsoapheader_map,
	&__CMailService_GetMessageCount_atlsoapheader_map,
	&__CMailService_Login_atlsoapheader_map,
	&__CMailService_GetMessages_atlsoapheader_map,
	NULL
};

template <typename TClient>
inline HRESULT CMailServiceT<TClient>::GetUnreadCount(
		int lUserID, 
		BSTR bstrSessionID, 
		int* lUnreadCount
	)
{
	HRESULT __atlsoap_hr = InitializeSOAP(NULL);
	if (FAILED(__atlsoap_hr))
	{
		return __atlsoap_hr;
	}
	
	CleanupClient();

	CComPtr<IStream> __atlsoap_spReadStream;
	__CMailService_GetUnreadCount_struct __params;
	memset(&__params, 0x00, sizeof(__params));
	__params.lUserID = lUserID;
	__params.bstrSessionID = bstrSessionID;

	__atlsoap_hr = SetClientStruct(&__params, 0);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = GenerateResponse(GetWriteStream());
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = SendRequest(_T("SOAPAction: \"urn:MailService#GetUnreadCount\"\r\n"));
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}

	__atlsoap_hr = GetReadStream(&__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __cleanup;
	}

	*lUnreadCount = __params.lUnreadCount;

	goto __skip_cleanup;
	
__cleanup:
	Cleanup();
__skip_cleanup:
	ResetClientState(true);
	memset(&__params, 0x00, sizeof(__params));
	return __atlsoap_hr;
}

template <typename TClient>
inline HRESULT CMailServiceT<TClient>::GetLaunchURL(
		int lUserID, 
		BSTR bstrSessionID, 
		int lMessageID, 
		BSTR* bstrURL
	)
{
	HRESULT __atlsoap_hr = InitializeSOAP(NULL);
	if (FAILED(__atlsoap_hr))
	{
		return __atlsoap_hr;
	}
	
	CleanupClient();

	CComPtr<IStream> __atlsoap_spReadStream;
	__CMailService_GetLaunchURL_struct __params;
	memset(&__params, 0x00, sizeof(__params));
	__params.lUserID = lUserID;
	__params.bstrSessionID = bstrSessionID;
	__params.lMessageID = lMessageID;

	__atlsoap_hr = SetClientStruct(&__params, 1);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = GenerateResponse(GetWriteStream());
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = SendRequest(_T("SOAPAction: \"urn:MailService#GetLaunchURL\"\r\n"));
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}

	__atlsoap_hr = GetReadStream(&__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __cleanup;
	}

	*bstrURL = __params.bstrURL;

	goto __skip_cleanup;
	
__cleanup:
	Cleanup();
__skip_cleanup:
	ResetClientState(true);
	memset(&__params, 0x00, sizeof(__params));
	return __atlsoap_hr;
}

template <typename TClient>
inline HRESULT CMailServiceT<TClient>::GetMessageCount(
		int lUserID, 
		BSTR bstrSessionID, 
		int* lMessageCount
	)
{
	HRESULT __atlsoap_hr = InitializeSOAP(NULL);
	if (FAILED(__atlsoap_hr))
	{
		return __atlsoap_hr;
	}
	
	CleanupClient();

	CComPtr<IStream> __atlsoap_spReadStream;
	__CMailService_GetMessageCount_struct __params;
	memset(&__params, 0x00, sizeof(__params));
	__params.lUserID = lUserID;
	__params.bstrSessionID = bstrSessionID;

	__atlsoap_hr = SetClientStruct(&__params, 2);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = GenerateResponse(GetWriteStream());
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = SendRequest(_T("SOAPAction: \"urn:MailService#GetMessageCount\"\r\n"));
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}

	__atlsoap_hr = GetReadStream(&__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __cleanup;
	}

	*lMessageCount = __params.lMessageCount;

	goto __skip_cleanup;
	
__cleanup:
	Cleanup();
__skip_cleanup:
	ResetClientState(true);
	memset(&__params, 0x00, sizeof(__params));
	return __atlsoap_hr;
}

template <typename TClient>
inline HRESULT CMailServiceT<TClient>::Login(
		BSTR bstrLogin, 
		BSTR bstrPassword, 
		int* lUserID, 
		BSTR* bstrSessionID
	)
{
	HRESULT __atlsoap_hr = InitializeSOAP(NULL);
	if (FAILED(__atlsoap_hr))
	{
		return __atlsoap_hr;
	}
	
	CleanupClient();

	CComPtr<IStream> __atlsoap_spReadStream;
	__CMailService_Login_struct __params;
	memset(&__params, 0x00, sizeof(__params));
	__params.bstrLogin = bstrLogin;
	__params.bstrPassword = bstrPassword;

	__atlsoap_hr = SetClientStruct(&__params, 3);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = GenerateResponse(GetWriteStream());
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = SendRequest(_T("SOAPAction: \"urn:MailService#Login\"\r\n"));
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}

	__atlsoap_hr = GetReadStream(&__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __cleanup;
	}

	*lUserID = __params.lUserID;
	*bstrSessionID = __params.bstrSessionID;

	goto __skip_cleanup;
	
__cleanup:
	Cleanup();
__skip_cleanup:
	ResetClientState(true);
	memset(&__params, 0x00, sizeof(__params));
	return __atlsoap_hr;
}

template <typename TClient>
inline HRESULT CMailServiceT<TClient>::GetMessages(
		int lUserID, 
		BSTR bstrSessionID, 
		int* lMax, 
		_MSGDATA** msgData, int* __msgData_nSizeIs
	)
{
	HRESULT __atlsoap_hr = InitializeSOAP(NULL);
	if (FAILED(__atlsoap_hr))
	{
		return __atlsoap_hr;
	}
	
	CleanupClient();

	CComPtr<IStream> __atlsoap_spReadStream;
	__CMailService_GetMessages_struct __params;
	memset(&__params, 0x00, sizeof(__params));
	__params.lUserID = lUserID;
	__params.bstrSessionID = bstrSessionID;
	__params.lMax = *lMax;

	__atlsoap_hr = SetClientStruct(&__params, 4);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = GenerateResponse(GetWriteStream());
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = SendRequest(_T("SOAPAction: \"urn:MailService#GetMessages\"\r\n"));
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}

	__atlsoap_hr = GetReadStream(&__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __skip_cleanup;
	}
	
	__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
	if (FAILED(__atlsoap_hr))
	{
		goto __cleanup;
	}

	*lMax = __params.lMax;
	*msgData = __params.msgData;
	*__msgData_nSizeIs = __params.__msgData_nSizeIs;

	goto __skip_cleanup;
	
__cleanup:
	Cleanup();
__skip_cleanup:
	ResetClientState(true);
	memset(&__params, 0x00, sizeof(__params));
	return __atlsoap_hr;
}

template <typename TClient>
ATL_NOINLINE inline const _soapmap ** CMailServiceT<TClient>::GetFunctionMap()
{
	return __CMailService_funcs;
}

template <typename TClient>
ATL_NOINLINE inline const _soapmap ** CMailServiceT<TClient>::GetHeaderMap()
{
	return __CMailService_headers;
}

template <typename TClient>
ATL_NOINLINE inline void * CMailServiceT<TClient>::GetHeaderValue()
{
	return this;
}

template <typename TClient>
ATL_NOINLINE inline const wchar_t * CMailServiceT<TClient>::GetNamespaceUri()
{
	return L"urn:MailService";
}

template <typename TClient>
ATL_NOINLINE inline const char * CMailServiceT<TClient>::GetServiceName()
{
	return NULL;
}

template <typename TClient>
ATL_NOINLINE inline const char * CMailServiceT<TClient>::GetNamespaceUriA()
{
	return "urn:MailService";
}

template <typename TClient>
ATL_NOINLINE inline HRESULT CMailServiceT<TClient>::CallFunction(
	void *, 
	const wchar_t *, int,
	size_t)
{
	return E_NOTIMPL;
}

template <typename TClient>
ATL_NOINLINE inline HRESULT CMailServiceT<TClient>::GetClientReader(ISAXXMLReader **ppReader)
{
	if (ppReader == NULL)
	{
		return E_INVALIDARG;
	}
	
	CComPtr<ISAXXMLReader> spReader = GetReader();
	if (spReader.p != NULL)
	{
		*ppReader = spReader.Detach();
		return S_OK;
	}
	return TClient::GetClientReader(ppReader);
}

} // namespace MailService

inline HRESULT AtlCleanupValue<MailService::_MSGDATA>(MailService::_MSGDATA *pVal) throw()
{
	pVal;
	AtlCleanupValue(&pVal->m_bstrFrom);
	AtlCleanupValue(&pVal->m_DateSent);
	AtlCleanupValue(&pVal->m_bstrSubject);
	AtlCleanupValue(&pVal->m_lMessageID);
	AtlCleanupValue(&pVal->m_bMarkedRead);
	return S_OK;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -