You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2008/01/28 09:44:05 UTC
svn commit: r615763 [5/5] - in /webservices/synapse/trunk/java: ./
modules/core/ modules/core/src/main/java/org/apache/synapse/
modules/core/src/main/java/org/apache/synapse/config/
modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core...
Modified: webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html?rev=615763&r1=615762&r2=615763&view=diff
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html Mon Jan 28 00:43:56 2008
@@ -215,6 +215,8 @@
medium using VFS transport listener and sender</a></li>
<li><a href="#Sample255">Sample 255: Switching from ftp transport
listener to mail transport sender</a></li>
+ <li><a href="#Sample256">Sample 256: Proxy services with the mail
+ transport</a></li>
</ul>
</li>
<li><a href="#Task">Introduction to synapse tasks</a>
@@ -297,6 +299,13 @@
synapse for the actual service</a></li>
</ul>
</li>
+ <li><a href="#Callout">Synchronize web service invocation with Callout
+ mediator </a>
+ <ul>
+ <li><a href="#Sample430">Sample 430: Simple Callout Mediator for
+ Synchronize web service invocation</a></li>
+ </ul>
+ </li>
</ul>
</li>
</ul>
@@ -2518,7 +2527,7 @@
<target>
<endpoint>
<address uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;
- java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616"/>
+ java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
@@ -2551,7 +2560,7 @@
for the service is mentioned as below:</p>
<pre>jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=
QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&
-java.naming.provider.url=tcp://localhost:61616</pre>
+java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue</pre>
<p>You may also notice that the simple stock quote proxy service exposed in
Synapse is now available only in HTTP as we have specified transport for that
@@ -2817,7 +2826,7 @@
the one way JMS message flowing through Synapse into the sample Axis2 server
instance over http, and Axis2 acknowledging it with a http 202 Accepted
response.</p>
-<pre>ant stockquote -Dmode=placeorder -Dtrpurl="jms:/JMStoHTTPStockQuoteProxy?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"</pre>
+<pre>ant stockquote -Dmode=placeorder -Dtrpurl="jms:/JMStoHTTPStockQuoteProxy?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"</pre>
<pre>SimpleStockQuoteService :: Accepted order for : 7482 stocks of IBM at $ 169.27205579038733</pre>
<p>The second example shows how Synapse could be made to respond with a http
@@ -2964,6 +2973,71 @@
server and send it to the Axis2 service. The file in the ftp directory will
be deleted. The response will be sent to the given email address.</p>
+<h2><a name="Sample256">Sample 256: Proxy services with the mail transport
+</a></h2>
+<pre><!-- Using the mail transport -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <proxy name="StockQuoteProxy" transports="mailto">
+
+ <parameter name="transport.mail.Address">synapse.demo.1@gmail.com</parameter>
+ <parameter name="transport.mail.Protocol">pop3</parameter>
+ <parameter name="transport.PollInterval">5</parameter>
+ <parameter name="mail.pop3.host">pop.gmail.com</parameter>
+ <parameter name="mail.pop3.port">995</parameter>
+ <parameter name="mail.pop3.user">synapse.demo.1</parameter>
+ <parameter name="mail.pop3.password">mailpassword</parameter>
+ <parameter name="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
+ <parameter name="mail.pop3.socketFactory.fallback">false</parameter>
+ <parameter name="mail.pop3.socketFactory.port">995</parameter>
+
+ <target>
+ <inSequence>
+ <property name="senderAddress" expression="get-property('transport', 'From')"/>
+ <log level="full">
+ <property name="Sender Address" expression="get-property('senderAddress')"/>
+ </log>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <property name="Subject" value="Custom Subject for Response" scope="transport"/>
+ <header name="To" expression="fn:concat('mailto:', get-property('senderAddress'))"/>
+ <log level="full">
+ <property name="message" value="Response message"/>
+ <property name="Sender Address" expression="get-property('senderAddress')"/>
+ </log>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+</definitions> </pre>
+
+<p><strong>Objective: Using the mail transport with Proxy
+services</strong></p>
+
+<p><strong>Prerequisites:</strong><br>
+You will need access to an email account</p>
+
+<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not
+already done</p>
+
+<p>Enable mail transport sender in the Synapse axis2.xml. See <a
+href="Synapse_Samples_Setup.html#mailsender">Setting up mail transport
+sender</a> </p>
+
+<p>Start the Synapse configuration numbered 256: i.e. synapse -sample 256</p>
+
+<p>Send a plain/text email with the following body and any custom Subject
+from your mail account.</p>
+<pre><m0:getQuote xmlns:m0="http://services.samples/xsd"><m0:request><m0:symbol>IBM</m0:symbol></m0:request></m0:getQuote> </pre>
+
+<p>After a few seconds (e.g. 30s), you should receive a POX response in your email
+account with the stock quote reply.</p>
+
<h1><a name="Task">Introduction to synapse tasks</a></h1>
<h2><a name="Sample300">Sample 300: Introduction to tasks with simple
@@ -3643,8 +3717,7 @@
<p></p>
-<h2><a name="Throttle">Throtteling messages (Throttle Mediator)</a></h2>
-<!-- TODO: any text to go in here??? -->
+<h2><a name="Throttle">Throttling messages (Throttle Mediator)</a></h2>
<h2><a name="Sample370">Sample 370: Introduction to throttle mediator and
concurrency throttling</a></h2>
@@ -4116,7 +4189,6 @@
<h2><a name="XQuery">Evaluating XQuery for mediation (XQuery
Mediator)</a></h2>
-<!-- TODO: what goes in herer -->
<h2><a name="Sample390">Sample 390: Introduction to the XQuery
mediator</a></h2>
@@ -4163,7 +4235,7 @@
<publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
-</definitions> </pre>
+</definitions> </pre>
<p><b>Objective: Introduction transformation using XQuery mediator</b></p>
@@ -4240,7 +4312,6 @@
<h2><a name="Splitter">Splitting messages in to parts and process in parallel
(Iterate / Clone)</a></h2>
-<!-- TODO: splitter declaration -->
<h2><a name="Sample400">Sample 400: Message splitting and aggregating the
responses</a></h2>
@@ -4362,10 +4433,59 @@
the requests will be served by the cache inside Synapse. You could observe
this by looking at the printed line of the axis2 server, as well as by
observing a constant rate as the response to the client instead of the random
-rate, which changes by each and every 20 seconds.</p>
+rate, which changes by each and every 20 seconds.<br>
+</p>
-<p> </p>
+<h2><a name="Callout">Synchronize web service invocation with Callout
+mediator </a></h2>
+
+<p>The Callout mediator calls the given service URL with the request message
+which is given by the source attribute, waits for the response and attaches
+the received response to the destination which is given by the target
+attribute. Both the source and the target can be a key or an XPath. In the
+case of the source, this key refers to either a message context property or
+to a local entry. For the target, this key refers to a message context
+property only. </p>
+
+<h2><a name="Sample430">Sample 430: Simple Callout Mediator
+for synchronizing web service invocation</a></h2>
<p> </p>
+<pre>
+ <!-- Simple callout mediator -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <callout serviceURL="http://localhost:9000/soap/SimpleStockQuoteService"
+ action="urn:getQuote">
+ <source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
+ <target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
+ </callout>
+ <property name="RESPONSE" value="true"/>
+ <header name="To" action="remove"/>
+ <send/>
+ <drop/>
+</definitions> </pre>
+
+<div>
+<p><strong>Objective:</strong> Demonstrate the use of the Callout mediator
+for the synchronized web service invocation</p>
+
+<p><strong>Prerequisites:</strong> Deploy the SimpleStockQuoteService in
+sample Axis2 server and start it on port 9000.</p>
+
+<p>Start Synapse with the sample configuration 430 (i.e. synapse -sample
+430).</p>
+
+<p>In this sample, Callout mediator does the direct service invocation to the
+StockQuoteService using the client request, get the response and set it as
+the first child of the SOAP message body. Then using the send mediator, the
+message is sent back to the client. </p>
+
+<p>Invoke the client as follows. </p>
+<pre>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/</pre>
+</div>
</body>
</html>
Modified: webservices/synapse/trunk/java/src/site/resources/Synapse_Samples_Setup.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Samples_Setup.html?rev=615763&r1=615762&r2=615763&view=diff
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples_Setup.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples_Setup.html Mon Jan 28 00:43:56 2008
@@ -443,17 +443,18 @@
<h2 id="mailsender">Setting up Mail Transport Sender</h2>
-<p>To enable the mail transport, you need to uncomment the mail transport
-sender configuration in the repository/conf/axis2.xml. Change the
-mail.smtp.host parameter value to a working SMTP host.</p>
-<pre> <!-- ================================================= -->
- <!-- Mail Transport Sender -->
- <!--Only need to uncomment the sender. Configuration is achieved with every client.
- At any instant mail host should be given. Sample configuration has been given.
- http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html-->
- <!-- ================================================= -->
- <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
- <parameter name="mail.smtp.host">localhost</parameter>
+<p>To enable the mail transport for samples, you need to uncomment the mail transport
+sender configuration in the repository/conf/axis2.xml. Uncomment the
+MailTransportSender sample configuration and make sure it points to a valid
+SMTP configuration for any actual scenarios.</p>
+<pre> <transportSender name="mailto" class="org.apache.synapse.transport.mail.MailTransportSender">
+ <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
+ <parameter name="mail.smtp.port">587</parameter>
+ <parameter name="mail.smtp.starttls.enable">true</parameter>
+ <parameter name="mail.smtp.auth">true</parameter>
+ <parameter name="mail.smtp.user">synapse.demo.0</parameter>
+ <parameter name="mail.smtp.password">mailpassword</parameter>
+ <parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
</transportSender></pre>
<p></p>
@@ -507,7 +508,7 @@
<p>When using Derby, you need to add derby.jar, derbyclient.jar and
derbynet.jar to the classpath. This can be done by putting the above three
-jars into the Synapse lib directory. For testing these samples Derby 10.1.1.0
+jars into the Synapse lib directory. For testing these samples Derby 10.3.2.1
binary distribution was used.</p>
<p>You can use any other database product instead of Derby. Then you have to
Modified: webservices/synapse/trunk/java/src/site/site.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/site.xml?rev=615763&r1=615762&r2=615763&view=diff
==============================================================================
--- webservices/synapse/trunk/java/src/site/site.xml (original)
+++ webservices/synapse/trunk/java/src/site/site.xml Mon Jan 28 00:43:56 2008
@@ -21,9 +21,14 @@
<project name="Apache Synapse">
<bannerLeft>
- <name>Apache Synapse</name>
+ <name></name>
<href>ws.apache.org/synapse/</href>
</bannerLeft>
+
+ <bannerRight>
+ <src>images/apache-synapse-banner.jpg</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
<skin>
<groupId>org.apache.maven.skins</groupId>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org