Some problems of extracting data from service with XMLHTTP through Proxy server

Source: Internet
Author: User
Tags net
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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.