Enabling SOAP Request and Response Logging in JBoss EAP 7

Logging SOAP request and response messages in JBoss EAP 7 can help with debugging and monitoring. This guide walks through configuring JBoss to log JAX-WS messages without restarting the server. Step 1: Configure Logging in standalone.xml Modify the standalone.xml file to include a periodic rotating file handler and loggers for JAX-WS: Add the Periodic Rotating File Handler Insert the following under : Add Loggers for JAX-WS Insert the following inside the section: Step 2: Enable SOAP Message Dumping in standalone.conf Edit standalone.conf to add the required system properties: JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dump=true" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dumpTreshold=2147483647" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold=2147483647" Step 3: Apply Changes Without Restarting JBoss (Optional) If you cannot restart JBoss, use the CLI to apply logging changes dynamically: Add the Logging Handler Run the following command in JBoss CLI: /subsystem=logging/periodic-rotating-file-handler=JaxWsFileHandler:add(autoflush=true, file={"relative-to" => "jboss.server.log.dir", "path" => "myapp_soap_requests.log"}, suffix=".yyyy-MM-dd", append=true, named-formatter="PATTERN") Add Loggers /logger=com.sun.xml.ws:add(level=FINE, handlers=["JaxWsFileHandler"]) /logger=com.sun.xml.ws.transport.http:add(level=FINEST, handlers=["JaxWsFileHandler"]) /logger=com.sun.xml.ws.server:add(level=FINEST, handlers=["JaxWsFileHandler"]) Step 4: Verify Logs Once configured, you should see SOAP request and response logs in myapp_soap_requests.log under the JBoss log directory. Why This Solution Matters This logging setup is crucial for debugging and monitoring SOAP web services. It allows developers to inspect incoming and outgoing SOAP messages, making it easier to identify issues, optimize performance, and ensure compliance with API requirements. The ability to apply these changes dynamically without a restart ensures minimal downtime and enhances production debugging capabilities. What You Can Do with This Solution Debug SOAP Issues: Capture full request and response payloads for troubleshooting. Monitor API Activity: Track SOAP messages to ensure correct integration and detect anomalies. Enhance Security Auditing: Log SOAP traffic for compliance and security reviews. Minimize Downtime: Make logging adjustments dynamically without restarting JBoss. Following this guide ensures SOAP messages are logged efficiently without requiring a server restart. Let me know if you encounter issues!

Mar 11, 2025 - 08:24
 0
Enabling SOAP Request and Response Logging in JBoss EAP 7

Logging SOAP request and response messages in JBoss EAP 7 can help with debugging and monitoring. This guide walks through configuring JBoss to log JAX-WS messages without restarting the server.

Step 1: Configure Logging in standalone.xml

Modify the standalone.xml file to include a periodic rotating file handler and loggers for JAX-WS:

Add the Periodic Rotating File Handler

Insert the following under :

 name="JaxWsFileHandler" autoflush="true">
    
         name="PATTERN"/>
    
     relative-to="jboss.server.log.dir" path="myapp_soap_requests.log"/>
     value=".yyyy-MM-dd"/>
     value="true"/>

Add Loggers for JAX-WS

Insert the following inside the section:

 category="com.sun.xml.ws">
     name="FINE"/>
    
         name="JaxWsFileHandler"/>
    

 category="com.sun.xml.ws.transport.http">
     name="FINEST"/>
    
         name="JaxWsFileHandler"/>
    

 category="com.sun.xml.ws.server">
     name="FINEST"/>
    
         name="JaxWsFileHandler"/>
    

Step 2: Enable SOAP Message Dumping in standalone.conf

Edit standalone.conf to add the required system properties:

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dump=true"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dumpTreshold=2147483647"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold=2147483647"

Step 3: Apply Changes Without Restarting JBoss (Optional)

If you cannot restart JBoss, use the CLI to apply logging changes dynamically:

Add the Logging Handler

Run the following command in JBoss CLI:

/subsystem=logging/periodic-rotating-file-handler=JaxWsFileHandler:add(autoflush=true, file={"relative-to" => "jboss.server.log.dir", "path" => "myapp_soap_requests.log"}, suffix=".yyyy-MM-dd", append=true, named-formatter="PATTERN")

Add Loggers

/logger=com.sun.xml.ws:add(level=FINE, handlers=["JaxWsFileHandler"])
/logger=com.sun.xml.ws.transport.http:add(level=FINEST, handlers=["JaxWsFileHandler"])
/logger=com.sun.xml.ws.server:add(level=FINEST, handlers=["JaxWsFileHandler"])

Step 4: Verify Logs

Once configured, you should see SOAP request and response logs in myapp_soap_requests.log under the JBoss log directory.

Why This Solution Matters

This logging setup is crucial for debugging and monitoring SOAP web services. It allows developers to inspect incoming and outgoing SOAP messages, making it easier to identify issues, optimize performance, and ensure compliance with API requirements. The ability to apply these changes dynamically without a restart ensures minimal downtime and enhances production debugging capabilities.

What You Can Do with This Solution

  • Debug SOAP Issues: Capture full request and response payloads for troubleshooting.
  • Monitor API Activity: Track SOAP messages to ensure correct integration and detect anomalies.
  • Enhance Security Auditing: Log SOAP traffic for compliance and security reviews.
  • Minimize Downtime: Make logging adjustments dynamically without restarting JBoss.

Following this guide ensures SOAP messages are logged efficiently without requiring a server restart. Let me know if you encounter issues!