Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I got to work this as below,</p> <p>The class should extends AbstractMediator and override the mediate() method as follows,</p> <pre><code>package com.test.spring.mediator.workingexampleonspringmediator; import org.apache.synapse.MessageContext; import org.apache.synapse.mediators.AbstractMediator; public class HelloWorld extends AbstractMediator{ private String message; public void setMessage(String message){ this.message = message; } public boolean mediate(MessageContext arg0) { System.out.println("HELLO "+message); return true; } } </code></pre> <p>Then place the jar in [ESBHOME]/repository/components/lib folder</p> <p>In mediate method it prints a message with the argument like <code>HELLO 'arg'</code></p> <p>And I added the following file to registry <code>(/_system/config/repository/spring/springtest.xml)</code>,</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"&gt; &lt;beans&gt; &lt;bean id="springtest" class="com.test.spring.mediator.workingexampleonspringmediator.HelloWorld" singleton="false"&gt; &lt;property name="message"&gt;&lt;value&gt;ISURU&lt;/value&gt;&lt;/property&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>My proxy is as follows,</p> <pre><code>&lt;proxy xmlns="http://ws.apache.org/ns/synapse" name="testSpring" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"&gt; &lt;target&gt; &lt;inSequence&gt; &lt;log level="full"&gt; &lt;property name="START" value="__________________________"/&gt; &lt;/log&gt; &lt;spring:spring xmlns:spring="http://ws.apache.org/ns/synapse" bean="springtest" key="conf:/repository/spring/springtest.xml"/&gt; &lt;log level="full"&gt; &lt;property name="END" value="______________________"/&gt; &lt;/log&gt; &lt;/inSequence&gt; &lt;/target&gt; &lt;description&gt;&lt;/description&gt; &lt;/proxy&gt; </code></pre> <p>In the proxy you can see the <code>bean=[bean id of the springtest.xml]</code> and <code>class=qualified name of the class</code></p> <p>In my ESB terminal, I got the following out put with the given property value in springtest.xml,</p> <pre><code>[2013-11-07 17:38:30,654] INFO - LogMediator To: /services/testSpring.testSpringHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:bcae82e9-4027-43c5-bd7a-cbfa885aaf33, Direction: request, START = __________________________, Envelope: &lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soapenv:Body/&gt;&lt;/soapenv:Envelope&gt; HELLO ISURU [2013-11-07 17:38:30,692] INFO - LogMediator To: /services/testSpring.testSpringHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:bcae82e9-4027-43c5-bd7a-cbfa885aaf33, Direction: request, END = ______________________, Envelope: &lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soapenv:Body/&gt;&lt;/soapenv:Envelope&gt; </code></pre> <p>You must restart the ESB after placing the jar in repository/components/lib</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload