Hi All,
Hopefully someone will have a solution to this.
Background:
I am currently sending a standard SOAP based message to a .asmx web service to retrieve a token. This service uses basic auth, and by specifying the credentials as part of the open call to open on the IXMLHttpRequest object, the correct headers are added and everything works wonderfully. open Method (IXMLHTTPRequest)
The problem arises when some of our clients are required to go through a proxy within their own network environment to access the internet.
Now to simulate this, I downloaded Fiddler and ticked the Authentication Required. So now when I open IE for example, get the prompt. Fiddler has set the credentials to "1" - username "1" - password. I enter these, and I can access the net as usual. Consequently, the client code that is running on their system is now failing the web service call because it is not utilising their own internal proxy.
Now, I have looked at the definition of IXMLHttpRequest, and cannot find of any methods and/or properties that I might be able to set to use their proxy settings.
I have been trying to use the UrlMkSetSessionOption and set the correct proxy settings that were returned successfully from a call to
Code:
unsigned long nSize = 4096;
char szBuf[4096] = { 0 };
INTERNET_PROXY_INFO* pInfo = (INTERNET_PROXY_INFO*)szBuf;
if(!InternetQueryOption(NULL, INTERNET_OPTION_PROXY, pInfo, &nSize))
printf("InternetQueryOption failed! (%d)\n", GetLastError());
However, everytime I try to call UrlMkSetSessionOption, I get an error HRESULT of,
2EEA 12010 INTERNET_BAD_OPTION_LENGTH: The length of an option supplied to InternetQueryOption or InternetSetOption is incorrect for the type of option specified
I am trying to do this before the call to send on the IXMLHttpRequest object.
I was starting to look at an alternative approach based on this article SOAP Client Using Visual C++ - CodeGuru
Though setting the ProxyServer to 127.0.0.1:8888 [fillder default proxy settings] has no affect. In fact, I do not even see the request come through into fiddler, I can only guess that it might be bypassing the wininet stack or related to this comment
In this release, the HttpConnector ignores the "Bypass Proxy" settings in Internet Explorer.
If I can continue to use the IXMLHttpRequest send approach and some how specify to go through this additional proxy that would me preferable to try and reduce the man days on this.
Thanks for any input on this.