Logging inbound web services requests

Version 5
    Share This:

    When calling ORCA web services from other systems, sometimes it can be beneficial to log the SOAP calls received from those systems. The standard logging doesn't currently go quite that far, so we can make use of some logging at the Java level to do this instead.


    We need to add an option to the CDP's Java command-line:




    On Linux servers this can be modified in the bin/server.sh file (add to the JAVA_OPTS). On Windows servers you can edit the .LAX file in the bin folder and add the option to the end of the lax.nl.java.option.additional parameter. NOTE: with version 7.7 the LAX file might have been replaced by a .bat file.


    For AO 7.6.02 on Windows, I also needed to set the following in the LAX file:



    (Change the path to suit your environment.)


    Restart the CDP for this change to take effect.


    Whenever a web services request is received, it will now log the request and response in the catalina.out file in the usual Tomcat logs folder. For example:


    ---[HTTP request]---
    accept-encoding: gzip,deflate
    connection: Keep-Alive
    content-length: 637
    content-type: text/xml;charset=UTF-8
    host: aocdp.mydomain.com:12031
    soapaction: "urn:queryModuleNames"
    user-agent: Apache-HttpClient/4.1.1 (java 1.5)
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soa="http://bmc.com/ao/xsd/2008/09/soa">
        <oas:Security xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    ---[HTTP response 200]---
    <?xml version='1.0' encoding='UTF-8'?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
         <ns1:queryModuleNamesResponse xmlns:ns1="http://bmc.com/ao/xsd/2008/09/soa">


    Note that this will not work for legacy web services. There is an option in the peer logging to enable DEBUG output in the grid.log for "web services" -- this will show requests made to the legacy web service. It doesn't include HTTP headers, but does show the received request.