8 Replies Latest reply on Jul 28, 2015 6:34 AM by objectiser

    How to log WS response message

    horyna

      Hi,

       

      i am wondering how to log WS payload response with Overlord. Using Jboss EAP 6.1.1 with default RedHat Overlord client (v1) and SwitchYard (v1.1). Below is me code. Request is logged sucessfully, but i dont see any activity for response

       

      Switchyard:

      <sca:service name="MyWsdlWS" promote="SomeComponent/SomeInterface">

            <sca:interface.wsdl interface="MyWsdl.wsdl#wsdl.porttype(MyWsdlPort)"/>

            <soap:binding.soap>

              <soap:wsdl>MyWsdl.wsdl</soap:wsdl>

              <soap:wsdlPort>MyWsdlPort</soap:wsdlPort>

              <soap:contextPath>MyWsdlService</soap:contextPath>

            </soap:binding.soap>

          </sca:service>

       

      ip.json type processors:

      "{http://mywsdlnamespace}operation"

      "{http://mywsdlnamespace}operationOutput"

       

      Storing data into DB. Also in RTGOV_ACTIVITIES are:

      RequestReceived, content=<?xml version="1.0" encoding="UTF-8"?><ns:operation xmlns...,messagetype={mywsdlnamespace}operation <-- so far Ok-->

      ResponseSent, context=null, messagetype=my.packages.OperationOutput <-- why not, but i want to log a WS payload too, why is not here? How to do it? -->

        • 1. Re: How to log WS response message
          objectiser

          The message that is logged is based on the information provided by the specific event hook (i.e. switchyard event listener). So in the case of the response, at the point the event listener is triggered, the exchange contains a Java object. This is then transformed as part of the binding when returning the response to the client.

           

          One thing you could try, is to define a transformer in the ip.json for the returned type (my.packages.OperationOutput) using an mvel expression that invokes a utility (that you would need to provide) to transform the message content into XML. If the utility classes are packages in the same war as the ip.json, then it should work - although I've not actually tried this out.

          • 2. Re: How to log WS response message
            horyna

            So bad

            Is it possible to define some listener which will be activated on activity creating to edit it? Or define a custom switchyard listener with will create and record self activity? My next idea was create and record my self activity in soa.composer.decompose - but aktivity unit is already closed and newly created record has new unit ID

            • 3. Re: How to log WS response message
              objectiser

              The switchyard listener mechanism used in rtgov is a separate component (which can be undeployed), so if you find a more appropriate interceptor point for your needs, then you could write your own listener and create the same types of rtgov activity events.

               

              The code used by RTGov to listener for switchyard events and report them as activity events is here: https://github.com/Governance/rtgov/tree/master/integration/switchyard/src/main/java/org/overlord/rtgov/internal/switchyard

              • 4. Re: How to log WS response message
                horyna

                May be is not a bad idea somehow consider to log WS payload after SW composers are finish. Our need is just log request/response how its come/leaves the server - within one activity unit. Some of this can i do with custom code (like you mention above). But SW composer (decompose method) is executed AFTER activity unit is closed - and at this point i have no chance to log server response into same activity unit. Or am i wrong? Can i somehow control the activity unit end?

                • 5. Re: How to log WS response message
                  horyna

                  I was looking for some events with Switchyard fire after calling message composer, but it looks like there are no one ...

                  • 6. Re: How to log WS response message
                    objectiser

                    That is why in my previous response I said that you should replace the current overlord-rtgov-switchyard.war with your own integration with switchyard - then you are in control of when the activity unit starts and ends.

                    • 7. Re: How to log WS response message
                      horyna

                      I need to replace ExchangeCompletionEventProcessor with me own. Any possibility? After looks into EventProcessorManager i dont see any chance.

                      • 8. Re: How to log WS response message
                        objectiser

                        As mentioned before, simply take a copy of ALL of the code in the overlord-rtgov-switchyard.war module (rtgov/integration/switchyard at master · Governance/rtgov · GitHub) and build your own version of that war making whatever code changes you want.