Hoverfly - capturing request & responses for micro services - proxy

I am trying to capture request & response from an application using Hoverfly. The Hoverfly is installed on a machine and set to proxy with capture mode.
The application is a web application deployed in Weblogic in linux box. The application internally uses soap requests to communicate to a Tibco ESB server and fetch details from provider systems. I want to capture the soap requests & responses between application server & ESB.
To capture the request & response I have set proxy on the application server in following ways:
1) Add the proxy parameters in setDomianEnv.sh script of application server
EXTRA_JAVA_PROPERTIES="-Dhttp.proxyHost=10.0.0.1 -Dhttp.proxyPort=8500 ${EXTRA_JAVA_PROPERTIES}"
export EXTRA_JAVA_PROPERTIES
2) add the proxy parametes in JVM startup parameters of application
3) set proxy for os level user
http_proxy=http://10.0.0.1:8500
In all the three cases I have failed to capture requests & responses in Hoverfly.
Are there any other ways to do the same or any additional settings to be done to route the request & response through the proxy?

That should be sufficient. Is your SOAP service HTTP or HTTPS ? if HTTP this should work. If HTTPS you need to add the self signed Hoverfly certificate to your Weblogic JVM truststore (jre/lib/security/cacerts) to be able to capture those HTTPS requests. Also in case of HTTPS communication, the JVM args should be -Dhttps.proxyPort and -Dhttps.proxyHost
In my opinion, OS level proxy is not required as long as the JVM parameters are set.
Make sure Hoverfly is running and in the Hoverfly Dashboard page, you should set it in Capture mode and when you invoke the services from your Weblogic server, the Capture count in Hoverfly Dashboard should increase. And that's a sign of everything is working.

Related

Control Liberty http endpoint enablement

I have 2 war in my server. First starts very rapidly but the second one is longer to start.
My server is able to respond to REST calls when fast one is started but it seems that HTTP endpoint can only be accessed when both applications are started.
Is there a way to control this so that I can respond rapidely to REST calls with first application and let the second application startup in the background.
Yes, check this post - Configure IBM Websphere Liberty Profile Server Start & Stop timeout.
You can set <applicationManager startTimeout="1m"/> setting to tell server not to wait for applications that start longer than timeout. Be aware that any request that comes into an application that is not ready to serve requests will return a HTTP 404 response.

If request sent through jmeter, in glassfish clustering requests are not segregating to different servers

For the application server set as clustering in glass fish. I have sent request through jmeter and all the requests hits to only one server . Expected was requests should be distributed to multiple servers in the cluster. But if sent requests manually clustering is working. Please help to sort out this issue
There could be different clustering load balancing mechanisms, as far as I can see from the GlassFish Server High Availability Administration Guide:
Cookie Method
The Loadbalancer Plug-In uses a separate cookie to record the route information. The HTTP client (typically, the web browser) must support cookies to use the cookie based method. If the HTTP client is unable to accept cookies, the plug-in uses the following method.
Explicit URL Rewriting
The sticky information is appended to the URL. This method works even if the HTTP client does not support cookies. To implement explicit URL rewriting, the application developer must use HttpResponse.encodeURL() and encodeRedirectURL() calls to ensure that any URLs in the application have the session information appended to them.
So depending on your Load Balancer configuration you need to
Either define either different cookies in the HTTP Cookie Manager
Or make sure different threads send requests to different URLs i.e. via HTTP URL Re-writing Modifier
In any case it is recommended to add DNS Cache Manager so each virtual user would resolve the underlying IP address of the application under test on its own.

Use JMeter HTTP Proxy to record HTTP request from not-a-browser client

I have a client/server configuration.
In the client I have an application that talks to the server by http/https withou a browser being used.
I want to know how to configure client and jmeter to record the http requests being send from client to server
The client is a Windows 10 machine.
There can be several options:
Your application has dedicated proxy configuration. In this case just configure it to use JMeter as a proxy
Your application respects OS-level proxy settings. For Windows 10 hit "Win + S" and type "proxy". Perform proxy configuration at all available locations:
If everything goes well you should be able to record your application network activity using JMeter. Refer to How to Run Performance Tests of Desktop Applications Using JMeter for a little bit more detailed information and some troubleshooting steps.

How to get a web server to send outbound http requests through local fiddler proxy?

I'm running a local web server written in Go and I can debug traffic going to it from my browser; but, I can't see the http request that it makes to external services.
Do I have to run some particular configuration of the web server in order to get the traffic to appear in fiddler? It is running as a background process.
Short answer: you can't...
...unless your web application is written to open a connection to a Proxy server and route requests through that connection (e.g. connect to a remote proxy, and then send requests through it).
Typically what developers do is just dump the Web Request/Response to a debug file to inspect during development (or to debug on a live server, by enabling it with a flag at runtime).
Fiddler is a "proxy" service/server. When you are using it normally to debug browser requests, your Browser is configured to connect to a Proxy server. That is, it will send all web requests through your fiddler's local server (I think it's localhost:8888 if i remember from my Windows days of using Fiddler) which in turn makes a connection to your local web server that you are debugging.
You can read more about Proxies at Wikipedia.
In that picture above, your local web server would be Alice. Meaning, Alice would need to be configured to connect to a proxy server and then make web requests through it.
EDIT:
(for the "I really need this" crowd)
If you really want to modify your web server to send requests through a proxy, there are a few Go packages already written to help you. GoProxy is one such package.

What is a 1/2 way ssl request

What does it mean when an application calls another application via 2 way SSL.
Does it mean that an external application calls another application via https and also receives a https response.
Similarly if it was one way SSL, does it mean it sends a https request but the response will be http.

Resources