[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

CSoapSocketClientT and HTTP: 407 Access Denied error through Proxy Server

Dave Langley

9/3/2003 9:23:00 PM

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



4 Answers

Simon Trew

9/4/2003 10:32:00 AM

0

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.

"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:uaBoOMmcDHA.2632@TK2MSFTNGP12.phx.gbl...
> Consider using CSoapWininetClient client instead, then you have access
> to HINTERNET handles, in particular m_hInternet. Or
> CSoapMSXMLInetClient, then you have access to IServerXMLHTTPRequest
> interface pointer with its setProxy and setProxyCredentials methods.
> --
> With best wishes,
> Igor Tandetnik
>
> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken
>
> "Dave Langley" <langley@mappingsolutions.com> wrote in message
> news:uglWwEmcDHA.3044@TK2MSFTNGP11.phx.gbl...
> > 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
> >
> >
> >
>
>


Dave Langley

9/4/2003 6:16:00 PM

0

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" <langley@mappingsolutions.com> wrote in message
news:%23Avxf6wcDHA.3708@tk2msftngp13.phx.gbl...
> 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" <ten.egnaro@werts> wrote in message
> news:u6XMQ$scDHA.2412@TK2MSFTNGP09.phx.gbl...
> > 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.
> >
> > "Igor Tandetnik" <itandetnik@mvps.org> wrote in message
> > news:uaBoOMmcDHA.2632@TK2MSFTNGP12.phx.gbl...
> > > Consider using CSoapWininetClient client instead, then you have access
> > > to HINTERNET handles, in particular m_hInternet. Or
> > > CSoapMSXMLInetClient, then you have access to IServerXMLHTTPRequest
> > > interface pointer with its setProxy and setProxyCredentials methods.
> > > --
> > > With best wishes,
> > > Igor Tandetnik
> > >
> > > "For every complex problem, there is a solution that is simple, neat,
> > > and wrong." H.L. Mencken
> > >
> > > "Dave Langley" <langley@mappingsolutions.com> wrote in message
> > > news:uglWwEmcDHA.3044@TK2MSFTNGP11.phx.gbl...
> > > > 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
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Kim Gräsman

9/4/2003 7:56:00 PM

0

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?

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

That doesn't look right... Try:

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

Please ping back with more details,
Kim


Dave Langley

9/4/2003 8:25:00 PM

0

Thanks for looking at this Kim,

All the documentation says:

varProxyServer [in, optional]
The name of a proxy server or a list of proxy server names.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xml_mth_s...

When I say craps out it causes an UnknownException.

Best Regards,

Dave


"Kim Gräsman" <kim@mvps.org> wrote in message
news:eNYkP6xcDHA.2804@TK2MSFTNGP11.phx.gbl...
> 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?
>
> > > vByPassList.vt=VT_ERROR ;
> > > vByPassList.bstrVal=(BSTR)DISP_E_PARAMNOTFOUND ;
>
> That doesn't look right... Try:
>
> vByPassList.vt = VT_ERROR;
> vByPassList.scode = DISP_E_PARAMNOTFOUND;
>
> Please ping back with more details,
> Kim
>
>