Discussion:
HttpSendRequest
(too old to reply)
Robert Harper
2004-09-20 21:25:04 UTC
Permalink
I am trying to develop a BtoB where I send transacton information using
HTTPS. I have a server side application running on Tomcat. When I attempt to
send a message to the server on my local machine, it does not look like the
message is delivered to the servlet.

A call to:
InternetCheckConnection( "http://research2/ctimpact/servlet/ClientSetup", 0,
0 );
returns TRUE so I think it can find the application but the call to
HttpSendRequest() fails.

GetLastError() returns either 0x00002EE7 or 0x00002EFD. I can not find a
description of the problem associates with either value. Any help would be
greatly appreciated.
ASmall
2004-09-21 10:13:03 UTC
Permalink
Sorry I don't know enough to answer the rest of your query, but for
GetLastError() you need to query the wininet.dll list
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/wininet_errors.asp

I now use a function to report the last error string:
//////////////////////////////////////////////////////////////////////
// Function Name: PopupLastError()
// Description: Call to obtain details about last WinAPI error.
//
// Parameters:
// CString *pstr : [out,ptr,defaultvalue=NULL] Filled with error string
// (from system lookup). If NULL shows error in msg box.
//////////////////////////////////////////////////////////////////////
void CAppAutoUpdate::PopupLastError(CString *pstr)const
{
LPVOID lpMsgBuf=NULL;
DWORD dwErrorCode = GetLastError();
::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL, // module to get message from (NULL == system)
dwErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
if(!lpMsgBuf)
{
// Try wininet specific error.
::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_HMODULE,
GetModuleHandle(_T("wininet.dll")),
dwErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, // FormatMessage allocs buffer; use LocalFree(lpMsgBuffer)
to free
NULL
);
}
if(lpMsgBuf)
{
if(pstr)
{
*pstr = static_cast<TCHAR*>(lpMsgBuf); // Copy construct.
}
else
{
::AfxMessageBox(static_cast<TCHAR*>(lpMsgBuf));
// ASSERT(0);
}
::LocalFree(lpMsgBuf);
}
else
{
if(pstr)
{
pstr->LoadString( IDS_UNKNOWN_ERROR );
}
}
}

AS.

Continue reading on narkive:
Loading...