Author: asankha
Date: Wed Jan 7 02:16:29 2009
New Revision: 732295
URL: http://svn.apache.org/viewvc?rev=732295&view=rev
Log:
make the stockquote able to switch between SOAP 1.1 and 1.2
update the SimpleStockQuoteService to throw a SOAP fault if the stock symbol
"ERR" is requested. This could be used to illustrate handling of faults
Modified:
synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/src/samples/services/SimpleStockQuoteService.java
synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
synapse/trunk/java/modules/samples/src/main/scripts/axis2Client/build.xml
synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml
Modified:
synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/src/samples/services/SimpleStockQuoteService.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/src/samples/services/SimpleStockQuoteService.java?rev=732295&r1=732294&r2=732295&view=diff
==============================================================================
---
synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/src/samples/services/SimpleStockQuoteService.java
(original)
+++
synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/src/samples/services/SimpleStockQuoteService.java
Wed Jan 7 02:16:29 2009
@@ -22,7 +22,11 @@
public class SimpleStockQuoteService {
// in-out
- public GetQuoteResponse getQuote(GetQuote request) {
+ public GetQuoteResponse getQuote(GetQuote request) throws Exception {
+
+ if ("ERR".equals(request.getSymbol())) {
+ throw new Exception("Invalid stock symbol : ERR");
+ }
System.out.println(new Date() + " " + this.getClass().getName() +
" :: Generating quote for : " + request.getSymbol());
return new GetQuoteResponse(request.getSymbol());
Modified:
synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java?rev=732295&r1=732294&r2=732295&view=diff
==============================================================================
---
synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
(original)
+++
synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
Wed Jan 7 02:16:29 2009
@@ -21,6 +21,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
@@ -103,6 +104,7 @@
// defaults
String symbol = getProperty("symbol", "IBM");
+ String soapVer = getProperty("soapver", "soap11");
String mode = getProperty("mode", "quote");
String addUrl = getProperty("addurl", null);
String trpUrl = getProperty("trpurl", null);
@@ -212,6 +214,10 @@
MercuryClientConstants.SEQUENCE_OFFER,
UUIDGenerator.getUUID());
}
+ if ("soap12".equals(soapVer)) {
+ options.setSoapVersionURI(SOAP12Constants.
SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
serviceClient.setOptions(options);
InnerStruct.MODE = mode;
@@ -242,18 +248,6 @@
}
}
}
-
-// try {
-// if (configContext != null) {
-// configContext.terminate();
-// }
- // the above statement was used on reccomendation by Chamikara as
I remember, but
- // since using Axis2 1.3 - this causes some unexpected
classloading issue on the
- // Axis2 server side - which cannot be described. This using the
below as suggested
- // by Deepal
-// serviceClient.cleanup();
-// } catch (Exception ignore) {
-// }
}
public static class InnerStruct {
Modified:
synapse/trunk/java/modules/samples/src/main/scripts/axis2Client/build.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/src/main/scripts/axis2Client/build.xml?rev=732295&r1=732294&r2=732295&view=diff
==============================================================================
--- synapse/trunk/java/modules/samples/src/main/scripts/axis2Client/build.xml
(original)
+++ synapse/trunk/java/modules/samples/src/main/scripts/axis2Client/build.xml
Wed Jan 7 02:16:29 2009
@@ -31,6 +31,7 @@
ant stockquote [-Dsymbol=IBM|MSFT|SUN|..]
[-Dmode=quote | customquote | fullquote | placeorder |
marketactivity]
+ [-Dsoapver=soap11 | soap12]
[-Daddurl=http://localhost:9000/services/SimpleStockQuoteService]
[-Dtrpurl=http://localhost:8280]
[-Dprxurl=http://localhost:8280]
@@ -112,6 +113,7 @@
<property name="symbol" value=""/>
<property name="mode" value=""/>
+ <property name="soapver" value=""/>
<property name="i" value=""/>
<property name="port" value=""/>
<property name="addurl" value=""/>
@@ -156,6 +158,7 @@
classpathref="javac.classpath" fork="true">
<sysproperty key="symbol" value="${symbol}"/>
<sysproperty key="mode" value="${mode}"/>
+ <sysproperty key="soapver" value="${soapver}"/>
<sysproperty key="addurl" value="${addurl}"/>
<sysproperty key="trpurl" value="${trpurl}"/>
<sysproperty key="prxurl" value="${prxurl}"/>
Modified: synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml?rev=732295&r1=732294&r2=732295&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml Wed Jan 7
02:16:29 2009
@@ -210,6 +210,7 @@
</p>
<pre xml:space="preserve">ant stockquote [-Dsymbol=IBM|MSFT|SUN|..]
[-Dmode=quote | customquote | fullquote | placeorder | marketactivity]
+ [-Dsoapver=soap11 | soap12]
[-Daddurl=http://localhost:9000/services/SimpleStockQuoteService]
[-Dtrpurl=http://localhost:8280] [-Dprxurl=http://localhost:8280]
[-Dpolicy=../../repository/conf/sample/resources/policy/policy_1.xml]</pre>