Вопрос

I have simple proxy with send messages to some url. I would like to know when something is send through proxy, and when response is send back.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SynchronizeService" transports="https http" startOnLoad="true" trace="disable">
  <target>
    <inSequence>
      <log level="simple"/>

      <send>
        <endpoint key="SynchronizeServiceEndpoint"/>
      </send>
    </inSequence>

    <outSequence>
      <log level="simple"/>

      <send/>
    </outSequence>
  </target>
</proxy>

I added log mediator but the problem is, it don't log any information which allow to connect request and response. So example log looks like:

[2013-06-03 15:38:07,914]  INFO - LogMediator To: http://esb-ip:9763/services/SynchronizeService, WSAction: http://test.pl/WebService/getWorkPlan, SOAPAction: http://test.pl/WebService/getWorkPlan, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:36b60af3-dc30-4004-a239-26523774f52b, Direction: request

[2013-06-03 15:38:08,016]  INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:8f753934-c64a-4276-a916-dceaeda3def0, Direction: response

In logged response there is no information about SOAPAction, messageIds are different. How can I connect request with response in logs? I would like to known when response was send. How can I do this?

Это было полезно?

Решение 2

I didn't know that is is possible to assign variables in input Sequence and use them in output Sequence. I assign messageId from input sequence and log it in output. My proxy after changes looks like:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SynchronizeService" transports="https http" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <log level="simple"/>

            <property name="requestSysDate" expression="get-property('SYSTEM_DATE')" scope="default" type="STRING"/>
            <property name="requestMsgId" expression="get-property('MessageID')" scope="default" type="STRING"/>

            <filter xmlns:procsyn="http://test.pl/WebService/Synchronize" xpath="//procsyn:getWorkPlanIn">
                <property name="requestMethod" value="getWorkPlan" scope="default" type="STRING"/>
            </filter>

            <send>
                 <endpoint key="SynchronizeServiceEndpoint"/>
            </send>
        </inSequence>

        <outSequence>
            <log level="custom">
                <property name="proxyName" value="SynchronizeService"/>
                <property name="requestMethod" expression="get-property('requestMethod')"/>
                <property name="requestSysDate" expression="get-property('requestSysDate')"/>
                <property name="requestMsgId" expression="get-property('requestMsgId')"/>
            </log>

            <send/>
        </outSequence>
    </target>
</proxy>

Другие советы

You did a simple log, which will log very basic info about the message. Do a log level=full, that will log the full message which is passed through the system

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top