WSO2 ESB reliable messaging - wso2

I have tried this sample "https://docs.wso2.com/display/ESB470/Sample+102%3A+Reliable+Message+Exchange+with+Back-End+Server+Using+WS-ReliableMessaging+1.1", and unfortunaly I couldn't understand the config explained in this sample. the config is:
<definitions xmlns="http://ws.apache.org/ns/synapse">
<in>
<RMSequence single="true" version="1.1"/>
<send>
<endpoint name="reliable">
<address uri="http://localhost:9000/services/ReliableStockQuoteService">
<enableRM/>
<enableAddressing/>
</address>
</endpoint>
</send>
</in>
<out>
<header name="wsrm:SequenceAcknowledgement" action="remove"
xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<header name="wsrm:Sequence" action="remove"
xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<header name="wsrm:AckRequested" action="remove"
xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<send/>
</out>
There is no place that explain where to use this config. What is the definitions tag? What are in and out tags?
I have tried this proxy service to invoke a reliabl-messaging enabled backend.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="reliableClient"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<RMSequence single="true" version="1.0"/>
<send>
<endpoint>
<wsdl service="reliableBackEnd"
port="reliableBackEndHttpSoap11Endpoint"
uri="http://localhost:9763/services/reliableBackEnd?wsdl">
<enableAddressing/>
<enableRM/>
</wsdl>
</endpoint>
</send>
</inSequence>
<outSequence>
<header xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
name="wsrm:SequenceAcknowledgement"
action="remove"/>
<header xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
name="wsrm:Sequence"
action="remove"/>
<header xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
name="wsrm:AckRequested"
action="remove"/>
<send/>
</outSequence>
</target>
<description/>
</proxy>
but it is getting time out. the backed is hosting in the same ESB 4.8.1, with default RM-Policy enabled.

#Reza,
definitions tag is the root tag of the ESB synapse config. Under the definitions tag, all the synapse artifact related configs such as proxy services, sequences, and etc are included.
Also regarding the sample you are referring,you are referring to an older version of 4.7.0 and make sure you have enabled nhttp transport. Instead of using the older version, I would like to suggest you use a newer version. Please refer [1], a nice article written by Buddhima.
[a] https://buddhimawijeweera.wordpress.com/2015/09/05/reliable-messaging-with-wso2-esb/

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>

WSO2 enterprise integrator, adding header to backend request

I've just started looking at WSO2 enterprise integrator.
I'm currently stuck when I'm trying to create an API which calls a backend service which requires authentication.
I'm currently stuck trying to add a simple header which its suppose to send to the backend as it needs authentication to access it.
I'm using their eclipse tooling and my XML currently looks like this.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/one" name="singleRestApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<header name="Authorization" scope="transport" value="Basic ZWNYGWRtaH42Q2xvdGRBZG1pbjmeMw=="/>
<send>
<endpoint key="repos"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
Currently following the integration tutorials: here
Any help or direction would be greatly appreciated.
You should try to put your Authorization in a property instead of an header (if you want to do a simple basic authentication)
<?xml version="1.0" encoding="UTF-8"?>
<api context="/one" name="singleRestApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<property action="remove" name="REST_URL_POSTFIX" scope="axis2"/>
<property name="Authorization" scope="transport" value="Basic ZWNYGWRtaH42Q2xvdGRBZG1pbjmeMw=="/>
<send>
<endpoint key="repos"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
the <property action="remove" name="REST_URL_POSTFIX" scope="axis2"/>
part is to remove the api context (after /one) when sending to your backend endpoint, if you need to keep it you can remove this line

WSO2 ESB Proxy Basic Service Chaining

this is what I thought would be a fairly straight-forward service chaining scenario.
All I want to do it forward some data to a proxy service, that proxy service will then iterate over the data and use an ID ("entity_id") from that data (which it can successfully retrieve) to look up a resource sitting in WSO2 Data Services Server. Once it has the result of that request, I want to forward it to another application (RequestBin, in this case).
Please take a look at my proxy configuration below:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="pollService"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<iterate id="iter1"
expression="//*[local-name()='Change']"
sequential="true">
<target sequence="anon">
<sequence>
<log level="full"/>
<property name="uri.var.entityid" expression="//*[local-name()='entity_id']"/>
<call>
<endpoint>
<http method="get"
uri-template="http://54.66.155.36:9764/services/civicrm/activity/{uri.var.entityid}"/>
</endpoint>
</call>
<log level="full"/>
<call>
<endpoint>
<http method="post" uri-template="http://requestb.in/1c79v711"/>
</endpoint>
</call>
<log level="full"/>
</sequence>
</target>
</iterate>
</inSequence>
</target>
<description/>
</proxy>
I currently do not get any indication that those two calls have fired at all.
Any assistance would be greatly appreciated.
Thank you.
you can enable the wirelog and verify whether calls have fired or not.
please refer the following blog post to learn about wirelog.
1 http://mytecheye.blogspot.in/2013/09/wso2-esb-all-about-wire-logs.html
Could you also give a sample message (what is going into the proxy) , and to see a finer-grain detail of what is going on in your proxy , go into [esb-home]/repository/conf/ and open the log4j.properties file , and set
log4j.category.org.apache.synapse=DEBUG , also do as #robin suggested. Try putting
<log level="full" category="DEBUG" separator="-----:-----"/>
in your proxy where you want to see the state of the message at that point.

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>

How to call RestFullService using Proxyservice in wso2

I have created a Resful WebApplication and upload it in wso2 as a Restful Service
I want to call this RestFul Service using a proxy service in wso,Is it possible
While doing this ,i am not able to get the response
Below is my Proxy Service configuration
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="ProxyService" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<http method="get" uri-template="http://10.132.97.131:9763/JerseyJSONExample/rest/jsonServices/print/mahi/"/>
</endpoint>
</target>
<description/>
But while calling this proxy service,i am not able to get the response
If i am simply calling the service
http://10.132.97.131:9763/JerseyJSONExample/rest/jsonServices/print/mahi/
I am getting the response...
Can anyone help me on this what actually is the problem
You can use the following configuration to call a restful service from proxy service
<inSequence>
<property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
<send>
<endpoint>
<address uri="http://10.132.97.131:9763/JerseyJSONExample/rest/jsonServices/print/mahi/"
format="pox"/></endpoint>
</send>
</inSequence>
More information can be find here