如图所示,我们可以找到HttpClient的API地址,通过账号密码我们可以在浏览器中获得相关的RabbitMQ的数据。
当我们获得所有的API以后,我们可以通过HttpClient远程调用API获得RabbitMQ的队列、交换机等信息。
但是我们是使用HttpClient会获得如下异常:
错误一:报405异常
18:18:05.793 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
18:18:05.819 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
18:18:05.821 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://127.0.0.1:15672][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
18:18:05.855 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://127.0.0.1:15672][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
18:18:05.858 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {}->http://127.0.0.1:15672
18:18:05.864 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to /127.0.0.1:15672
18:18:05.867 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 127.0.0.1:15649<->127.0.0.1:15672
18:18:05.867 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /api/exchanges HTTP/1.1
18:18:05.868 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
18:18:05.869 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
18:18:05.874 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /api/exchanges HTTP/1.1
18:18:05.874 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 0
18:18:05.874 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: 127.0.0.1:15672
18:18:05.874 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
18:18:05.874