Author: asankha Date: Wed May 31 20:26:06 2006 New Revision: 410728 URL: http://svn.apache.org/viewvc?rev=410728&view=rev Log: fix issue with sample illustrating proxy services
Modified: incubator/synapse/trunk/java/modules/samples/scripts/userguide/build.xml incubator/synapse/trunk/java/modules/samples/src/samples/mediation/ProxyStockQuoteClient.java incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml Modified: incubator/synapse/trunk/java/modules/samples/scripts/userguide/build.xml URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/scripts/userguide/build.xml?rev=410728&r1=410727&r2=410728&view=diff ============================================================================== --- incubator/synapse/trunk/java/modules/samples/scripts/userguide/build.xml (original) +++ incubator/synapse/trunk/java/modules/samples/scripts/userguide/build.xml Wed May 31 20:26:06 2006 @@ -63,13 +63,14 @@ ant simplequote [-Dsymbol=IBM] [-Dinvestbot_url=http://ws.invesbot.com/stockquotes.asmx] [-Dgatewayurl=http://localhost:8080/StockQuote] [-Drepository=../synapse_repository] ant proxyquote - Use Proxy services to query stock prices + Use Proxy services to query stock prices. (Must be used with the sample configuration # 3) examples: ant proxyquote - ant proxyquote -Dsymbol=IBM -Durl=http://www.webservicex.net/stockquote.asmx -Dsynapseurl=http://localhost - -Drepository=../synapse_repository" - + ant proxyquote -Dsymbol=IBM + -DfwdProxy=http://localhost:8080/axis2/services/InvesbotForwardProxy + -DdefProxy=http://localhost:8080/axis2/services/InvesbotDefaultProxy + -DseqProxy=http://localhost:8080/axis2/services/InvesbotSequenceProxy" </echo> </target> @@ -79,6 +80,9 @@ <property name="synapseurl" value="http://localhost:8080"/> <property name="gatewayurl" value="http://localhost:8080/StockQuote"/> <property name="repository" value="../synapse_repository"/> + <property name="fwdProxy" value="http://localhost:8080/axis2/services/InvesbotForwardProxy"/> + <property name="defProxy" value="http://localhost:8080/axis2/services/InvesbotDefaultProxy"/> + <property name="seqProxy" value="http://localhost:8080/axis2/services/InvesbotSequenceProxy"/> <property name="class.dir" value="target/classes"/> @@ -153,9 +157,9 @@ <java classname="samples.mediation.ProxyStockQuoteClient" classpathref="javac.classpath" fork="true"> <arg value="${symbol}"/> - <arg value="${investbot_url}"/> - <arg value="${gatewayurl}"/> - <arg value="${repository}"/> + <arg value="${fwdProxy}"/> + <arg value="${defProxy}"/> + <arg value="${seqProxy}"/> </java> </target> Modified: incubator/synapse/trunk/java/modules/samples/src/samples/mediation/ProxyStockQuoteClient.java URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/src/samples/mediation/ProxyStockQuoteClient.java?rev=410728&r1=410727&r2=410728&view=diff ============================================================================== --- incubator/synapse/trunk/java/modules/samples/src/samples/mediation/ProxyStockQuoteClient.java (original) +++ incubator/synapse/trunk/java/modules/samples/src/samples/mediation/ProxyStockQuoteClient.java Wed May 31 20:26:06 2006 @@ -18,37 +18,41 @@ import org.apache.axiom.om.OMElement; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContextConstants; public class ProxyStockQuoteClient { public static void main(String[] args) { - String symbol = "IBM"; - String xurl = "http://ws.invesbot.com/stockquotes.asmx"; - String turl = "http://localhost:8080/axis2/services/InvesbotForwardProxy"; - - if (args.length > 0) symbol = args[0]; - if (args.length > 1) xurl = args[1]; - if (args.length > 2) turl = args[2]; - - ProxyStockQuoteClient.testStandardQuote(symbol, xurl, turl); + String symbol = "IBM"; + String fwdProxy = "http://localhost:8080/axis2/services/InvesbotForwardProxy"; + String defProxy = "http://localhost:8080/axis2/services/InvesbotDefaultProxy"; + String seqProxy = "http://localhost:8080/axis2/services/InvesbotSequenceProxy"; + + if (args.length > 0) symbol = args[0]; + if (args.length > 1) fwdProxy = args[1]; + if (args.length > 2) defProxy = args[2]; + if (args.length > 2) seqProxy = args[3]; + + ProxyStockQuoteClient.testProxyQuote(symbol, fwdProxy); + ProxyStockQuoteClient.testProxyQuote(symbol, defProxy); + ProxyStockQuoteClient.testProxyQuote(symbol, seqProxy); } - private static void testStandardQuote(String symbol, String xurl, String turl) { + private static void testProxyQuote(String symbol, String url) { try { OMElement getQuote = CustomQuoteXMLHandler.createStandardRequestPayload(symbol); Options options = new Options(); - //options.setTo(new EndpointReference(xurl)); - options.setProperty(MessageContextConstants.TRANSPORT_URL, turl); + options.setProperty(MessageContextConstants.TRANSPORT_URL, url); options.setAction("http://ws.invesbot.com/GetQuote"); ServiceClient serviceClient = new ServiceClient(); serviceClient.setOptions(options); - OMElement result = serviceClient.sendReceive(getQuote).getFirstElement(); + OMElement result = serviceClient.sendReceive(getQuote); + result.build(); + result = result.getFirstElement(); System.out.println("Proxy :: Stock price = $" + CustomQuoteXMLHandler.parseStandardResponsePayload(result)); } catch (Exception e) { Modified: incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml?rev=410728&r1=410727&r2=410728&view=diff ============================================================================== --- incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml (original) +++ incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml Wed May 31 20:26:06 2006 @@ -5,7 +5,11 @@ <log level="custom"> <property name="sequence" value="*** Custom 'stockquote'Sequence ***"/> </log> - <header name="To" value="http://ws.invesbot.com/stockquotes.asmx"/> + <in> + <header name="To" value="http://ws.invesbot.com/stockquotes.asmx"/> + </in> + <!-- set correlation field to custom label --> + <set-property name="correlate/label" value="stockquote"/> <send/> </sequence> @@ -32,10 +36,18 @@ </proxies> <rules> + <out> + <filter source="get-property('correlate/label')" regex="stockquote"> + <sequence ref="stockquote"/> + </filter> + </out> + <log level="custom"> <property name="sequence" value="*** Default Main mediator Sequence ***"/> </log> - <header name="To" value="http://ws.invesbot.com/stockquotes.asmx"/> + <in> + <header name="To" value="http://ws.invesbot.com/stockquotes.asmx"/> + </in> <send/> </rules> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]