C
Chris
Hello,
I have a program that uses the CInternetSession and CHttpConnection
mfc classes to register the program...it works for the majority of our
customers, but a few have received errors, all of whom are going
through proxy servers. Specifically, we have encountered a 400 error,
a 500 error, and a 12152 error. On the 500, we have noticed that part
of the url is appended to the sendstring twice, but have no idea why.
Is there anyone out there who has experience with proxies that could
shed some light on these errors? I believe that they could be fixed by
editing the proxy settings, but we deal with many school districts as
our customers and do not have access to the proxies. It would be best
if we could harden our code so that these problems are resolved.
here is a sample of the code we use:
CInternetSession* session;
CHttpConnection* pHttpconnection;
CHttpFile* pFile;
session=new CInternetSession();
try
{
pHttpconnection = session->GetHttpConnection((LPCTSTR)m_sURL);
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not get connection to Web Server. Check your
high speed or dial up connection. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
session->Close();
delete session;
return(FALSE);
}
try
{
pFile = pHttpconnection->OpenRequest(_T("GET"
),sSendString,NULL,1,NULL,NULL,INTERNET_FLAG_KEEP_
CONNECTION);
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not open request to Web Server. Try again
later. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
session->Close();
delete session;
pFile->Close();
delete pFile ;
return(FALSE);
}
dwRet = HTTP_STATUS_OK;
try
{
pFile->SendRequest();
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not get send request to Web Server. Check
your high speed or dial up connection. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
pHttpconnection->Close();
delete pHttpconnection;
session->Close();
delete session;
pFile->Close();
delete pFile ;
return(FALSE);
}
pFile->QueryInfoStatusCode(dwRet);
an example of m_sURL: "webservice.ourdomain.com"
and of the sendstring:
"/webservicefolder/default.asmx/ProcessReq?clientXMLString=<*data*>"
Thank you very much for any help!
I have a program that uses the CInternetSession and CHttpConnection
mfc classes to register the program...it works for the majority of our
customers, but a few have received errors, all of whom are going
through proxy servers. Specifically, we have encountered a 400 error,
a 500 error, and a 12152 error. On the 500, we have noticed that part
of the url is appended to the sendstring twice, but have no idea why.
Is there anyone out there who has experience with proxies that could
shed some light on these errors? I believe that they could be fixed by
editing the proxy settings, but we deal with many school districts as
our customers and do not have access to the proxies. It would be best
if we could harden our code so that these problems are resolved.
here is a sample of the code we use:
CInternetSession* session;
CHttpConnection* pHttpconnection;
CHttpFile* pFile;
session=new CInternetSession();
try
{
pHttpconnection = session->GetHttpConnection((LPCTSTR)m_sURL);
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not get connection to Web Server. Check your
high speed or dial up connection. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
session->Close();
delete session;
return(FALSE);
}
try
{
pFile = pHttpconnection->OpenRequest(_T("GET"
),sSendString,NULL,1,NULL,NULL,INTERNET_FLAG_KEEP_
CONNECTION);
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not open request to Web Server. Try again
later. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
session->Close();
delete session;
pFile->Close();
delete pFile ;
return(FALSE);
}
dwRet = HTTP_STATUS_OK;
try
{
pFile->SendRequest();
}
catch(CInternetException *pCause)
{
dwRet=pCause->m_dwError;
errorMsg.Format(_T("Could not get send request to Web Server. Check
your high speed or dial up connection. Error: #%u."), dwRet );
MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
pHttpconnection->Close();
delete pHttpconnection;
session->Close();
delete session;
pFile->Close();
delete pFile ;
return(FALSE);
}
pFile->QueryInfoStatusCode(dwRet);
an example of m_sURL: "webservice.ourdomain.com"
and of the sendstring:
"/webservicefolder/default.asmx/ProcessReq?clientXMLString=<*data*>"
Thank you very much for any help!