Posts

Showing posts from November, 2013

WSO2 ESB append full body to a POST parameter

When you have to invoke a back end service which can take only on parameter and you need to send your full soap envelop body as single post parameter you can use script mediator and payload factory mediator as following. I have an api which calls to "http://localhost:9000/services/SimpleStockQuoteService"  and response is received by the "second_sequence". In the second_sequence response is processed and assign it single parameter using script mediator and payload factory. API <api xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteAPI2" context="/stockquote_api">    <resource methods="GET" uri-template="/view/{symbol}">       <inSequence>          <payloadFactory>             <format>                <m0:getQuote xmlns:m0="http://services.samples">                   <m0:request>                      <m0:symbol>$1</m0:symbol>          

SSL handshake failed: SSL error: Key usage violation in certificate has been detected

SVN causing problems in ubuntu When I was checking out a code in a svn repository which can only connect through https, started giving me errors as following. SSL handshake failed: SSL error: Key usage violation in certificate has been detected. This is caused by a bug in the version of libneon, fortunately this is fixed in version 0.29.3.    To fix the problem, please follow the steps Uninstall the current libneon package: sudo apt-get remove libneon27 Download the latest libneon package http://packages.debian.org/squeeze/libneon27 Install the required libssl dependency: sudo apt-get install libssl0.9.8 Install the downloaded libneon package:  dpkg -i libneon27_0.29.3-3_amd64.deb Make the changes to symbolic links as described above: sudo mv /usr/lib/libneon-gnutls.so.27 /usr/lib/libneon-gnutls.so.27.old sudo ln -s /usr/lib/libneon.so.27 /usr/lib/libneon-gnutls.so.27

WSO2 ESB Stop suffix getting appended to endpoint.

When you are developing a synapse configurations, there can be some places where you do a POST request to rest end point from a proxy service. And you find that your end is get appended by some other part of the previous url end point which supposed to call the current proxy service. You can get rid of it with this property mediator. <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/> 

WSO2 ESB Script Mediator (Remove body of an soap envelop)

When you are implementing synapse configurations in WSO2 ESB (4.6.0), sometimes you might want to remove soap body. This happens to me when I was developing complex synapse configuration, which had lot of service chaining. The last of the service chaining was to call to a rest (GET) end point using rest api. Up to final call to rest api, everything seems to work perfect. But the last rest api call fails due to a soap envelop generated from service chaining. Simple solution was to remove the soap body from the envelop. then it worked perfectly as I expected. This is the simple solution I used to remove the body from the soap envelop using script mediator. <script language="js"> mc.getEnvelope().getBody().getFirstElement().detach(); print(mc.getEnvelope().getBody()); </script>

WSO2 ESB Dynamic End Point Resolution

From WSO2 ESB 4.7.0 onwards, support dynamic end point resolutions. If you have multiple deployment environments (DEV, QA, Production), then you may end up having many endpoints and will have to change them once you migrate your synapse configs to other environment. As a simple solution for this time consuming problem (for Call out mediator and send mediator only), you can initialize end points as jvm parameters at the server start up. Ex: SEND Mediator <send>             <endpoint name="MyEp"                       template="endPointTemplete"                       uri="http://{system.prop.bpm.stock.host}:{system.prop.bpm.stock.port}/services/SimpleStockQuoteService"/>          </send> You have to create a endpoint template in order to use this feature for send mediator. When you start the ESB, you can initialize the {system.prop.bpm.stock.host} and {system.prop.bpm.stock.port} by using JVM parameters as follows. And