WSO2 API Manager, where can I find the log of gateway? - wso2

such as the title, where can i find the log of gateway which is only about the api`s request and response?
in the file of wso2-apigw-trace.log,I can find nothing.

You can write synapse wire logs to a separate file with an appender like this.
# WIRE_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
log4j.appender.WIRE_LOGFILE=org.wso2.carbon.utils.logging.appenders.CarbonDailyRollingFileAppender
log4j.appender.WIRE_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2wire${instance.log}.log
log4j.appender.WIRE_LOGFILE.Append=true
log4j.appender.WIRE_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.WIRE_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.WIRE_LOGFILE.layout.TenantPattern=%U%#%D [%T] [%S]
log4j.appender.WIRE_LOGFILE.threshold=DEBUG
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG, WIRE_LOGFILE
log4j.additivity.org.apache.synapse.transport.http.wire=false

If you want to log request and response with a correlation id, you can write a custom sequence. Correlation id can be taken from message_id like this.

You can also get access to the log via Log Analyzer UI in Admin Portal.
Here are the instructions on how to do this in WSO2 API Cloud (hosted version of API Manager).
If you want to have details of the calls to the backend and responses in the logs, you need to also add mediation policies that would output the data. This can be done on the second step of API editing ("Implement"), as shown in the picture below:
API Cloud has these sequences pre-installed. For your own API Manager deployment, you would have to upload them manually. Here are the XML files:
In Flow:
<sequence name="debug_in_flow" xmlns="http://ws.apache.org/ns/synapse">
<log level="full" />
<log level="custom">
<property name="Host" expression="get-property('transport', 'Host')"/>
<property name="Context" expression="get-property('To')"/>
<property name="HTTP_METHOD" expression="get-property('axis2', 'HTTP_METHOD')"/>
<property name="Resource" expression="$axis2:REST_URL_POSTFIX"/>
<property name="Origin" expression="get-property('transport', 'Origin')"/>
<property name="Content-Type" expression="get-property('transport', 'Content-Type')"/>
</log>
</sequence>
Out Flow:
<sequence name="debug_out_flow" xmlns="http://ws.apache.org/ns/synapse">
<log level="full" />
<log level="custom">
<property name="EndPoint" expression="get-property('ENDPOINT_PREFIX')"/>
<property name="Content-Type" expression="get-property('transport', 'Content-Type')"/>
</log>
</sequence>
Fault Flow:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="debug_json_fault">
<log level="custom">
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns3="http://org.apache.synapse/xsd"
name="ERROR_CODE"
expression="get-property('ERROR_CODE')"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns3="http://org.apache.synapse/xsd"
name="ERROR_MESSAGE"
expression="get-property('ERROR_MESSAGE')"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns3="http://org.apache.synapse/xsd"
name="ERROR_DETAIL"
expression="get-property('ERROR_DETAIL')"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns3="http://org.apache.synapse/xsd"
name="ERROR_EXCEPTION"
expression="get-property('ERROR_EXCEPTION')"/>
<property name="EndPoint" expression="get-property('ENDPOINT_PREFIX')"/>
<property name="Content-Type" expression="get-property('transport', 'Content-Type')"/>
</log>
<payloadFactory>
<format>
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>$1</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>$2</am:description>
</am:fault>
</format>
<args>
<arg expression="$ctx:ERROR_CODE"/>
<arg expression="$ctx:ERROR_MESSAGE"/>
</args>
</payloadFactory>
<filter xpath="$ctx:CUSTOM_HTTP_SC">
<then>
<property name="HTTP_SC" expression="$ctx:CUSTOM_HTTP_SC" scope="axis2"/>
</then>
<else>
<property name="HTTP_SC" value="500" scope="axis2"/>
</else>
</filter>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtFaultHandler"/>
<property name="RESPONSE" value="true"/>
<header name="To" action="remove"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<property name="ContentType" scope="axis2" action="remove"/>
<property name="Authorization" scope="transport" action="remove"/>
<property name="Host" scope="transport" action="remove"/>
<property name="Accept" scope="transport" action="remove"/>
<property name="X-JWT-Assertion" scope="transport" action="remove"/>
<property name="messageType" value="application/json" scope="axis2"/>
<send/>
<drop/>

I think you can find those log records from http_access_<Date>.log
File path: <APIM Home>/repositary/logs/http_access_<Date>.log

Related

Why WSO2 API Manger can't execute PUT request when Mediation Policies is exist?

I have mediation settings for request and response:
for request(jms_in_flow):
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="jms_in_flow" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property name="transactionId" expression="get-property('MessageID')"/>
<clone continueParent="true">
<target>
<sequence>
<property action="remove" name="OUT_ONLY" value="true"/>
<property expression="$ctx:api.ut.api_version" name="api_version" scope="transport" type="STRING"/>
<property expression="$ctx:api.ut.version" name="api_short_version" scope="transport" type="STRING"/>
<property expression="$ctx:api.ut.requestTime" name="api_request_time" scope="transport" type="STRING"/>
<property expression="$ctx:REST_API_CONTEXT" name="api_context" scope="transport" type="STRING"/>
<property expression="$ctx:API_NAME" name="api_name" scope="transport" type="STRING"/>
<property name="api_message_id" expression="get-property('transactionId')" scope="transport"/>
<property value="REQUEST" name="api_message_type" scope="transport" type="STRING"/>
<property expression="$ctx:REST_FULL_REQUEST_PATH" name="api_request_path" scope="transport" type="STRING"/>
<property expression="$ctx:api.ut.HTTP_METHOD" name="api_method" scope="transport" type="STRING"/>
<property expression="$ctx:api.ut.application.name" name="api_app_name" scope="transport" type="STRING"/>
<property expression="$ctx:api.ut.userName" name="api_username" scope="transport" type="STRING"/>
<call>
<endpoint>
<address uri="jms:"AAA"/>
</endpoint>
</call>
<drop/>
<send/>
</sequence>
</target>
</clone>
for response(jms_out_flow):
<sequence name="jms_out_flow" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<clone continueParent="true">
<target>
<sequence>
<property name="RESPONSE" value="true"/>
<property name = "api_response_time" expression = "get-property('SYSTEM_TIME')" scope="transport"/>
<property name="api_message_id" expression="get-property('transactionId')" scope="transport"/>
<property value="RESPONSE" name="api_message_type" scope="transport" type="STRING"/>
<property expression="$axis2:HTTP_SC" name="http_status" scope="transport" type="STRING"/>
<call>
<endpoint>
<address uri="jms:/AAA"/>
</endpoint>
</call>
<drop/>
</sequence>
</target>
</clone>
When I execute GET request on WSO2 Manager it executes fast and successful, and PUT request is not execute and falls off after the time expires(~2min). When I remove the mediator settings for the request (jms_in_flow), PUT request starts working normally.
I think that the error is in jms_in_flow, but I can't find it.
I found in google: Enter link description here
The processing of get and put methods is different, but I don’t know how to apply it.
UPDATE.
LOGS
[2019-07-01 13:38:06,083] ERROR - Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: Did not receive a JMS response within 30000 ms to destination : temp-queue://ID:c115c33d0c81-45342-543:1:1 with JMS correlation ID : ID:c115c33d0c81-45342-543:1:1:1:1
at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:234)
at org.apache.axis2.transport.jms.JMSSender.waitForResponseAndProcess(JMSSender.java:435)
at org.apache.axis2.transport.jms.JMSSender.sendOverJMS(JMSSender.java:369)
at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:192)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:603)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:85)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:511)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:384)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
at org.apache.synapse.mediators.builtin.CallMediator.handleNonBlockingCall(CallMediator.java:276)
at org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:121)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
I'm not sure this is related. But I think you need <property action="remove" name="OUT_ONLY" value="true"/> in the out sequence too.

No password supplied by the callback handler for the user [wso2]

I have a proxy service inlclued a sequence.
I process for authentication for proxy service with tag
<policy key="gov:/testPolicy"/>
<enableSec/>
In this sequence contain iterate mediator.
When call proxy service with authentication by soapUI then not reponse for client and have a error Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender} org.apache.axis2.AxisFault: No password supplied by the callback handler for the user : "wso2carbon"
If have not iterate mediator then have not error
This sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="SendReceiveQueue" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="get-property('Edxml_Organ_Id')" name="senderUnitId" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="get-property('Edxml_Type')" name="applicationType" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="get-property('Edxml_Record_Code')" name="recordCode" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="$ctx:data_original" name="messagePl" scope="default" type="STRING" xmlns:edXML="http://www.mic.gov.vn/TBT/QCVN_102_2016" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="$body" name="messagePlBody" scope="default" type="STRING" xmlns:edXML="http://www.mic.gov.vn/TBT/QCVN_102_2016" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="QUEUE_ACTION_TYPE" scope="default" type="STRING" value="SENDER"/>
<log level="custom">
<property expression="get-property('messagePl')" name="messagePllogging" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="get-property('messagePlBody')" name="messagePlloggingBody" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<iterate expression="$ctx:abc//edXML:To" id="abc" sequential="true" xmlns:edXML="http://www.mic.gov.vn/TBT/QCVN_102_2016" xmlns:ns="http://org.apache.synapse/xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<target>
<sequence>
<log level="custom">
<property name="goi DSS" value="-------------------------------------------"/>
<property expression="//edXML:To/edXML:OrganId/text()" name="queue name"/>
</log>
<payloadFactory media-type="xml">
<format>
<p:getQueueId xmlns:p="http://ws.wso2.org/dataservice">
<xs:in_unitId xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:in_unitId>
<xs:in_b2bType xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:in_b2bType>
</p:getQueueId>
</format>
<args>
<arg evaluator="xml" expression="//edXML:To/edXML:OrganId/text()"/>
<arg evaluator="xml" expression="syn:get-property('Edxml_Type')"/>
</args>
</payloadFactory>
<call blocking="true">
<endpoint>
<address uri="http://cqdt-app3:8280/services/validateData"/>
</endpoint>
</call>
<property expression="//x:returnCode/x:MessageQueueId/text()" name="queue_name" scope="default" type="STRING" xmlns:x="http://ws.wso2.org/dataservice"/>
<log level="custom">
<property name="lay xong tu dss" value="-------------------------------------------"/>
<property expression="$ctx:queue_name" name="ten queue lay ra"/>
</log>
<class name="com.vsc.ReceiveQueue">
<property name="password" value="admin"/>
<property name="queueName" value="testQueue1"/>
<property name="CF_NAME_PREFIX" value="connectionfactory."/>
<property name="CF_NAME" value="QueueConnectionFactory"/>
<property name="QPID_ICF" value="org.wso2.andes.jndi.PropertiesFileInitialContextFactory"/>
<property name="CARBON_DEFAULT_HOSTNAME" value="cqdt-app3"/>
<property name="QUEUE_NAME_PREFIX" value="queue."/>
<property name="userName" value="admin"/>
<property name="CARBON_CLIENT_ID" value="carbon"/>
<property name="CARBON_DEFAULT_PORT" value="5675"/>
<property name="CARBON_VIRTUAL_HOST_NAME" value="carbon"/>
</class>
<log level="custom">
<property name="put xong vao queue" value="-------------------------------------------"/>
<property expression="$ctx:queue_name" name="ten queue ban xong"/>
</log>
<payloadFactory media-type="xml">
<format>
<response>
<result>SUCCESS</result>
</response>
</format>
<args/>
</payloadFactory>
<property name="RESPONSE" scope="default" type="STRING" value="true"/>
<property name="messageType" scope="axis2" type="STRING" value="application/xml"/>
<property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
<header action="remove" name="To" scope="default"/>
<send/>
</sequence>
</target>
</iterate>
<property name="RESPONSE" scope="default" type="STRING" value="true"/>
<header action="remove" name="To" scope="default"/>
<log level="custom">
<property expression="get-property('messagePl')" name="1111555555555555555555555555551111111111111111111111111111111-------------------------------" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
</sequence>
Please help me!
Have you tried applying the policy on the endpoint directly?
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="TQBsEndpoint">
<address uri="http://cqdt-app3:8280/services/validateData" format="soap11">
<enableSec policy="gov:testPolicy"/>
</address>
</endpoint>

Unable to use call mediator in APIM 2.0.0

I've tried this on 1.10.0 and 2.0.0
On 1.10.0, you can disable the JMS sender in repository/conf/axis2/axis2_blocking_client.xml and use the call mediator in blocking mode. This is described in this blog post: http://shenavid.blogspot.nl/2016/08/invoking-external-endpoints-using-call.html and works ok. However this method does not work in 2.0.0 even though the related issue is marked as resolved.
Has anyone else tested this on 2.0.0 already? Or found an other workaround?
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="opal_auth_and_send"
onError="gov:apimgt/customsequences/fault/json_fault.xml"
trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<property description="ORG_PAYLOAD" expression="$body/child::node()"
name="ORG_PAYLOAD" scope="default" type="STRING"/>
<property description="URL_POSTFIX"
expression="get-property('axis2', 'REST_URL_POSTFIX')"
name="URL_POSTFIX" scope="default" type="STRING"/>
<property action="remove" description="Remove REST_URL_POSTFIX"
name="REST_URL_POSTFIX" scope="axis2"/>
<property action="remove" description="Remove transport headers"
name="TRANSPORT_HEADERS" scope="axis2"/>
<header name="Authorization" scope="transport" value="Basic xxxxxxxx"/>
<property description="set messageType" name="messageType"
scope="transport" type="STRING" value="application/json"/>
<call blocking="true" description="Get Auth token (blocking)">
<endpoint>
<http method="get" trace="enable" uri-template="https://opal-demo34.ortec-finance.com/auth/api/token"/>
</endpoint>
</call>
<property description="Get Token from Response"
expression="json-eval($.token)" name="TOKEN" scope="default" type="STRING"/>
<property action="remove" description="Remove transport headers"
name="TRANSPORT_HEADERS" scope="axis2"/>
<log description="Log auth result" level="full"/>
<property description="Restore REST_URL_POSTFIX"
expression="get-property('URL_POSTFIX')" name="REST_URL_POSTFIX"
scope="axis2" type="STRING"/>
<payloadFactory description="Restore Payload" media-type="json">
<format>$1</format>
<args>
<arg evaluator="xml" expression="get-property('ORG_PAYLOAD')"/>
</args>
</payloadFactory>
<header expression="get-property('TOKEN')" name="Authorization" scope="transport"/>
</sequence>
Thanks,
Danny

WSO2 ESB and IS Integration: handler tag is missing when we open the api source

I have created a API with name plantsapi and here is my api definition
<api xmlns="http://ws.apache.org/ns/synapse" name="plantsapi" context="/plantsapi">
<resource methods="POST DELETE PUT GET">
<inSequence>
<log level="custom">
<property name="Message Flow" value="Plant Search API API - IN"></property>
<property name="HTTP_METHOD IS###########" expression="$axis2:HTTP_METHOD"></property>
<property name="ip address" expression="get-property('axis2','REMOTE_ADDR')"></property>
<property name="In Time : " expression="get-property('SYSTEM_TIME')"></property>
</log>
<property name="TIME_IN" expression="get-property('SYSTEM_TIME')" scope="default" type="LONG"></property>
<property name="xacml_use_rest" value="true" scope="axis2" type="STRING"></property>
<property name="xacml_resource_prefix" value="/SearchService/api/plants" scope="axis2"></property>
<property name="xacml_resource_prefix_only" value="true" scope="axis2"></property>
<entitlementService remoteServiceUrl="https://172.20.13.153:9443/services" remoteServiceUserName="admin" remoteServicePassword="enc:kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg=" callbackClass="org.wso2.carbon.identity.entitlement.mediator.callback.UTEntitlementCallbackHandler" client="basicAuth">
<onReject>
<log level="custom">
<property name="Message Flow" value="REJECTED#"></property>
</log>
<property name="HTTP_SC" value="401" scope="axis2" type="STRING"></property>
<payloadFactory media-type="xml">
<format>
<oatherizationresponse xmlns="">Not Authorized </oatherizationresponse>
</format>
<args></args>
</payloadFactory>
<respond></respond>
</onReject>
<onAccept>
<log level="custom">
<property name="Message Flow" value="ACCEPTED#"></property>
</log>
<send>
<endpoint>
<address uri="http://172.20.13.153:8080/plant-service/api/"></address>
</endpoint>
</send>
<property name="TIME_OUT" expression="get-property('SYSTEM_TIME')" scope="default" type="LONG"></property>
<script language="js">var time1 = mc.getProperty("TIME_IN");var time2 = mc.getProperty("TIME_OUT");var timeTaken = time2 - time1;mc.setProperty("RESPONSE_TIME", timeTaken);</script>
<log level="custom">
<property name="Time Duration in ms:" expression="get-property('RESPONSE_TIME') "></property>
</log>
</onAccept>
<obligations></obligations>
<advice></advice>
</entitlementService>
</inSequence>
</resource>
<handlers>
<handler class="org.wso2.handler.SimpleOauthHandlerNew">
</handler>
</handlers>
</api>
Whenever I open the source view of the above API the handler tag is missing. and always getting 202 response. I am using wso2 ESB 4.8.1
Could you please advice me where is the mistake and how to sort out.
Regards,
Geetha
It is a known bug[1]. It will be fixed in ESB 4.9.0 (will be released soon). So don't update the API source view. If you update, you will loose the handlers.
[1] https://wso2.org/jira/browse/ESBJAVA-3395
And the solution is to use WSO2 Developer Studio. WSO2 does not recommend using the UI to do development, it is mainly used to monitor and view the instance.

How to get the value of propetry and set payload in proxy wso2 esb

Here is my proxy code:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ProviderPublication" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<filter xmlns:p="http://www.openoandm.org/xml/ISBM/" xpath="//p:OpenPublicationSession">
<then>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="ChannelURI" expression="//xs:ChannelURI" scope="default" type="STRING"/>
<class name="wso2.org.Communicator.OpenPublication">
<property name="channelURI" value="myChannelURI"/>
</class>
**<property name="sessionIDFromClassMediator" expression="get-property('SessionID')" scope="default" type="STRING"/>**
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:OpenPublicationSessionResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:SessionID>$1</ns1:SessionID>
</ns1:OpenPublicationSessionResponse>
</format>
<args>
<arg expression="get-property('sessionIDFromClassMediator')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<filter xpath="//p:PostPublication">
<then>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="SessionID" expression="//xs:SessionID" scope="default" type="STRING"/>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="Topic" expression="//xs:Topic" scope="default" type="STRING"/>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="Expiry" expression="//xs:Expiry" scope="default" type="STRING"/>
<property xmlns:ns="http://www.openoandm.org/xml/ISBM/" name="MessageContent" expression="//MessageContent" scope="default" type="STRING"/>
<class name="wso2.org.postPublication.PostPublication">
<property name="topic" value="Sports"/>
<property name="sessionID" value="session_001"/>
<property name="messagecontent" value="Cricket on air"/>
<property name="expiry" value="Monday"/>
</class>
<property name="getMessageIDFromClassMed" expression="get-property('MessageID')" scope="default" type="STRING"/>
<log level="full">
**<property name="SessionIDFromFstFltr" expression="get-property('sessionIDFromClassMediator')"/>**
</log>
I AM NOT ABLE TO GET THE PROPERTY VALUE OF sessionIDFromClassMediator SO MY FILTER NEVER GETS TRUE AND CAN'T GET INSIDE THE FILTER
**<filter xpath="get-property('sessionIDFromClassMediator') = get-property('SessionID')">
<then>
<log level="custom">
<property name="STATE" value="message is sent to queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:PostPublicationResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:MessageID>$1</ns1:MessageID>
</ns1:PostPublicationResponse>
</format>
<args>
<arg expression="get-property('getMessageIDFromClassMed')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<log level="full">
<property name="FilterNotRunning" value="----------FilterNotRunning------------------"/>
</log>
<drop/>
</else>
</filter>**
</then>
<else>
<drop/>
</else>
</filter>
</else>
</filter>
</inSequence>
<endpoint>
<address uri="jms:/myQueue?&transport.jms.DestinationType=queue"/>
</endpoint>
So i want to get the value of <property name="sessionIDFromClassMediator" expression="get-property('SessionID')" scope="default" type="STRING"/> so that i can use this property value to match with Other Property after
<class name="wso2.org.postPublication.PostPublication">
<property name="topic" value="Sports"/>
<property name="sessionID" value="session_001"/>
<property name="messagecontent" value="Cricket on air"/>
<property name="expiry" value="Monday"/>
</class>
and after that i am sending message to Message broker but before that i want to associate a payload which should be send to the queue of message broker. I want to implement payload inside
I AM NOT ABLE TO GET THE PROPERTY VALUE OF sessionIDFromClassMediator SO MY FILTER NEVER GETS TRUE AND CAN'T GET INSIDE THE FILTER
**<filter xpath="get-property('sessionIDFromClassMediator') = get-property('SessionID')">
<then>
<log level="custom">
<property name="STATE" value="message is sent to queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:PostPublicationResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:MessageID>$1</ns1:MessageID>
</ns1:PostPublicationResponse>
</format>
<args>
<arg expression="get-property('getMessageIDFromClassMed')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<log level="full">
<property name="FilterNotRunning" value="----------FilterNotRunning------------------"/>
</log>
<drop/>
</else>
</filter>**
part.THE MAIN PROBLEM IS THAT THE FIRST FILTER IS EXECUTED WHEN I ENVOKE OPERATION OPENPUBLICATION, AND WHEN I ENVOKE THE SECOND OPERATION ALL THE PROPERTY VALUE GET RESET. SO HOW CAN I MAKE PROPERTY VALUE PERSISTENT SO THAT IT IS NEVER LOST? Hope you understand my question and looking forward to your solutions. Thanks in advance
Try to add some logs of your property to see if it is there or not:
<log level="custom">
<property name="your property" expression="get-property('sessionIDFromClassMediator'))"/>
</log>
Keep in mind the different levels of the properties (transport, axis2, axis2-client).
I also had quite some problems with the filter mediator using the xpath attribute. I don't use it anymore and always use the combination of "source" and "regex".
Example:
<filter source="$body/anElementInTheBody" regex="true">
So for your case you can create an additional property (just before the filter) that will contain the boolean value if it should be filtered or not. Then with the regex=true you will enter the filter.
This is just a pseudo code of your example - maybe need some corrections:
<property name="filterCondition" expression="get-property('sessionIDFromClassMediator') = get-property('SessionID')"/>
<filter source="get-property('filterCondition')" regex="true">