CSoapSocketClientT and HTTP: 407 Access Denied error through Proxy Server

D

Dave Langley

I'm using VC++ to write an VC++ unmanaged client to communicate to a C#.NET
web service. I have the proxy class for the unmanaged client and it uses the
default CSoapSocketClientT<> template as it's HTTP connection. This works
fine until I start using a proxy server with authorization rather than a
direct HTTP connection. I keep getting a 407 un-authorized response. I've
have looked at both the CNTLMAuthObject and CBasicAuthObject objects in
combination with the NegotiateAuth method but have had no luck.

I have older VC++ clients that use the CInternetSession class and I'm able
to set the proxy server authorization using the:

pTSConnection->SetOption(INTERNET_OPTION_PROXY_USERNAME,strLoginName,
lstrlen (strLoginName)) ;
pTSConnection->SetOption(INTERNET_OPTION_PROXY_PASSWORD,strLoginPassword,
lstrlen (strLoginPassword)) ;

What I what is the CSoapSocketClientT<> equivalent of the
CInternetSession.SetOption(INTERNET_OPTION_PROXY_USERNAME) and
CInternetSession.SetOption(INTERNET_OPTION_PROXY_PASSWORD).

Best Regards,

Dave
 
S

Simon Trew

Yes, I would certainly consider changing the template class just to see if
it works (i.e. eliminate the fact that the proxy is incorrectly configured
or auth details are incorrect). That being said, my experience is
thatCSoapMSXMLInetClient is not as fast as others as it has to do a lot of
COM. In practice though this is not a major time consumer in the app as a
whole.
 
D

Dave Langley

Also tried:

vProxyServer.vt=VT_BSTR ;
vProxyServer.bstrVal=SysAllocString(L"192.168.1.2:808") ;

This doesn't cause the setProxy to crap out but the proxy redirection is
ignored...


Dave Langley said:
Igor,
Using CSoapMSXMLInetClient looks like it might work and I have a VB
example working using MSXML4 library directly. However it seems to crap out
in VC++. The problem seems to be in passing in the name of the proxy server.
I'm using VARIANTS but do not seem to have any luck. Documentation for VC++
is non existent!!! Anyone got MSXML4 working in VC++ with proxy support?


// m_spHttpRequest set correctly earlier in function
IServerXMLHTTPRequest2 *pIServerXMLHTTPRequest=m_spHttpRequest ;

VARIANT vProxyServer ;
VARIANT vByPassList ;

vByPassList.vt=VT_ERROR ;
vByPassList.bstrVal=(BSTR)DISP_E_PARAMNOTFOUND ;

vProxyServer.vt=VT_ARRAY|VT_BSTR;
SAFEARRAY *psa;
SAFEARRAYBOUND bounds={1,0};
psa=SafeArrayCreate(VT_BSTR,1,&bounds);
BSTR *bstrArray;
SafeArrayAccessData(psa,reinterpret_cast<void**>(&bstrArray));
bstrArray[0]=SysAllocString(L"192.168.1.2:808") ;
SafeArrayUnaccessData(psa);
vProxyServer.parray=psa;

// craps out on this line.
pIServerXMLHTTPRequest->setProxy(SXH_PROXY_SET_PROXY,vProxyServer,vByPassLis
t) ;



Best Regards,

Dave.


Simon Trew said:
Yes, I would certainly consider changing the template class just to see if
it works (i.e. eliminate the fact that the proxy is incorrectly configured
or auth details are incorrect). That being said, my experience is
thatCSoapMSXMLInetClient is not as fast as others as it has to do a lot of
COM. In practice though this is not a major time consumer in the app as a
whole.
 
K

Kim Gräsman

Dave,
vProxyServer.vt=VT_BSTR ;
vProxyServer.bstrVal=SysAllocString(L"192.168.1.2:808") ;
This doesn't cause the setProxy to crap out

When you say "crap out", what do you mean, exactly?
vProxyServer.vt=VT_ARRAY|VT_BSTR;

I think this should be a SAFEARRAY of VARIANT, since clients are generally
scripting languages, who can only produce this kind of SAFEARRAY.

I'm not familiar with ServerXMLHTTPRequest - does the docs say it takes an
array?

That doesn't look right... Try:

vByPassList.vt = VT_ERROR;
vByPassList.scode = DISP_E_PARAMNOTFOUND;

Please ping back with more details,
Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top