Proxy service giving error "Connection time out after request is read" - wso2

We have created proxy service in wso2 esb using esb project in eclipse.
We have two web service calls and a data mapper.
proxy service is giving error "2017-02-23 12:06:32,131 [-] [HTTP-Listener I/O dispatcher-4] WARN SourceHandler Connection time out after request is read: http-incoming-40 Socket Timeout : 180000 Remote Address : /10.65.0.75:52864" as we add data mapper.
Without data mapper proxy service is running successfully. some times it also runs successfully with data mapper.
can someone guide about this issue?
Following is the proxy source
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EslSfaOFAOMSOIntegrationPS"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<call>
<endpoint>
<address format="soap11"
uri="http://10.1.6.175:9763/services/EslSfaOMSODataService.SOAP11Endpoint/"/>
</endpoint>
</call>
<log level="full"/>
<datamapper config="gov:datamapper/EslSfaOFAOMSOIntegrationMapping.dmc"
inputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_inputSchema.json"
inputType="XML"
outputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_outputSchema.json"
outputType="XML"/>
<log description="" level="full"/>
<header name="Authorization"
scope="transport"
value="Basic --"/>
<log level="full"/>
<call>
<endpoint>
<address format="soap11"
uri="https://oraclefusionhost:443/soa-infra/services/default/DooDecompReceiveOrderExternalComposite/ReceiveOrderRequestService"/>
</endpoint>
</call>
<log level="full"/>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<description/>
</proxy>
calling proxy through scheduled task, attached is the source
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="testtask2">
<trigger count="1" interval="60"/>
<property name="proxyName" value="EslSfaOFAOMSOIntegrationPS" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="soapAction" value="operation" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<soapenv:Envelope xmlns:esl="esl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<esl:operation/>
</soapenv:Body>
</soapenv:Envelope>
</property>
</task>
Secondly how can we have the response from proxy service. our web-service create record in db and return status success when run stand alone form soap ui.

Replace <drop/> with a <respond />

Related

Need help for integrating sap adapter with wso2

I working on WSO2 ESB profile for sap adapter. I followed the step for configuring sap adapter with WSO2 as mentioned in manual. But yet after starting the server, I am not able to create BapiSender proxy service in management console. It is marked default with the error
SAPTransportListener Unable to configure the service BAPISender for the BAPI transport: Service doesn't have configuration information for transport bapi. This service is being marked as faulty and will not be available over the BAPI transport.
WARN - SAPTransportListener Disabling the bapi transport for the service BAPISender, because it is not configured properly for the service.
Can you post your proxy service? Below you'll find a working example proxy.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SAPProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="xml" description="BAPIPayload">
<format>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<bapirfc xmlns="" name="Z_CONVERT_IBAN_2_BANK_ACCOUNT">
<import>
<field name="I_IBAN">123456789</field>
</import>
</bapirfc>
</soap:Body>
</soap:Envelope>
</format>
<args/>
</payloadFactory>
<send>
<endpoint name="sap-endpoint">
<address uri="bapi:/yourconf"/>
</endpoint>
</send>
<log level="full">
<property name="step" value="--- AFTER SEND TO SAP 2 --"/>
</log>
</inSequence>
<outSequence>
<log level="full">
<property name="step" value="--- RESULT FROM SAP --"/>
</log>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="step" value="--- FAULT --"/>
</log>
<drop/>
</faultSequence>
</target>
<description/>
</proxy>

javax.naming.NameNotFoundException: Name [dynamicQueues/myqueue] is not bound in this Context. Unable to find [dynamicQueues]

I've created JMS sender in WSO2 ESB 4.9.0 as below and configured JMS sender in axis2.xml file. I'm getting the below exception when I run the proxy service. Using Websphere MQ JMS queues.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/myquue?transport.jms.ConnectionFactory=ConnectionFactory"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
javax.naming.NameNotFoundException: Name [dynamicQueues/myqueue] is not bound in this Context. Unable to find [dynamicQueues]
In my scenario using the WSO2 MB, the correct endpoint it´s this:
<address uri="jms:/MyQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue"/>
Your proxy config use:
<property name="OUT_ONLY" value="true"/>
So, no response is sent to the client.
You need to specify a WSDL in the proxy config with an operation that does not have a response message or return a status = 200 with:
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>

wso2 esb proxy cannot return response sometimes

I am working on esb4.8.1, and uses proxy as communication bridge between client and server.
To validate the esb proxy stability, I create a dummy proxy as below:
In the monitor log, some times I got http response like "Permission denied: connect". Most time the proxy works pretty well.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EchoProxy"
transports="http"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<script language="js">
mc.setPayloadXML(
<greeting>Hello World</greeting>
);
</script>
<header name="To" action="remove"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<property name="RESPONSE" value="true"/>
<send/>
<log level="full"/>
</inSequence>
</target>
</proxy>

using cache with json\rest services in wso2esb

with wso2esb 4.7.0 i deployed the following service to perform a proxy and expose the same json i get from a different server:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="crmws"
transports="http"
statistics="enable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="messageType" value="text/xml" scope="axis2"/>
<cache id="c1"
scope="per-host"
collector="false"
hashGenerator="org.wso2.caching.digest.DOMHASHGenerator"
timeout="6"
maxMessageSize="10000">
<implementation type="memory" maxSize="10000"/>
</cache>
<send>
<endpoint>
<address uri="http://crm/backoffice/webservice.php" format="rest">
<timeout>
<duration>3000</duration>
<responseAction>fault</responseAction>
</timeout>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<property name="messageType" value="application/json" scope="axis2"/>
<cache id="c1" scope="per-host" collector="true"/>
<send/>
</outSequence>
</target>
<description/>
</proxy>
i then try to implement some cache functionality, but even if first connection goes well, when i hit cache i get an empty answer with text/xml content-type.
UPDATE 20131204
I try again after 4.8.0 release and then enabling cache i get the full representation of my json in xml when i hit cache
anyone know where i have to look to fix this issue?
regards,
try adding the following property in your insequence.
eg:
<inSequence>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
---------------------------

WSO2 ESB Service Proxy not timing out as per configuration

We are using latest version of WSO2 ESB(4.6.0).We are exploring on implementing Proxy Service to a web service. The details are as follows:
An Axis2 Webservice Custom service proxy is setup using WSO2. The configuration is as follows:
Proxy XML: This synapse configuration was generated using WSO2 UI.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="https,http" statistics="enable" trace="enable" startOnLoad="true">
<target faultSequence="myFaultHandler">
<inSequence>
<property name="DISABLE_CHUNKING" value="true" scope="axis2" type="STRING"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService">
<timeout>
<duration>3000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>101504,101505</errorCodes>
<initialDuration>1000</initialDuration>
<progressionFactor>2.0</progressionFactor>
<maximumDuration>10000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>101507,101508,101505,101506,101509,101500,101510,101001,101000,101503,101504,101501</errorCodes>
<retriesBeforeSuspension>1</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
</address>
</endpoint>
</target>
<publishWSDL uri="http:// localhost:9000/services/SimpleStockQuoteService?wsdl"/>
<description></description>
</proxy>
Sequence myFaultHandler XML:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="myFaultHandler" trace="enable">
<header name="To" action="remove"/>
<property name="RESPONSE" value="true"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="error-message" expression="get-property('ERROR_MESSAGE')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="error-code" expression="get-property('ERROR_CODE')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="error-detail" expression="get-property('ERROR_DETAIL')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="error-exception" expression="get-property('ERROR_EXCEPTION')"/>
</log>
<makefault version="soap12">
<code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/>
<reason value="Webservice is either down or currently not reachable."/>
<node></node>
<role></role>
</makefault>
<send/>
</sequence>
When the webservice is down, this configuration throws a soap fault as defined.
When the webservice is taking time to send the response back, as defined in the proxy XML configuration it should timeout after 3 sec:
<timeout>
<duration>3000</duration>
<responseAction>fault</responseAction>
</timeout>
Even after the timeout period the proxy is still waiting for the response instead of throwing the fault back.
On analysis of the log file, we tried by modifying the following parameters in the below mentioned properties file but still the thread was stuck waiting for the response.
**synapse.properties**
synapse.global_timeout_interval=3000
synapse.connection.read_timeout=3000
synapse.connection.connect_timeout=3000
synapse.timeout_handler_interval=3000
**nhttp.properties**
http.socket.timeout=5000
It eventually times out and throws socket exception.
As per the specification (http://wso2.com/library/articles/wso2-enterprise-service-bus-endpoint-error-handling) after the timeout happens the endpoint should go to Timeout state, but in this case the endpoint is still in Active state and it is neither faulting nor discarding message. Some times it throws an error code 504. But this action is not consistent.
Please let know the changes required for a given proxy service to timeout/discard message, if the final webservice is very slow.
If you are using http transport from the axis2.xml (which locates at CARBON_HOME/repository/conf/axis2 directory), you can fix that by configuring the time out parameters in that particular transport sender by adding parameters. For example,
<parameter name="SO_TIMEOUT">3000</parameter>
<parameter name="CONNECTION_TIMEOUT">3000</parameter>
Regards,
Asanka Sanjeewa.