Reputation: 117
I'm trying to hook up fiddler to a java unit test in Eclipse so I can see the soap request when our web service is being called...It works automatically in our .NET harness but is there some setting that needs to be applied for Java? Thanks
Upvotes: 6
Views: 15478
Reputation: 4915
I am usring Apache HttpClient(4.5.5), SWT 4, Fiddler 4, and the VM arguments method does not work for me. So I set the proxy settings in the code and it works.
HttpHost proxy = new HttpHost("localhost", 8888, "http");
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
CloseableHttpClient httpclient = HttpClients.custom()
.setRoutePlanner(routePlanner)
.build();
Upvotes: 0
Reputation: 1527
I have not tried this, but ...
Fiddler establishes itself as a proxy server, listening on localhost:8888
You can configure Java to use a proxy server with the http.proxyHost
and http.proxyPort
(see http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html).
So, if you go into Eclipse and set the "VM" arguments to the following, it should route all traffic through Fiddler (which, of course, must be already running):
-Dhttp.proxyHost=localhost
-Dhttp.proxyPort=8888
This assumes that your application is using URLConnection
. If it's using Apache HttpClient or some other library, you may need to check the documentation for that library.
Upvotes: 17