When troubleshooting HTTP invocation issues, it might be necessary to capture request and response messages including headers in some scenarios. This article discusses a few different options for capturing HTTP messages in TIBCO ActiveMatrix BusinessWorks™ 5 (BW).
1. SSL debug logging
If the invocation is over TLS (HTTPS), TLS debug logs will contain the request and response messages. Instructions for enabling SSL debug logging can be found here.
Sample log
javax.net.ssl|FINE|32|Send HTTP Request0|2022-05-07 18:11:38.619 EDT|SSLCipher.java:1720|Plaintext before ENCRYPTION ( 0000: 50 4F 53 54 20 2F 20 48 54 54 50 2F 31 2E 31 0D POST / HTTP/1.1. 0010: 0A 68 6F 73 74 3A 20 31 30 2E 39 37 2E 34 38 2E .host: 10.97.48. 0020: 31 30 35 3A 35 30 38 33 0D 0A 63 6F 6E 6E 65 63 105:5083..connec 0030: 74 69 6F 6E 3A 20 63 6C 6F 73 65 0D 0A 63 6F 6E tion: close..con 0040: 74 65 6E 74 2D 74 79 70 65 3A 20 74 65 78 74 2F tent-type: text/ 0050: 68 74 6D 6C 3B 63 68 61 72 73 65 74 3D 55 54 46 html;charset=UTF 0060: 2D 38 0D 0A 61 63 63 65 70 74 2D 65 6E 63 6F 64 -8..accept-encod 0070: 69 6E 67 3A 20 67 7A 69 70 0D 0A 61 63 63 65 70 ing: gzip..accep 0080: 74 3A 20 69 6D 61 67 65 2F 67 69 66 2C 20 69 6D t: image/gif, im 0090: 61 67 65 2F 78 2D 78 62 69 74 6D 61 70 2C 20 69 age/x-xbitmap, i 00A0: 6D 61 67 65 2F 6A 70 65 67 2C 20 69 6D 61 67 65 mage/jpeg, image 00B0: 2F 70 6A 70 65 67 2C 20 69 6D 61 67 65 2F 70 6E /pjpeg, image/pn 00C0: 67 2C 20 2A 2F 2A 0D 0A 61 63 63 65 70 74 2D 63 g, */*..accept-c 00D0: 68 61 72 73 65 74 3A 20 69 73 6F 2D 38 38 35 39 harset: iso-8859 00E0: 2D 31 2C 2A 2C 75 74 66 2D 38 0D 0A 43 6F 6E 74 -1,*,utf-8..Cont 00F0: 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 31 39 0D 0A ent-Length: 19.. 0100: 55 73 65 72 2D 41 67 65 6E 74 3A 20 41 70 61 63 User-Agent: Apac 0110: 68 65 2D 48 74 74 70 43 6C 69 65 6E 74 2F 34 2E he-HttpClient/4. 0120: 35 2E 35 20 28 4A 61 76 61 2F 31 2E 38 2E 30 5F 5.5 (Java/1.8.0_ 0130: 32 38 31 29 0D 0A 0D 0A 54 68 69 73 20 69 73 20 281)....This is 0140: 74 68 65 20 72 65 71 75 65 73 74 the request ) javax.net.ssl|FINE|32|Send HTTP Request0|2022-05-07 18:11:38.681 EDT|SSLCipher.java:1622|Plaintext after DECRYPTION ( 0000: 48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F 4B 0D HTTP/1.1 200 OK. 0010: 0A 53 65 72 76 65 72 3A 20 41 70 61 63 68 65 2F .Server: Apache/ 0020: 48 74 74 70 43 6F 6D 70 6F 6E 65 6E 74 73 31 2E HttpComponents1. 0030: 31 0D 0A 44 61 74 65 3A 20 53 61 74 2C 20 30 37 1..Date: Sat, 07 0040: 20 4D 61 79 20 32 30 32 32 20 32 32 3A 31 31 3A May 2022 22:11: 0050: 33 38 20 47 4D 54 0D 0A 43 6F 6E 74 65 6E 74 2D 38 GMT..Content- 0060: 4C 65 6E 67 74 68 3A 20 32 30 0D 0A 43 6F 6E 74 Length: 20..Cont 0070: 65 6E 74 2D 54 79 70 65 3A 20 74 65 78 74 2F 68 ent-Type: text/h 0080: 74 6D 6C 3B 63 68 61 72 73 65 74 3D 55 54 46 2D tml;charset=UTF- 0090: 38 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 63 8..Connection: c 00A0: 6C 6F 73 65 0D 0A 0D 0A 54 68 69 73 20 69 73 20 lose....This is 00B0: 74 68 65 20 72 65 73 70 6F 6E 73 65 the response )
2. Network packet capture
If the invocation is not over TLS (HTTP), the request and response messages can be extracted from network packets.
On Linux machines, use tcpdump to capture network packets. On Windows, use Wireshark. If Wireshark is not available on the machine where the BW applicaiton is running, some other options for capturing network packets on Windows machines can be found here.
Extracting HTTP messages from packet capture output
Open the packet capture output in Wireshark. Use a filter to list the relevant network packets. For example, if the server is listening on port 5083, use the filter tcp.port==5083.
Right-click on one of the packets, click on Follow and then click on TCP Stream.
The data exchanged over the connection will be shown in a new window.
3. Apache HttpClient debug logging
In cases where BW is the client (Send HTTP Request/SOAP Request Reply), it is possible to get the request and response messages logged by enabling Apache HttpClient debug logging. Instructions for enabling Apache HttpClient debug logging can be found here.
Sample log
2022 May 07 18:00:27:438 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "POST / HTTP/1.1[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "host: 10.97.48.105:5083[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "connection: close[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "content-type: text/html;charset=UTF-8[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "accept-encoding: gzip[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "accept-charset: iso-8859-1,*,utf-8[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "Content-Length: 19[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_281)[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "[\r][\n]" 2022 May 07 18:00:27:454 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 >> "This is the request" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "Server: Apache/HttpComponents1.1[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "Date: Sat, 07 May 2022 22:00:27 GMT[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "Content-Length: 20[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "Content-Type: text/html;charset=UTF-8[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "Connection: close[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "[\r][\n]" 2022 May 07 18:00:27:532 GMT -0400 BW.SimpleHTTP Debug [org.apache.http.wire] BW-EXT-LOG-300002 http-outgoing-0 << "This is the response"
- 1
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now