WSO2 ESB SimpleStockProxy => unable to sendViaPost - wso2

I'm currently trying to set up SimpleStockProxy per https://docs.wso2.com/display/ESB490/Lesson+Three%3A+Mediating+Services#LessonThree:MediatingServices-ConfigSample2 and receiving the following error:
Unable to sendViaPost to url[http://localhost:8280/services/StockQuoteProxy
telnet localhost 8280
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
The addresses test successfully when connecting to http://localhost:9000/services/SimpleStockQuoteService. The actual SimpleQuoteService works as well.
The full config source is below:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/>
<proxy name="StockQuoteProxy" startOnLoad="true" statistics="enable"
trace="enable" transports="https http local">
<description/>
<target>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</outSequence>
</target>
<publishWSDL uri="file:./repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<endpoint name="SimpleStockQuoteService">
<address statistics="enable" uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<sequence name="fault">
<!-- Log the message at the full log level with the ERROR_MESSAGE and the ERROR_CODE-->
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property expression="get-property('ERROR_CODE')" name="ERROR_CODE"/>
<property expression="get-property('ERROR_MESSAGE')" name="ERROR_MESSAGE"/>
</log>
<!-- Drops the messages by default if there is a fault -->
<drop/>
</sequence>
<sequence name="main">
<in>
<!-- Log all messages passing through -->
<log level="full"/>
<!-- ensure that the default configuration only sends if it is one of samples -->
<!-- Otherwise Synapse would be an open proxy by default (BAD!) -->
<filter regex="http://localhost:9000.*" source="get-property('To')">
<!-- Send the messages where they have been sent (i.e. implicit "To" EPR) -->
<send/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
<!-- You can add any flat sequences, endpoints, etc.. to this synapse.xml file if you do
*not* want to keep the artifacts in several files -->
</definitions>
Anyone have any ideas about what could be wrong here?

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>

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

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 />

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: Address endpoint does not resume sending after backends recovery

I am using WSO2 ESB with RabbitMQ, I have two proxy services:
AMQPProducerSample, it receives messages via HTTP transport and send it to RabbitMQ queue
AMQPProxy it works as consumer for RabbitMQ queue (via rabbitmq transport), consumed messages are send to HTTP endpoint SampleEndPoint
Everything works fine except one scenario:
My backend service set in SampleEndPoint goes down.
New messages arrives and are published via AMQPProducerSample, delivery fails (that is expected because my backend is down). In console I can see:
WARN - ConnectCallback Connection refused or failed for : mfb.localhost/127.0.0.1:80
WARN - FaultHandler ERROR_CODE : 101503
WARN - FaultHandler ERROR_MESSAGE : Error connecting to the back end
WARN - FaultHandler ERROR_DETAIL : Error connecting to the back end
WARN - FaultHandler ERROR_EXCEPTION : null
WARN - FaultHandler FaultHandler : Endpoint [SampleEndPoint]
My backend service recovers and is available
New messages arrives and are published via AMQPProducerSample but my endpoint does not receive any message any more. It works fine only if number of undelivered messages is below 5. In that case messages are successfully delivered to backend service. The delivery always stops working after 5 (five) undelivered messages.
How to solve this? Is there any option I need to set or change to make it work all the time?
I am using WSO2 ESB 4.8.1
Below is my full config:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="AMQPProxy"
transports="rabbitmq"
startOnLoad="true"
trace="enable">
<description/>
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint key="SampleEndPoint"/>
</send>
</inSequence>
</target>
<parameter name="rabbitmq.queue.name">queue</parameter>
<parameter name="rabbitmq.connection.factory">AMQPConnectionFactory</parameter>
<parameter name="rabbitmq.exchange.name">exchange</parameter>
<parameter name="rabbitmq.queue.routing.key">route</parameter>
</proxy>
<proxy name="AMQPProducerSample"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property name="NO_KEEPALIVE" value="true" scope="axis2"/>
<send>
<endpoint>
<address uri="rabbitmq:/AMQPProxy?rabbitmq.server.host.name=localhost&rabbitmq.server.port=5672&rabbitmq.queue.name=queue&rabbitmq.queue.routing.key=route&rabbitmq.exchange.name=exchange"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
<endpoint name="SampleEndPoint">
<address uri="http://mfb.localhost/">
<timeout>
<duration>1000</duration>
<responseAction>discard</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<in>
<log level="full"/>
<filter source="get-property('To')" regex="http://localhost:9000.*">
<send/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
</definitions>
This is a known bug which was there in ESB 4.8.1 fresh pack. Later on we have fixed it. So I recommend you to switch into ESB 4.9.0 release where this issue was fixed.
[1] https://docs.wso2.com/display/ESB490/Downloading+the+Product
You have to change the following parameter within transportReceiver for rabbitmq in axis2.xml
<parameter name="rabbitmq.connection.retry.count" locked="false">5</parameter>
"rabbitmq.connection.retry.count" is the number of times attempted to reconnect after each retry, I think you have set it to 5, that is why connection drop after five attempts. Increse the parameter value and try it.

WSO2 ESB - JMS response from endpoint with XML payload shows up as Text

I am using WSO2 ESB to send a JMS message (XML payload) to an endpoint and then to read a return JMS message (on another queue) from the same endpoint (which also sends an XML payload). The problem I am facing is that the return JMS message from the endpoint, even though it is an XML payload, comes in as a text message.
Here is what I see in WSO2 for the JMS message (with XML payload) sent back by the endpoint:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<axis2ns2:text xmlns:axis2ns2="http://ws.apache.org/commons/ns/payload">
<?xml version="1.0" encoding="UTF-8"?>
<Sys1Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Sys1-ack-nack.xsd">
<security>
<statusInfo>
<ARMStatus>ARM_ACK</ARMStatus>
<Sys1Status>Sys1_ACK</Sys1Status>
<FinalStatus>ACK</FinalStatus>
</statusInfo>
<upstreamIdentifier>
<tradeId>459609</tradeId>
<messageId>12345678</messageId>
<assetId>6M2</assetId>
<issueDescription>IRS RTP 3.12 19MAY11 JP</issueDescription>
<productType>SWAPTION</productType>
</upstreamIdentifier>
</security>
</Sys1Response>
</axis2ns2:text>
</soapenv:Body>
</soapenv:Envelope>
This is the WSO2 proxy definition.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
<parameter name="localRegistry">/</parameter>
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="ToWSO2"
transports="jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="transport.jms.ContentTypeProperty"
value="Content-Type"
scope="axis2"/>
<log level="full"/>
<call>
<endpoint>
<address uri="jms:/ToSys1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue&transport.jms.ReplyDestinationType=queue&transport.jms.ReplyDestination=FromSys1&transport.jms.ContentType=application/xml"/>
</endpoint>
</call>
<log level="full"/>
</inSequence>
<outSequence>
<log level="full"/>
<drop/>
</outSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.Destination">ToWSO2</parameter>
</proxy>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<in>
<log level="full"/>
<filter source="get-property('To')" regex="http://localhost:9000.*">
<send/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
</definitions>
Would appreciate help in resolving this. Many thanks in advance!