473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

CSoapSocketClientT and HTTP: 407 Access Denied error through Proxy Server

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,strLogin Name,
lstrlen (strLoginName)) ;
pTSConnection->SetOption(INTERNET_OPTION_PROXY_PASSWORD,strLogin Password,
lstrlen (strLoginPassword)) ;

What I what is the CSoapSocketClientT<> equivalent of the
CInternetSession.SetOption(INTERNET_OPTION_PROXY_U SERNAME) and
CInternetSession.SetOption(INTERNET_OPTION_PROXY_P ASSWORD).

Best Regards,

Dave

Nov 16 '05 #1
4 5922
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" <it********@mvps.org> wrote in message
news:ua**************@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" <la*****@mappingsolutions.com> wrote in message
news:ug**************@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,strLogin Name,
lstrlen (strLoginName)) ;

pTSConnection->SetOption(INTERNET_OPTION_PROXY_PASSWORD,strLogin Password
,
lstrlen (strLoginPassword)) ;

What I what is the CSoapSocketClientT<> equivalent of the
CInternetSession.SetOption(INTERNET_OPTION_PROXY_U SERNAME) and
CInternetSession.SetOption(INTERNET_OPTION_PROXY_P ASSWORD).

Best Regards,

Dave


Nov 16 '05 #2
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" <la*****@mappingsolutions.com> wrote in message
news:%2****************@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,vByPass Lis t) ;

Best Regards,

Dave.
"Simon Trew" <ten.egnaro@werts> wrote in message
news:u6**************@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" <it********@mvps.org> wrote in message
news:ua**************@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" <la*****@mappingsolutions.com> wrote in message
news:ug**************@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,strLogin Name, > lstrlen (strLoginName)) ;
>
pTSConnection->SetOption(INTERNET_OPTION_PROXY_PASSWORD,strLogin Password ,
> lstrlen (strLoginPassword)) ;
>
> What I what is the CSoapSocketClientT<> equivalent of the
> CInternetSession.SetOption(INTERNET_OPTION_PROXY_U SERNAME) and
> CInternetSession.SetOption(INTERNET_OPTION_PROXY_P ASSWORD).
>
> Best Regards,
>
> Dave
>
>
>



Nov 16 '05 #3
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
Nov 16 '05 #4
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/de...th_sz_65q1.asp

When I say craps out it causes an UnknownException.

Best Regards,

Dave
"Kim Gräsman" <ki*@mvps.org> wrote in message
news:eN**************@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

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
5
by: Stan | last post by:
Here is my scenario: Web server ------------ Framework 1.1 Application proxy for the serviced component Component server ------------------- Framework 1.0
3
by: bd-chan | last post by:
I'm trying to log in to a secured web site automatically using c#. To do this I have go through a proxy server, and use SSL, and log in to the secure site with another user name and password...
0
by: Miroslav Milosevic via .NET 247 | last post by:
I have mfc-based windows application which consumes a web service. I implemented ATL-based secure SOAP communication as per Microsoft's SecureSOAP Sample,...
0
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The...
0
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the...
1
by: Vladimir Rypacek | last post by:
Hi, I've got strange error on computer which is accessing web-service thrugh proxy. Scenario 1 ---------- - the web-service does not require authentication (Anonymous access is allowed) -...
5
by: rk325 | last post by:
Yes, I've seen many posts about this type of error, and none of the solutions people applied worked for me. So please read this one carefully and help me if you can. I have a web service...
0
by: James | last post by:
Hello, Running Ethereal on my CSoapSocketClientT based web service, I notice that with EVERY request, I first receive a 401 denied message back from the server, to which the client replies with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.