Search code examples
javaasp-classicfiddler

Some HTTP requests dont show up in Fiddler


I am rewriting example code for access to the API of a web store from Java into classic ASP. The Java code works, it sends requests and the right results are returned. The ASP code does exactly the same but all it does is return an error that there is something wrong with the authorization. I have checked the hmac signature string (sha256, base64) but this gives the same results as the Java code.

So then I decided to check how the HTTP requests actually look, and compare them with each other. Fiddler seemed to be a good choice, but for some reason both HTTP request dont show up.

A lot has already been written on this subject and i tried several things, but so far no luck. They all describe routing the request through the Fiddler proxy, which is localhost:8888.

I use this object in the ASP code:

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")

For IIS 7 (on Windows 7) the proxy can be set in DOS like this:

netsh winhttp set proxy localhost:8888

And in the code like this (this may not work in other version of "MSXML2.ServerXMLHTTP" than v6):

httpRequest.setProxy 2, "http=localhost:8888", ""

The Java code uses Apache HttpClient, and according to the manual the proxy can be set like this:

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("localhost", 8888);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

I added this code at the beginning of the main() method. The code is run inside Eclipse (Juno).

I also opened the proxy address (http://localhost:8888/) in a browser, and it shows me the 'Fiddler Echo Service' page. Fiddler is set to show 'All Processes'.

Still, none of two HTTP Request show up. The only thing that does show up is the ASP page I run (http://localhost:8082/test.asp) that does the HTTP request. When I use my browser other things show up on Fiddler, so I know it is working.

Anybody got any ideas?


Solution

  • I originally thought that because nothing showed up on Fiddler with both programs, something was wrong with Fiddler.

    But things were wrong with both programs. For the ASP code, setProxy has to called like this:

    xmlhttp.setProxy 2, "http://127.0.0.1:8888", ""
    

    So "::/" instead of "="

    Making Apache HttpClient requests in the Java code show up in Fiddler was very complicated because request were send using https protocol. Although I tried several proposed solutions, I could not get it to work.

    In the end I found out that adding

    -Djavax.net.debug=all
    

    as an argument for the VM showed me the what I needed, the headers that were being send.