wso2 esb mediator is singleton - wso2

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>

Related

WSO2 EI soap envelope missing

I have a SOAP proxy service with a Data Mapper to create the output.
The created response does not have the soap envelope tag.
If I try to add the envelope with the payload factory, it strips out the envelope (but it keeps the Body element).
I'm using the WSO2 EI 6.4.0.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="EstrattoContoEntiTributi" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
...
<send>
<endpoint key="..."/>
</send>
</inSequence>
<outSequence>
<datamapper .../>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
We need to use a property mediator as below.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="PF2"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<payloadFactory media-type="xml">
<format>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://services.samples/xsd"
xmlns:ser="http://services.samples">
<soap:Header/>
<soap:Body>
<ser:getQuote>
<ser:request>
<xsd:symbol>IBM</xsd:symbol>
</ser:request>
</ser:getQuote>
</soap:Body>
</soap:Envelope>
</format>
<args/>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="text/xml"/>
<log level="full">
<property name="ChangedEnve" value="----Changed-------"/>
</log>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
Hope this helps,
https://medium.com/#isuruuy/how-to-construct-a-payload-with-the-soap-envelope-ce8df5032dda

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>

how to create a proxy service which calls a class mediator which accepts JSON request

My requirement is to transform a JSON request to a XML format.
And I got the code which converts JSON to XML in the below URL.
https://isurugunawardana.com/2015/05/19/json-support-for-wso2-esb-class-mediator/
But i need to know how this is been called from a proxy service in WSO2 EI..
I have tried creating a proxy service which calls the class mediator.
'
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestClassMedProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="custom">
<property name="BEGIN" value="Begin Sequence"/>
</log>
<class name="org.anthem.caremore.JSONtoXML">
<property name="inputPath" value="5"/>
</class>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
`

call external web service from WSO2 ESB

I'm in an internel network and I want to create a service (ESB) to call an external get service.
for example my ESB service path: uri/esb/path/param1/param2
my external path: external/path/param1/param2
here my entry
<?xml version="1.0" encoding="UTF-8"?>
<api context="/services/KRI-getIndividualVehicleFuelco2" name="KRI-getIndividualVehicleFuelco2" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<property name="renault_error_format" scope="default" type="STRING" value="json"/>
<log level="custom">
<property name="getIndividualVehicleFuelco2" value="********** begin **********"/>
<property expression="get-property('RequestID')" name="RequestID"/>
</log>
<Delegation.DelegationIn>
<Jboss-Endpoint-Key>KRI-customAddressingTransformation.xml</Jboss-Endpoint-Key>
<Custom-Sequence-Header>KRI-commonsequences-processSpecialHeadersIn</Custom-Sequence-Header>
</Delegation.DelegationIn>
<loopback/>
</inSequence>
<outSequence>
<sequence key="KRI-commonsequences-genericErrorHandling"/>
<Delegation.DelegationOut>
<Jboss-Endpoint-Key>KRI-customAddressingTransformation.xml</Jboss-Endpoint-Key>
<Custom-Sequence-Header>KRI-commonsequences-processSpecialHeadersOut</Custom-Sequence-Header>
</Delegation.DelegationOut>
<log level="custom">
<property name="getIndividualVehicleFuelco2" value="********** end **********"/>
<property expression="get-property('RequestID')" name="RequestID"/>
</log>
</outSequence>
<faultSequence>
<loopback/>
</faultSequence>
</resource>
</api>
I created an endpoint with the base uri of the external service.
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="KIS-fuelco-PPD" xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://kisre701.intra.com/kis/api/v2/individual-vehicle-fuelco2/"/>
</endpoint>
how can I parse parameters and send them to endpoint?

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>