Hallo all, I have to find a bug in an existing software I have taken over
from someone that left our company. It's written in VC++ 7.1 using ATL and
connects to a webservice calling a method there. (It's a Windows Service
running in a DLL with svchost.exe using a thread that impersonates some
person using RpcImpersonateC lient() etc..)
The problem is that the SOAP request needs to connect with NTLM
authentication. With a network sniffer I found out that this doesn't work.
When I change in IIS the authentication mode to anonymous it works (cannot
remain like this).
The WebService call is made by the auto-generated function of the
sproxy-generated header file. I cannot find where to put authentication - or
should this work automatically? (If yes, what can I check to narrow the
bug?)
The only thing I found out, was this instruction from Microsoft:
http://msdn.microsoft.com/library/de...inetclient.asp
Is this the way to go? Do all by myself?
Any help apreciated.
Eric
Here's the auto-generated code of that function:
----
template <typename TClient>
inline HRESULT CTspiConnectT<T Client>::GetAll Lines(
BSTR passKey,
TspiLine** GetAllLinesResu lt, int* __GetAllLinesRe sult_nSizeIs
)
{
if ( GetAllLinesResu lt == NULL )
return E_POINTER;
if( __GetAllLinesRe sult_nSizeIs == NULL )
return E_POINTER;
HRESULT __atlsoap_hr = InitializeSOAP( NULL);
if (FAILED(__atlso ap_hr))
{
SetClientError( SOAPCLIENT_INIT IALIZE_ERROR);
return __atlsoap_hr;
}
CleanupClient() ;
CComPtr<IStream > __atlsoap_spRea dStream;
__CTspiConnect_ GetAllLines_str uct __params;
memset(&__param s, 0x00, sizeof(__params ));
__params.passKe y = passKey;
__atlsoap_hr = SetClientStruct (&__params, 1);
if (FAILED(__atlso ap_hr))
{
SetClientError( SOAPCLIENT_OUTO FMEMORY);
goto __skip_cleanup;
}
__atlsoap_hr = GenerateRespons e(GetWriteStrea m());
if (FAILED(__atlso ap_hr))
{
SetClientError( SOAPCLIENT_GENE RATE_ERROR);
goto __skip_cleanup;
}
__atlsoap_hr = SendRequest(_T( "SOAPAction :
\"http://blablabla/GetAllLines\"\r \n"));
if (FAILED(__atlso ap_hr))
{
goto __skip_cleanup;
}
__atlsoap_hr = GetReadStream(& __atlsoap_spRea dStream);
if (FAILED(__atlso ap_hr))
{
SetClientError( SOAPCLIENT_READ _ERROR);
goto __skip_cleanup;
}
// cleanup any in/out-params and out-headers from previous calls
Cleanup();
__atlsoap_hr = BeginParse(__at lsoap_spReadStr eam);
if (FAILED(__atlso ap_hr))
{
SetClientError( SOAPCLIENT_PARS E_ERROR);
goto __cleanup;
}
*GetAllLinesRes ult = __params.GetAll LinesResult;
*__GetAllLinesR esult_nSizeIs = __params.__GetA llLinesResult_n SizeIs;
goto __skip_cleanup;
__cleanup:
Cleanup();
__skip_cleanup:
ResetClientStat e(true);
memset(&__param s, 0x00, sizeof(__params ));
return __atlsoap_hr;
}