xml| Server | data | issues
With XMLHTTP through Proxy server from the service to extract data, such as from WebService, ASP, aspx extract data, I used to have some unknown problems, often not pass agent certification. After many groping, and finally understand the reasons for this, is divided out to share.
The method called in VB is this:
Dim Objhttp as New XMLHTTP
Objhttp.open "Post", Http://192.168.1.2/web.asmx, False
Objhttp.setrequestheader "Content-type", "application/x-www-form-urlencoded"
Objhttp.send (strrequest) ' If the above is sent by "get", this sentence is useless, so you have to use the "POST" way
RETURNSTR = Objhttp.responsetext ' returns data as text
Previously seen that is to use Proxycfg.exe this winhttp configuration command to configure, in fact, this is not true, in fact, is not necessary, set is one thing, at least in the XP system is such, as long as the Internet Explorer set the correct proxy server address on OK.
The password for the user name of the proxy service has been seen to send this way:
Objhttp.open "Post", Http://192.168.1.2/web.asmx, False,username,password
In fact, this is wrong, this username and password is not sent to the proxy server authentication, but to the need to authenticate users of the IIS server. Proxy server username password is not required to set, it will be like IE through proxy access, when needed, will pop up username and password input box. But I found in the test, the different proxy server will vary, once in the proxy server on the authentication password changes, debugging will basically not call success, because some time the program sent to the proxy server password or the original, the case will have a pop-up box to require the password re-enter, When using a Ccproxy proxy server, most of them don't seem to be working. I have been this place for a long time, always think that their program is not written, and later found that as long as the VB turned off again, there will be input box. The original reason is this, a program in the call, will be recorded to the original username and password, if in the middle of the proxy server changed the password or user name, the general situation is not aware of the program, but some proxy server can inform the program re-enter, but I test most not. At this point, just restart the program OK.
In. NET the situation is similar, I only used to call WebService through the Web reference, if there is a proxy server, it must be set in IE correct, and must first network, the proxy server's user and password entered correctly, in. NET can invoke success, because this. NET username and password is IE keep synchronized, do not automatically bring up the input box input, if not correct out of error, so call must use the Try statement.