Search code examples
javaloggingsoapguidewire

log SOAP messages in Guidewire Insurance Suite


I want to catch the SOAP communication between my GW applications (Claim Center and Contact Manager). I'd like to make CC or CM write the requests and responses to the log file, or at least to see them through debugger somehow. It seems to me that Guidewire's framework does not help regarding this.

I have tried setting the system properties but it does not work, maybe the framework overrides them somehow. I have also tried to define and utilize a SOAPHandler but it works with a @WebService implementation, and my web service (Contact Manager's ABContactAPI) is defined in other way, using the framework. Is there a way to fit Guidewire's web service into this scenario ? Or some other way to make Guidewire's web service log its SOAP messages somewhere ? Or to make Guidewire's web client code log its SOAP messages ?


Solution

  • Not sure if I fully understand your case as you keep referring to the JAX-WS implementation and just to be clear Guidewire Soap framework does not use JAX-WS.

    There is an "easy" way to log the whole SOAP envelop if you are using @WsiWebService Soap server or utilising the WebServiceCollections Soap client. You have to simply register a transformer by attaching it to the web service server class like this:

    @WsiRequestTransform(MySoapServer._loggingRequestTransformer)
    

    You can do the same with the @WsiResponseTransform to catch the response. The transformer is simply a block consuming and returning InputStream of type like:

    block(InputStream) : InputStream
    

    It's somewhat similar for the client. There you have to register a Configuration Provider in the "wsc" file. And then in the implementation of it you have access to the config object where in similar way you can register your request/response transformers.

    config.RequestTransform = _logWebServicePayload
    

    There are however few caveats to this approach.

    • It will invoke the transformer for every single request/response while the transformer is registered so be 100% sure the transformer isn't logging your payload all the time esp. in Production! (only do any work there if for example the "_LOGGER.DebugEnabled")
    • It requires you to return the InputStream and you most likely want to return the same information that you got in so extract it and wrap it again into some buffered InputStream or something similar
    • Soap payloads sometimes contain sensitive data or PII data so be very careful what you do with those logs and that you have permission to dump such information into the logs. I typically register separate loggers and appenders for that so they can be dealt with proper care and additional infra setup

    So please only do this if you really need to and ensure it does not run in PROD 100% of the time and that you have takes all the necessary actions.