Hi I have the source view of my api from APIM and modified it to get the the htttp header "Authorization" and log it to the log file I added 2 entries in code one for insequence and one for outsequence. In the insequence I added the line
<property name="AuthHeader" expression="$trp:Authorization"/>
In order to get the header and assign it to a property. In the out sequence I added
<log level="custom">
<property name="AuthHeader value" expression="get-property('AuthHeader')"/>
</log>
To determine if the AuthHeader property will display and get the header, however inside the log file it was said that
TID: [0] [AM] [2014-11-19 04:23:01,997] INFO {org.apache.synapse.mediators.builtin.LogMediator} - AuthHeader value = null {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [AM] [2014-11-19 04:23:07,335] INFO {org.apache.synapse.mediators.builtin.LogMediator} - AuthHeader value = null {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [AM] [2014-11-19 04:56:17,177] INFO {org.apache.synapse.mediators.builtin.LogMediator} - AuthHeader value = null {org.apache.synapse.mediators.builtin.LogMediator}
Which means I'm not getting the correct http header value, is there something wrong with the code? Please help, the complete API code is below.
Thanks,
Drew
<api name="admin--fte" context="/fte">
<resource methods="POST GET DELETE OPTIONS PUT" url-mapping="/*">
<inSequence>
<property name="AuthHeader" expression="$trp:Authorization"/>
<property name="isDefault" expression="get-property('transport', 'WSO2_AM_API_DEFAULT_VERSION')"/>
<filter source="get-property('isDefault')" regex="true">
<then>
<log level="custom">
<property name="STATUS" value="Faulty invoking through default API.Dropping message to avoid recursion.."/>
</log>
<payloadFactory media-type="xml">
<format>
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>500</am:code>
<am:type>Status report</am:type>
<am:message>Internal Server Error</am:message>
<am:description>Faulty invoking through default API</am:description>
</am:fault>
</format>
<args/>
</payloadFactory>
<property name="HTTP_SC" value="500" scope="axis2"/>
<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"/>
<send/>
</then>
<else>
<header name="WSO2_AM_API_DEFAULT_VERSION" scope="transport" value="true"/>
<property name="uri.var.portnum" expression="get-property('http.nio.port')"/>
<send>
<endpoint>
<http uri-template="http://localhost:{uri.var.portnum}/fte/1.0">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</http>
</endpoint>
</send>
</else>
</filter>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2" type="STRING"/>
<log level="custom">
<property name="AuthHeader value" expression="get-property('AuthHeader')"/>
</log>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.SynapsePropertiesHandler"/>
</handlers>
</api>
By default, the Authorization header is removed by the Authentication handler. That's why you cant' seem to access it or log it. Handlers act before the mediation inSequence.
The Authentication header can be preserved by editing the api-manager.xml config file in /repository/conf. Simply uncomment the following node and change the value to false:
<RemoveOAuthHeadersFromOutMessage>false</RemoveOAuthHeadersFromOutMessage>
Related
url likes:
http://ict.esg.ilfseducation.com`/gtrapi/api/profilesystem?`d1=17-10-2018&d2=17-10-2018
Iam trying this code to pass with dates dynamically d1 and d2 but not working.but how to pass dates with dynamically please any one suggest me.i have try this another url with sigle parms working fine.but dates was not working any one please suggeat me.
api:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/gtrapi/api/profilesystem?" name="SCR_profileapi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" protocol="http" uri-template="/{date1}/{date2}">
<inSequence>
<property description="http" name="HTTP_SC" scope="axis2" type="STRING" value="404"/>
<log level="full"/>
<send>
<endpoint key="SCR_profileendpoint"/>
</send>
</inSequence>
<outSequence>
<switch source="get-property('axis2','HTTP_SC')">
<case regex="200">
<log description="200log" level="custom">
<property expression="$ctx:ERROR_CODE" name="200reserrorcode"/>
</log>
<send/>
</case>
<default>
<log description="reslog" level="custom">
<property expression="$ctx:ERROR_CODE" name="reserrorcode"/>
<property expression="$ctx:ERROR_MESSAGE" name="reserrormessage"/>
<property expression="get-property('axis2','HTTP_SC')" name="reshttpsc"/>
</log>
</default>
</switch>
<send/>
</outSequence>
<faultSequence>
<switch source="get-property('axis2','HTTP_SC')">
<case regex="200">
<log description="200log" level="custom">
<property expression="$ctx:ERROR_CODE" name="200reserrorcode"/>
</log>
</case>
<default>
<log description="reslog" level="custom">
<property expression="$ctx:ERROR_CODE" name="reserrorcode"/>
<property expression="$ctx:ERROR_MESSAGE" name="reserrormessage"/>
<property expression="get-property('axis2','HTTP_SC')" name="reshttpsc"/>
</log>
</default>
</switch>
<send/>
</faultSequence>
</resource>
</api>
endpoint:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="SCR_profileendpoint" xmlns="http://ws.apache.org/ns/synapse">
<http uri-template="http://ict.esg.ilfseducation.com/gtrapi/api/profilesystem?d1={uri.var.service.date1}&d2={uri.var.service.d2}" method="get">
</http>"/>
</endpoint>
We have this WSO2 ESB proxy service that's accessible thru its https endpoint. I want to configure this service so that it will also be accessible via http.
I checked the service configuration in the carbon management console and confirmed that both https and http endpoint were already enabled:
https://10.20.0.20:8245/services/<service_name>
http://10.20.0.20:8282/services/<service_name>
Also, the axis2.xml file in ESB_HOME}/repository/conf/axis2/ seems to be configured just fine.
<!-- ================================================= -->
<!-- Transport Ins (Listeners) -->
<!-- ================================================= -->
<!-- the non blocking http transport based on HttpCore + NIO extensions -->
<transportReceiver name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
<parameter name="port" locked="false">8280</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor</parameter>
<!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
<parameter name="disableRestServiceDispatching" locked="false">true</parameter>
</transportReceiver>
<!-- the non blocking https transport based on HttpCore + SSL-NIO extensions -->
<transportReceiver name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLListener">
<parameter name="port" locked="false">8243</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor</parameter>
<parameter name="disableRestServiceDispatching" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/iaascol.jks</Location>
<Type>JKS</Type>
<Password>***</Password>
<KeyPassword>rotcelloc</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>***</Password>
</TrustStore>
</parameter>
<!--<parameter name="SSLVerifyClient">require</parameter>
supports optional|require or defaults to none -->
</transportReceiver>
Port offset in ESB_HOME}/repository/conf/carbon.xml is set to 2.
<Offset>2</Offset>
I can't seem to access this proxy service thru its http endpoint URL. The version of WSO2 ESB is 4.5.0. Please let me know which configuration do I have to check / set. Thanks in advance.
Edit: Below is the proxy service config as well as netstat result.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="disbursement" statistics="disable"
trace="enable" transports="https,http">
<target>
<inSequence>
<property action="set" name="EXECUTION_CONTEXT"
scope="default" type="STRING" value="disbursement"/>
<property action="set"
expression="fn:concat(//*[local-name()='Header']/*[local-name()='TrackingID'], '.xml')"
name="DumpFileName" scope="default" type="STRING"/>
<log category="INFO" level="full" separator=",">
<property name="EVENT_TYPE" value="PROCESSING_STARTED"/>
<property expression="get-property('DumpFileName')" name="FILENAME"/>
</log>
<property action="set" name="DumpFilePath" scope="default"
type="STRING" value="/home/user1/data/disbursement/incoming"/>
<class name="se.seman.wso2.mediator.WriteFile"/>
<property action="set" name="TopicName" scope="default"
type="STRING" value="VirtualTopic.seman.iaas.user1.topic.disbursement.out"/>
<property action="set" name="ResultCode" scope="default"
type="STRING" value="0"/>
<!--
TODO correct problem with xpath
validate source="/default/xpath">
<on-fail>
<property action="set" name="ResultCode"
scope="default" type="STRING" value="100"/>
<property action="set"
expression="get-property('ERROR_MESSAGE')"
name="ResultMessage" scope="default"
type="STRING"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Namespaces.user1.se:Cmf:InfoModel:FinancialManagement:Payment:Disbursment:0002"/>
<log category="INFO" level="full" separator=",">
<property name="MESSAGE" value="Schema validation failed"/>
<property
expression="get-property('ERROR_CODE')"
name="ERROR_CODE"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Namespaces.user1.se:Cmf:InfoModel:FinancialManagement:Payment:Disbursment:0002"/>
<property
expression="get-property('ERROR_MESSAGE')"
name="ERROR_MESSAGE"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Namespaces.user1.se:Cmf:InfoModel:FinancialManagement:Payment:Disbursment:0002"/>
</log>
<property action="set" name="RESPONSE"
scope="default" type="STRING" value="true"/>
</on-fail>
<schema key="conf:user1/ESBConfig/Common/NetPosti/resources/Disbursement_0002.xsd"/>
</validate -->
<log category="INFO" level="headers" separator=",">
<property name="MESSAGE" value="Before Topic"/>
<property expression="get-property('ERROR')" name="ERROR"/>
</log>
<filter xpath="get-property('ResultCode') = '0'">
<then>
<property action="set" name="ResultMessage"
scope="default" type="STRING" value="OK"/>
<class name="se.seman.wso2.mediator.WriteActiveMQTopic"/>
</then>
<else/>
</filter>
<header action="remove" name="To"/>
<property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
<property action="set" name="RESPONSE" scope="default"
type="STRING" value="true"/>
<payloadFactory>
<format>
<disr:DisbursementResponse xmlns:disr="urn:Namespaces.user1.se:Service:FinancialManagement:Payment:Disbursement:Response:0001">
<disr:ResponseCode>$1</disr:ResponseCode>
<disr:Message>$2</disr:Message>
</disr:DisbursementResponse>
</format>
<args>
<arg expression="get-property('ResultCode')"/>
<arg expression="get-property('ResultMessage')"/>
</args>
</payloadFactory>
<log category="INFO" level="full" separator=","/>
<send/>
</inSequence>
<outSequence>
<log category="INFO" level="full" separator=",">
<property name="MESSAGE" value="On the way back.."/>
</log>
<send/>
</outSequence>
<faultSequence>
<log category="INFO" level="full" separator=",">
<property name="MESSAGE" value="Error in Call!"/>
</log>
<property action="set" name="RESPONSE" scope="default"
type="STRING" value="true"/>
<enrich>
<source clone="true" type="inline">
<disr:DisbursementResponse xmlns:disr="urn:Namespaces.user1.se:Service:FinancialManagement:Payment:Disbursement:0001">
<disr:ResponseCode>900</disr:ResponseCode>
<disr:Message>General error</disr:Message>
</disr:DisbursementResponse>
</source>
<target action="replace" type="body"/>
</enrich>
</faultSequence>
</target>
<publishWSDL key="conf:user1/ESBConfig/Common/NetPosti/resources/DisbursementService0002.wsdl">
<resource
key="conf:user1/ESBConfig/Common/NetPosti/resources/Disbursement_0002.xsd" location="Disbursement_0002.xsd"/>
</publishWSDL>
[user1#ip-10-20-0-20 ~]$ netstat -pnlt
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 :::8245 :::*
LISTEN 2454/java
tcp 0 0 :::8282 :::*
LISTEN 2454/java
turned out this was only a firewall issue. port 8282 was blocked in wso2 firewall (iptables). thanks for all answers!
I am getting below error while calling http endpoint:-
The endpoint is HTTP endpoint which I am using.
Also added timeout parameters in axis2.xml and axis2.blocking.xml.
But it did not work.
Can anyone provide any solution to it?
HTTPSender Unable to sendViaPost to url[http://*********]
org.apache.commons.httpclient.NoHttpResponseException: The server ****** failed to respond
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
the esb proxy looks like below:--
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="mqListener"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log description="print message" level="full">
<property name="message" value=""In listenAbc1Mq""/>
</log>
<payloadFactory media-type="json">
<format>
{
"orderId": ""
}
</format>
<args>
<arg evaluator="xml" expression="//verkkopvc/text()"/>
</payloadFactory>
<log description="print message" level="full">
<property name="message" value=""after payload factory""/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="DISABLE_CHUNKING"
scope="axis2"
type="STRING"
value="true"/>
<call blocking="true">
<endpoint key="abc"/>
</call>
<log description="print message" level="full">
<property name="message" value=""Out sequence""/>
</log>
</inSequence>
<outSequence/>
<description/>
</proxy>
I believe the error is printed by your http client. To fix it, do these.
1) Remove <property name="OUT_ONLY" value="true"/>
2) Add <respond/> mediator at the end of inSequence.
am using Active MQ 5.10 version,I have configured it with wso2esb for message processing.
After around 7-10 days Active MQ is throwing tcp connections failure exception,since ESB is not receiving a successful tcp connection it is failing to submit messages in the Queue.
In this case am restarting the server and again it will run for 7-10 days and the same thing repeats.
my questions is
what may be the exact reason for active MQ stops giving successful tcp connection..?
why after restarting the server it returns to normal state..?
is there any best solution to over come this issue..
memory configuration in activemq.xml file
<systemUsage>
<systemUsage sendFailIfNoSpace="true">
<memoryUsage>
<memoryUsage limit="1430 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="300 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="100 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
Here is the Proxy service which is placing message in queue. In the proxy service it will check the user authentication if its true the user can place the message in the queue, here i use a class mediator where in that it connects with the active MQ and places message
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JmsStore2.0"
transports="https http"
startOnLoad="true"
trace="disable"
statistics="enable">
<description/>
<target>
<inSequence onError="fault">
<property name="messageType" value="application/json" scope="axis2"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<property name="jmsuri" value="tcp://0.0.0.0:61616"/>
<property name="jmsqueue" expression="get-property('transport', 'jmsqueue')"/>
<property name="readingspayload" expression="$body" type="OM"/>
<property name="username" expression="get-property('transport', 'username')"/>
<property name="password" expression="get-property('transport', 'password')"/>
<property name="PartyBranchID"
expression="//FieldValue/text()"
scope="default"
type="STRING"/>
<property name="Body" expression="$body" scope="default" type="STRING"/>
<property name="usercode"
expression="fn:substring-before(get-property('username'),'|')"
scope="default"
type="STRING"/>
<property name="clientid"
expression="fn:substring-after(get-property('username'),'|')"
scope="default"
type="STRING"/>
<property name="requestMsgId"
expression="get-property('MessageID')"
scope="default"
type="STRING"/>
<property name="client_ip_address"
expression="get-property('axis2','REMOTE_ADDR')"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<send xmlns="">
<username>$1</username>
<password>$2</password>
</send>
</format>
<args>
<arg evaluator="xml" expression="get-property('username')"/>
<arg evaluator="xml" expression="get-property('password')"/>
</args>
</payloadFactory>
<send receive="JmsStore_Seq">
<endpoint>
<address uri="http://localhost:8282/services/Login2.0" format="soap11">
<suspendOnFailure>
<errorCodes>101500,101501,101506,101507,101508,101503,50000</errorCodes>
<initialDuration>30</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>300</maximumDuration>
</suspendOnFailure>
</address>
</endpoint>
</send>
</inSequence>
<outSequence onError="fault">
<send/>
</outSequence>
</target>
</proxy>
Sequence:
<sequence xmlns="http://ws.apache.org/ns/synapse"
name="JmsStore_Seq"
trace="disable">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="Authentication"
expression="//Authentication/text()"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="UserId"
expression="//UserId/text()"
scope="default"
type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="WorkOUid"
expression="//WorkOUid/text()"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="WorkPartyBranchId"
expression="//WorkPartyBranchId/text()"/>
<filter xmlns:ns="http://org.apache.synapse/xsd"
xpath="get-property('Authentication')=''">
<then>
<payloadFactory media-type="xml">
<format>
<ResponseJSON xmlns="">
<Exception>Service trying to connect inactive service</Exception>
<Status>101503</Status>
</ResponseJSON>
</format>
<args/>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<send/>
</then>
<else>
<filter xpath="get-property('Authentication')='false'">
<then>
<payloadFactory media-type="xml">
<format>
<ResponseJSON xmlns="">
<Exception>Authentication Failed</Exception>
<Status>401</Status>
</ResponseJSON>
</format>
<args/>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<send/>
</then>
<else>
<property name="jmspayload"
expression="get-property('readingspayload')"
type="OM"/>
<property name="ResponseJSON" expression="$body/ResponseJSON" type="OM"/>
<property name="jmsuri" expression="get-property('jmsuri')"/>
<property name="jmsqueue" expression="get-property('jmsqueue')"/>
<payloadFactory media-type="xml">
<format>
<PLData>
<JMpayload>$1</JMpayload>
<AuthData>$2</AuthData>
<LogData>
<usercode>$3</usercode>
<clientid>$4</clientid>
<requestMsgId>$5</requestMsgId>
</LogData>
</PLData>
</format>
<args>
<arg evaluator="xml" expression="get-property('jmspayload')"/>
<arg evaluator="xml" expression="get-property('ResponseJSON')"/>
<arg evaluator="xml" expression="get-property('usercode')"/>
<arg evaluator="xml" expression="get-property('clientid')"/>
<arg evaluator="xml" expression="get-property('requestMsgId')"/>
</args>
</payloadFactory>
<class name="in.youtility.esb.custommediators.JMSStoreMediator"/>
<payloadFactory media-type="xml">
<format>
<ResponseJSON xmlns="">
<Body>
<Datalist>
<Data>Successfully stored</Data>
</Datalist>
</Body>
<Status>200</Status>
</ResponseJSON>
</format>
<args/>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<header name="To" action="remove"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<property name="RESPONSE" value="true"/>
<send/>
</else>
</filter>
</else>
</filter>
<description/>
</sequence>
Class Mediator:
public class JMSStoreMediator extends AbstractMediator implements
ManagedLifecycle {
Connection connection;
public boolean mediate(MessageContext msgCtx) {
try {
boolean topic=false;
String jmsuri=""+msgCtx.getProperty("jmsuri");
String t=""+msgCtx.getProperty("topic");
if(t.isEmpty()){
topic=false;
}
else {
topic=Boolean.valueOf(t);
}
ConnectionFactory factory= new ActiveMQConnectionFactory(jmsuri);
connection = factory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination=null;
if(!topic)destination= session.createQueue(""+msgCtx.getProperty("jmsqueue"));
else destination= session.createTopic(""+msgCtx.getProperty("jmsqueue"));
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
String xml = ""+msgCtx.getEnvelope().getBody().toStringWithConsume();
if(topic){
JSONObject obj=XML.toJSONObject(xml);
JSONObject ar=obj.getJSONObject("soapenv:Body");
ar.remove("xmlns:soapenv");
xml=ar.toString();
}
TextMessage message = session.createTextMessage(xml);
producer.send(message);
} catch (Exception e) {
log.info("LogLocation = "+getClass().getName()+",Error in storing message in JMS stacktrace is :"+e.toString());
((Axis2MessageContext) msgCtx).setProperty(NhttpConstants.HTTP_SC, 500);
handleException("Error while storing in the message store", msgCtx);
}
finally {
try {
connection.close();
} catch (JMSException e) {
log.info("LogLocation = "+getClass().getName()+",Error in closing JMS connection stacktrace is :"+e.toString());
}
}
log.info("LogLocation = "+getClass().getName()+",ProxyName = "+msgCtx.getProperty("proxy.name")+
",Usercode = "+msgCtx.getProperty("usercode")+",Clientid = "+msgCtx.getProperty("clientid")+
",requestMsgId = "+msgCtx.getProperty("requestMsgId")+",Position = END");
return true;
}
You should share your proxys conf but you can always verify that :
You've set the cachelevel to avoid new connections at each scan : <parameter name="transport.jms.CacheLevel">consumer</parameter>
You've asked to consume all messages a each scan : <parameter name="transport.jms.MaxMessagesPerTask">-1</parameter>
Hi I have an API with a custom sequence (dblookup & switch sequence) that will verify if a user is existing on the database, if not it should send a http status 401: Unauthorized, below is the case code but I always get an error cannot infer the transport information. What is the correct way of sending the back the response message.
THanks,
Drew
<case regex="0">
<log level="custom">
<property name="ucount" expression="fn:concat('User login - ', get-property('employee_count'))"/>
</log>
<send>
<property name="RESPONSE" value="true" scope="default"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<property name="HTTP_SC" value="401" scope="axis2"/>
<header name="To" action="remove"/>
<payloadFactory media-type="xml">
<format>
<response>
<result>Unauthorized</result>
</response>
</format>
<args/>
</payloadFactory>
<send/>
</case>
ERROR:
TID: [0] [AM] [2014-12-02 08:16:30,852] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: The system cannot infer the transport information from the /devtest/1.0/users/admin URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:115)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:94)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:30)
at org.apache.synapse.config.xml.SwitchCase.mediate(SwitchCase.java:66)
at org.apache.synapse.mediators.filters.SwitchMediator.mediate(SwitchMediator.java:123)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.mediate(APIManagerExtensionHandler.java:64)
at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.handleRequest(APIManagerExtensionHandler.java:180)
at org.apache.synapse.rest.API.process(API.java:285)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:83)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:64)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
TID: [0] [AM] [2014-12-02 08:16:30,853] INFO {org.apache.synapse.mediators.builtin.LogMediator} - STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out {org.apache.synapse.mediators.builtin.LogMediator}
Within send mediator you can not define other mediators.
Correct like this;
<property name="RESPONSE" value="true" scope="default"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<property name="HTTP_SC" value="401" scope="axis2"/>
<header name="To" action="remove"/>
<payloadFactory media-type="xml">
<format>
<response>
<result>Unauthorized</result>
</response>
</format>
<args/>
</payloadFactory>
<send>
endpoint>
<address uri="ADDRESS OF YOUR ENDPOINT"/>
</endpoint>
</send>
In my case there were invisible characters prepended to otherwise correct (Production/Sandbox) URL.
WSO2 seems very strict and didn't manage to interpret such definition, resulting in vague error:
The system cannot infer the transport information from the https://...
Notice the two spaces between the and https. It may have been a tabulator character.