You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ch...@apache.org on 2007/03/26 13:18:45 UTC
svn commit: r522484 - in /webservices/synapse/trunk/java/modules/samples:
services/LoadbalanceFailoverService/
services/LoadbalanceFailoverService/conf/
services/LoadbalanceFailoverService/src/
services/LoadbalanceFailoverService/src/samples/ services/...
Author: chathura_ce
Date: Mon Mar 26 04:18:43 2007
New Revision: 522484
URL: http://svn.apache.org/viewvc?view=rev&rev=522484
Log:
Added sample for load balancing and failover endpoints. Sample service returns the port of the server in which the service is running. Sample client continuesly sends requests Synapse running on a specified port and prints the response for each request. So it is possible to observe how requests are distributed based on the load balancing or failover policy used.
Added:
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/build.xml
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/services.xml
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/
webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/LoadbalanceFailoverService.java
webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/LoadbalanceFailoverClient.java
Modified:
webservices/synapse/trunk/java/modules/samples/src/main/java/samples/util/SampleAxis2Server.java
webservices/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh
webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml
Added: webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/build.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/build.xml?view=auto&rev=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/build.xml (added)
+++ webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/build.xml Mon Mar 26 04:18:43 2007
@@ -0,0 +1,71 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project default="build-service">
+
+ <property name="synapse.home" value="../../../.."/>
+ <property name="lib" value="${synapse.home}/lib"/>
+ <property name="temp.dir" value="temp"/>
+ <property name="services" value="../../repository/services"/>
+ <property name="classes" value="${temp.dir}/classes"/>
+ <property name="src" value="src"/>
+
+ <path id="synapse.class.path">
+ <pathelement path="${java.class.path}"/>
+ <fileset dir="${synapse.home}">
+ <include name="lib/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="init" depends="clean">
+ <mkdir dir="${temp.dir}"/>
+ <mkdir dir="${services}"/>
+ <mkdir dir="${classes}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${temp.dir}"/>
+ <delete dir="${classes}"/>
+ </target>
+
+ <target name="compile-all" depends="init">
+ <javac debug="on" destdir="${classes}">
+ <src path="${src}"/>
+ <classpath refid="synapse.class.path"/>
+ </javac>
+ </target>
+
+ <target name="build-service" depends="compile-all">
+ <property name="LBFA.dir" value="${temp.dir}/LoadbalanceFailoverService"/>
+ <mkdir dir="${LBFA.dir}"/>
+
+ <mkdir dir="${LBFA.dir}/META-INF"/>
+ <copy file="conf/services.xml" tofile="${LBFA.dir}/META-INF/services.xml"/>
+ <copy toDir="${LBFA.dir}">
+ <fileset dir="${classes}">
+ <include name="**/*.class"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${services}/LoadbalanceFailoverService.aar">
+ <fileset dir="${LBFA.dir}"/>
+ </jar>
+ </target>
+
+</project>
\ No newline at end of file
Added: webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/services.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/services.xml?view=auto&rev=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/services.xml (added)
+++ webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/conf/services.xml Mon Mar 26 04:18:43 2007
@@ -0,0 +1,30 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<serviceGroup>
+<service name="LoadbalanceFailoverService">
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">samples.services.LoadbalanceFailoverService</parameter>
+</service>
+</serviceGroup>
\ No newline at end of file
Added: webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/LoadbalanceFailoverService.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/LoadbalanceFailoverService.java?view=auto&rev=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/LoadbalanceFailoverService.java (added)
+++ webservices/synapse/trunk/java/modules/samples/services/LoadbalanceFailoverService/src/samples/services/LoadbalanceFailoverService.java Mon Mar 26 04:18:43 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package samples.services;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+
+public class LoadbalanceFailoverService {
+
+ public OMElement sampleOperation(OMElement param) {
+ param.build();
+ param.detach();
+
+ String port = System.getProperty("http_port");
+ if (port != null) {
+ param.setText("Response from server: " + port);
+ } else {
+ param.setText("Response from anonymous server");
+ }
+ return param;
+ }
+
+ public OMElement sleepOperation(OMElement timeElement) throws AxisFault {
+
+ timeElement.build();
+ timeElement.detach();
+
+ String time = timeElement.getText();
+ try {
+ Thread.sleep(Long.parseLong(time));
+ } catch (InterruptedException e) {
+ throw new AxisFault("Service is interrupted while sleeping.");
+ }
+
+ String port = System.getProperty("http_port");
+ if (port != null) {
+ timeElement.setText("Response from server: " + port);
+ } else {
+ timeElement.setText("Response from anonymous server");
+ }
+ return timeElement;
+ }
+}
\ No newline at end of file
Added: webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/LoadbalanceFailoverClient.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/LoadbalanceFailoverClient.java?view=auto&rev=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/LoadbalanceFailoverClient.java (added)
+++ webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/LoadbalanceFailoverClient.java Mon Mar 26 04:18:43 2007
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package samples.userguide;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.util.Random;
+
+public class LoadbalanceFailoverClient {
+
+ /**
+ * @param args 0: simple | session
+ * 1: port
+ * 2: iteration
+ */
+ public static void main(String[] args) {
+
+ String mode = System.getProperty("mode");
+
+ if (mode != null) {
+ if (mode.equalsIgnoreCase("session")) {
+ new LoadbalanceFailoverClient().sessionfullClient();
+ } else if (mode.equalsIgnoreCase("simple")) {
+ new LoadbalanceFailoverClient().sessionlessClient();
+ }
+ }
+
+ // default is simple client
+ new LoadbalanceFailoverClient().sessionlessClient();
+ }
+
+ private void sessionlessClient() {
+
+ String synapsePort = "8080";
+ int iterations = 100;
+ boolean infinite = true;
+
+ String pPort = System.getProperty("port");
+ String pIterations = System.getProperty("i");
+
+ if (pPort != null) {
+ try {
+ stringToInt(pPort);
+ synapsePort = System.getProperty("port");
+ } catch(NumberFormatException e) {
+ // run with default value
+ }
+ }
+
+ if (pIterations != null) {
+ try {
+ iterations = stringToInt(pIterations);
+ if(iterations != -1) {
+ infinite = false;
+ }
+ } catch(NumberFormatException e) {
+ // run with default values
+ }
+ }
+
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement value = fac.createOMElement("Value", null);
+ value.setText("Sample string");
+
+ Options options = new Options();
+ options.setTo(new EndpointReference("http://localhost:" + synapsePort + "/soap/services/LoadbalanceFailoverService"));
+ options.setAction("sampleOperation");
+
+ try {
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("client_repo", null);
+ ServiceClient client = new ServiceClient(configContext, null);
+ options.setTimeOutInMilliSeconds(10000000);
+
+ client.setOptions(options);
+ client.engageModule(new QName("addressing"));
+
+ long i = 0;
+ while(i < iterations || infinite) {
+ OMElement responseElement = client.sendReceive(value);
+ String response = responseElement.getText();
+
+ i++;
+ System.out.println("Request: " + i + " ==> " + response);
+ }
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ }
+ }
+
+ /**
+ * This method creates 3 soap envelopes for 3 different client based sessions. Then it randomly
+ * choose one envelope for each iteration and send it to the ESB. ESB should be configured with
+ * session affinity load balancer and the SampleClientInitiatedSession dispatcher. This will
+ * output request number, session number and the server ID for each iteration. So it can be
+ * observed that one session number always associated with one server ID.
+ */
+ private void sessionfullClient() {
+
+ String synapsePort = "8080";
+ int iterations = 100;
+ boolean infinite = true;
+
+ String pPort = System.getProperty("port");
+ String pIterations = System.getProperty("i");
+
+ if (pPort != null) {
+ try {
+ stringToInt(pPort);
+ synapsePort = System.getProperty("port");
+ } catch(NumberFormatException e) {
+ // run with default value
+ }
+ }
+
+ if (pIterations != null) {
+ try {
+ iterations = stringToInt(pIterations);
+ if(iterations != -1) {
+ infinite = false;
+ }
+ } catch(NumberFormatException e) {
+ // run with default values
+ }
+ }
+
+ Options options = new Options();
+ options.setTo(new EndpointReference("http://localhost:" + synapsePort + "/soap/services/LoadbalanceFailoverService"));
+ options.setAction("sampleOperation");
+ options.setTimeOutInMilliSeconds(10000000);
+
+ try {
+
+ SOAPEnvelope env1 = buildSoapEnvelope("c1", "v1");
+ SOAPEnvelope env2 = buildSoapEnvelope("c2", "v1");
+ SOAPEnvelope env3 = buildSoapEnvelope("c3", "v1");
+ SOAPEnvelope[] envelopes = {env1, env2, env3};
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("client_repo", null);
+ ServiceClient client = new ServiceClient(configContext, null);
+ client.setOptions(options);
+ client.engageModule(new QName("addressing"));
+
+ int i = 0;
+ int sessionNumber = 0;
+ while(i < iterations || infinite) {
+
+ i++;
+
+ MessageContext messageContext = new MessageContext();
+ sessionNumber = getSessionTurn(envelopes.length);
+ messageContext.setEnvelope(envelopes[sessionNumber]);
+
+ OperationClient op = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+ op.addMessageContext(messageContext);
+ op.execute(true);
+
+ MessageContext responseContext = op.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ SOAPEnvelope responseEnvelope = responseContext.getEnvelope();
+
+ OMElement vElement = responseEnvelope.getBody().getFirstChildWithName(new QName("Value"));
+ System.out.println("Request: " + i + " Session number: " + sessionNumber + " " + vElement.getText());
+ }
+
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ private int getSessionTurn(int max) {
+ Random random = new Random();
+ return random.nextInt(max);
+ }
+
+ private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
+
+ String targetEPR = "http://localhost:9000/axis2/services/Service1";
+ String opration = "sampleOperation";
+
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
+
+ OMNamespace wsaNamespace = soapFactory.createOMNamespace("http://www.w3.org/2005/08/addressing", "wsa");
+
+ SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+
+ SOAPHeader header = soapFactory.createSOAPHeader();
+ envelope.addChild(header);
+
+ OMNamespace synNamespace = soapFactory.createOMNamespace("http://ws.apache.org/namespaces/synapse", "syn");
+ OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
+ clientIDElement.setText(clientID);
+ header.addChild(clientIDElement);
+
+ SOAPBody body = soapFactory.createSOAPBody();
+ envelope.addChild(body);
+
+ OMElement valueElement = soapFactory.createOMElement("Value", null);
+ valueElement.setText(value);
+ body.addChild(valueElement);
+
+ return envelope;
+ }
+
+ private int stringToInt(String stringNumber) {
+
+ int number = new Integer(stringNumber).intValue();
+
+ return number;
+ }
+}
Modified: webservices/synapse/trunk/java/modules/samples/src/main/java/samples/util/SampleAxis2Server.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/java/samples/util/SampleAxis2Server.java?view=diff&rev=522484&r1=522483&r2=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/java/samples/util/SampleAxis2Server.java (original)
+++ webservices/synapse/trunk/java/modules/samples/src/main/java/samples/util/SampleAxis2Server.java Mon Mar 26 04:18:43 2007
@@ -78,7 +78,7 @@
log.info("[SimpleAxisServer] Starting");
if (repoOption != null) {
repoLocation = repoOption.getOptionValue();
- log.info("[SimpleAxisServer] Using the Axis2 Repository"
+ System.out.println("[SimpleAxisServer] Using the Axis2 Repository"
+ new File(repoLocation).getAbsolutePath());
}
if (confOption != null) {
@@ -110,17 +110,35 @@
configCtx.getAxisConfiguration().getTransportsIn().get(new QName("http"));
if(trsIn != null) {
- String port = System.getProperty("port");
+ String port = System.getProperty("http_port");
if(port != null) {
try {
new Integer(port);
trsIn.getParameter("port").setValue(port);
} catch (NumberFormatException e) {
+ log.error("Given port is not a valid integer. Using 9001 for port.");
+ trsIn.getParameter("port").setValue("9001");
+ }
+ } else {
+ trsIn.getParameter("port").setValue("9001");
+ }
+ }
+
+ TransportInDescription httpsTrsIn = (TransportInDescription)
+ configCtx.getAxisConfiguration().getTransportsIn().get(new QName("https"));
+
+ if(httpsTrsIn != null) {
+ String port = System.getProperty("https_port");
+ if(port != null) {
+ try {
+ new Integer(port);
+ httpsTrsIn.getParameter("port").setValue(port);
+ } catch (NumberFormatException e) {
log.error("Given port is not a valid integer. Using 9000 for port.");
- trsIn.getParameter("port").setValue("9000");
+ httpsTrsIn.getParameter("port").setValue("9002");
}
} else {
- trsIn.getParameter("port").setValue("9000");
+ httpsTrsIn.getParameter("port").setValue("9002");
}
}
}
Modified: webservices/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh?view=diff&rev=522484&r1=522483&r2=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh (original)
+++ webservices/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh Mon Mar 26 04:18:43 2007
@@ -102,23 +102,39 @@
echo " Using AXIS2 Repository : $AXIS2_HOME/repository"
echo " Using AXIS2 Configuration : $AXIS2_HOME/repository/conf/axis2.xml"
-PORT="-Dport=9000"
-if [ "$1" = "-port" ]; then
- PORT="-Dport=$2"
-fi
+HTTP_PORT_SET="FALSE"
+HTTPS_PORT_SET="FALSE"
-if [ "$3" = "-port" ]; then
- PORT="-Dport=$4"
-fi
+PROGRAM_PARAMS=""
+while [ "$1" != "" ]; do
-if [ "$1" = "-xdebug" ]; then
- XDEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000"
-fi
+ if [ "$1" = "-xdebug" ]; then
+ PROGRAM_PARAMS="$PROGRAM_PARAMS""-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000 "
+ shift
+
+ elif [ "$1" = "-http" ]; then
+ PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttp_port=$2 "
+ HTTP_PORT_SET="TRUE"
+ shift
+ shift
-if [ "$3" = "-xdebug" ]; then
- XDEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000"
+ elif [ "$1" = "-https" ]; then
+ PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttps_port=$2 "
+ HTTPS_PORT_SET="TRUE"
+ shift
+ shift
+
+ fi
+
+done
+
+if [ "$HTTP_PORT_SET" = "FALSE" ]; then
+ PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttp_port=9001 "
fi
+if [ "$HTTPS_PORT_SET" = "FALSE" ]; then
+ PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttps_port=9002 "
+fi
-java $PORT $XDEBUG -Djava.endorsed.dirs=$AXIS2_ENDORSED -classpath $AXIS2_CLASSPATH samples.util.SampleAxis2Server \
+java $PROGRAM_PARAMS -Djava.endorsed.dirs=$AXIS2_ENDORSED -classpath $AXIS2_CLASSPATH samples.util.SampleAxis2Server \
-repo $AXIS2_HOME/repository -conf $AXIS2_HOME/repository/conf/axis2.xml
Modified: webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml?view=diff&rev=522484&r1=522483&r2=522484
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml (original)
+++ webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml Mon Mar 26 04:18:43 2007
@@ -18,79 +18,79 @@
-->
<project name="samples" default="help" basedir=".">
- <target name="help">
- <echo>
- This script requires Ant 1.5 or higher
-
- usage:
- ant -help
- display ant help screen
- ant help
- display this message
- ant clean
- delete the build directory
- ant compile
- build the samples
-
- These client samples are able to send stock quote and order placement messages
-
- ant stockquote
- This client could be used to act as a 'smart client', by specifying a
- WS-Addressing EPR directed to the real endpoint, and the transport endpoint
- set differently
-
- examples:
- ant stockquote
- ant stockquote [-Dsymbol=IBM]
- [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
- [-Dtransporturl=http://localhost:8080] [-Drepository=client_repo]
- [-Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml]
-
- ant proxystockquote
- A client that could act as a HTTP proxy client
-
- examples:
- ant proxystockquote
- ant proxystockquote [-Dsymbol=IBM]
- [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
- [-Dtransporturl=http://localhost:8080]
-
- ant dumbstockquote
- A client that could directly invoke the service on a given endpoint. i.e. as a 'gateway'
-
- examples:
- ant dumbstockquote
- ant dumbstockquote [-Dsymbol=IBM]
- [-Dgatewayurl=http://localhost:8080/axis2/services/StockQuoteProxy]
- [-Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml]
-
- ant customquote
- A client which could send out a stock quote request in a custom format. It is
- expected to transform this message to a standard request, and the response back as
- a custom response as expected by this client
-
- examples:
- ant customquote
- ant customquote [-Dsymbol=IBM]
- [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
- [-Dtransporturl=http://localhost:8080]
-
- ant placeorder
- A client which could send out a one way message using the Axis2 ServiceClient's
- fireAndForget() API
-
- examples:
- ant placeorder
- ant placeorder
- [-Dsymbol=IBM] [-Dgatewayurl=http://localhost:8080/axis2/services/StockQuoteProxy]
-
- ant jmsclient
- A client which could post a JMS text or binary message to a given destination.
-
- examples
- ant jmsclient
- [-Ddest=dynamicQueues/JMSTextProxy] [-Dtype=text|binary|xml]
- [-Dpayload="24.34 100 IBM | MSFT" | "repository\conf\sample\resources\mtom\asf-logo.gif"]
+ <target name="help">
+ <echo>
+ This script requires Ant 1.5 or higher
+
+ usage:
+ ant -help
+ display ant help screen
+ ant help
+ display this message
+ ant clean
+ delete the build directory
+ ant compile
+ build the samples
+
+ These client samples are able to send stock quote and order placement messages
+
+ ant stockquote
+ This client could be used to act as a 'smart client', by specifying a
+ WS-Addressing EPR directed to the real endpoint, and the transport endpoint
+ set differently
+
+ examples:
+ ant stockquote
+ ant stockquote [-Dsymbol=IBM]
+ [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
+ [-Dtransporturl=http://localhost:8080] [-Drepository=client_repo]
+ [-Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml]
+
+ ant proxystockquote
+ A client that could act as a HTTP proxy client
+
+ examples:
+ ant proxystockquote
+ ant proxystockquote [-Dsymbol=IBM]
+ [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
+ [-Dtransporturl=http://localhost:8080]
+
+ ant dumbstockquote
+ A client that could directly invoke the service on a given endpoint. i.e. as a 'gateway'
+
+ examples:
+ ant dumbstockquote
+ ant dumbstockquote [-Dsymbol=IBM]
+ [-Dgatewayurl=http://localhost:8080/axis2/services/StockQuoteProxy]
+ [-Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml]
+
+ ant customquote
+ A client which could send out a stock quote request in a custom format. It is
+ expected to transform this message to a standard request, and the response back as
+ a custom response as expected by this client
+
+ examples:
+ ant customquote
+ ant customquote [-Dsymbol=IBM]
+ [-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
+ [-Dtransporturl=http://localhost:8080]
+
+ ant placeorder
+ A client which could send out a one way message using the Axis2 ServiceClient's
+ fireAndForget() API
+
+ examples:
+ ant placeorder
+ ant placeorder
+ [-Dsymbol=IBM] [-Dgatewayurl=http://localhost:8080/axis2/services/StockQuoteProxy]
+
+ ant jmsclient
+ A client which could post a JMS text or binary message to a given destination.
+
+ examples
+ ant jmsclient
+ [-Ddest=dynamicQueues/JMSTextProxy] [-Dtype=text|binary|xml]
+ [-Dpayload="24.34 100 IBM | MSFT" | "repository\conf\sample\resources\mtom\asf-logo.gif"]
</echo>
</target>
@@ -120,7 +120,7 @@
<target name="stockquote" depends="compile">
<java classname="samples.userguide.StockQuoteClient"
classpathref="javac.classpath" fork="true">
- <arg value="${symbol}"/>
+ <arg value="${symbol}"/>
<arg value="${url}"/>
<arg value="${transporturl}"/>
<arg value="${repository}"/>
@@ -131,7 +131,7 @@
<target name="proxystockquote" depends="compile">
<java classname="samples.userguide.ProxyStockQuoteClient"
classpathref="javac.classpath" fork="true">
- <arg value="${symbol}"/>
+ <arg value="${symbol}"/>
<arg value="${url}"/>
<arg value="${transporturl}"/>
</java>
@@ -140,7 +140,7 @@
<target name="dumbstockquote" depends="compile">
<java classname="samples.userguide.DumbStockQuoteClient"
classpathref="javac.classpath" fork="true">
- <arg value="${symbol}"/>
+ <arg value="${symbol}"/>
<arg value="${gatewayurl}"/>
<arg value="${repository}"/>
<arg value="${secpolicy}"/>
@@ -150,7 +150,7 @@
<target name="customquote" depends="compile">
<java classname="samples.userguide.CustomStockQuoteClient"
classpathref="javac.classpath" fork="true">
- <arg value="${symbol}"/>
+ <arg value="${symbol}"/>
<arg value="${url}"/>
<arg value="${transporturl}"/>
</java>
@@ -159,15 +159,24 @@
<target name="placeorder" depends="compile">
<java classname="samples.userguide.PlaceOrderClient"
classpathref="javac.classpath" fork="true">
- <arg value="${symbol}"/>
+ <arg value="${symbol}"/>
<arg value="${gatewayurl}"/>
</java>
</target>
+ <target name="loadbalancefailover" depends="compile">
+ <java classname="samples.userguide.LoadbalanceFailoverClient"
+ classpathref="javac.classpath" fork="true">
+ <sysproperty key="mode" value="${mode}"/>
+ <sysproperty key="port" value="${port}"/>
+ <sysproperty key="iterations" value="${i}"/>
+ </java>
+ </target>
+
<target name="jmsclient" depends="compile">
<java classname="samples.userguide.GenericJMSClient"
classpathref="javac.classpath" fork="true">
- <arg value="${dest}"/>
+ <arg value="${dest}"/>
<arg value="${type}"/>
<arg value="${payload}"/>
</java>
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org