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:

     

    -Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true
    
    
    
    
    
    

     

    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:

     

    lax.stdout.redirect=D:\\BMC\\AO\\CDP\\tomcat\\logs\\catalina.out
    
    

    (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">
       <soapenv:Header>
        <oas:Security xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <oas:UsernameToken>
            <oas:Username>user</oas:Username>
            <oas:Password>password</oas:Password>
          </oas:UsernameToken>
        </oas:Security>
      </soapenv:Header>
       <soapenv:Body>
          <soa:queryModuleNames>
             <soa:gridName>LabGrid</soa:gridName>
             <soa:pattern></soa:pattern>
          </soa:queryModuleNames>
       </soapenv:Body>
    </soapenv:Envelope>
    --------------------
    
    ---[HTTP response 200]---
    <?xml version='1.0' encoding='UTF-8'?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
       <S:Body>
         <ns1:queryModuleNamesResponse xmlns:ns1="http://bmc.com/ao/xsd/2008/09/soa">
             <ns1:ModuleName>Web_Services_Test_Case</ns1:ModuleName>
          </ns1:queryModuleNamesResponse>
       </S:Body>
    </S:Envelope>
    --------------------
    
    
    
    
    
    

     

    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.