wso2 esb proxy cannot return response sometimes - wso2

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>

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

Converting a SOAP request to a HTTP 200 return on wsO2 ESB

I have a instance where I need to implement a proxy service that takes a SOAP message, forwards it to an internal system (SOAP) and returns a HTTP 200 response to the original server.
Basically the response should be completely void of any soap detail (there's technically no output message in the WSDL that I have to implement).
Here's what I have so far (which simply takes the request & echos it back as the response):
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ExampleHttp200Return"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator=", - inSequence: received - "/>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="SC_ACCEPTED" value="false" scope="axis2"/>
<property name="HTTP_SC" value="200" scope="axis2"/>
<send/>
</inSequence>
</target>
<description/>
</proxy>
If you want to send back an empty response, you can add that before send mediator :
<property name="messageType" scope="axis2" value="text/plain"/>
<enrich>
<source type="inline">
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header/>
<soapenv:Body>
<text xmlns="http://ws.apache.org/commons/ns/payload"/>
</soapenv:Body>
</soapenv:Envelope>
</source>
<target type="envelope"/>
</enrich>

wso2 esb mediator is singleton

I configure two proxies in ESB, and these 2 proxies are bridged to one instance mediator. And I have different property set for mediator in proxy configuration.
I expect that the two mediators instances are running in ESB with different properties.
But in fact, seems only mediator instance is in ESB.
Any idea on this?
I made a mistake here. In java code, spring bean is used to contain mediator property configured in xml file. But spring bean is singleton and causes different configuration cannot be applied in different proxy.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="abc"
transports="http"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<log level="full"/>
<property name="address"
scope="transport"
expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
<class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
<property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
<property name="property" value="P"/>
<property name="languageCode" value="en-US"></property>
</class>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="def"
transports="http"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<log level="full"/>
<property name="address"
scope="transport"
expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
<class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
<property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
<property name="property" value="P"/>
<property name="languageCode" value="en-US"></property>
</class>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>