[wsas-java-dev] svn commit r131 - in wsas/java/trunk/modules/samples/CommodityQuote: src/org/wso2/wsas/sample/commodityquote/client xdocs

svn at wso2.com svn at wso2.com
Mon Dec 4 04:33:37 PST 2006


Author: azeez
Date: Mon Dec  4 04:33:36 2006
New Revision: 131

Modified:
   wsas/java/trunk/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
   wsas/java/trunk/modules/samples/CommodityQuote/xdocs/commodity_quote_sample.html
Log:
Not supporting secure RM in CommodityQuote sample for scenarios 1 & 9



Modified: wsas/java/trunk/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
==============================================================================
--- wsas/java/trunk/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java	(original)
+++ wsas/java/trunk/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java	Mon Dec  4 04:33:36 2006
@@ -300,7 +300,7 @@
         clientOptions.setUseSeparateListener(true);
         clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER,
                                   new SandeshaListenerImpl());
-        
+
         String offeredSequenceId = UUIDGenerator.getUUID();
         clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, offeredSequenceId);
     }
@@ -323,10 +323,11 @@
      * Configuring for  security authentication.
      * All will be configured via https
      *
+     * @return the selected security scenario number
      * @throws AxisFault
      * @throws IOException
      */
-    private void configureSecurity(String[] args, EndpointReference epr)
+    private int configureSecurity(String[] args, EndpointReference epr)
             throws AxisFault, IOException, XMLStreamException {
         stub._getServiceClient().engageModule(new QName(MODULE_SECURITY));
         stub._getServiceClient()
@@ -347,42 +348,41 @@
             serviceEPR = computeDefaultHttpsEPR();
         }
 
-        int scenario;
+        int scenarioNumber;
 
         while (true) {
-            System.out.println("Enter security scenario [1 .. 10]...");
+            System.out.println("Enter security scenario number [1 - 10]...");
             String temp = readOption();
-            scenario = Integer.parseInt(temp);
+            scenarioNumber = Integer.parseInt(temp);
             try {
-                if (scenario > 0 && scenario < 11) {
+                if (scenarioNumber > 0 && scenarioNumber < 11) {
                     break;
                 } else {
-                    System.out.println("Please select a valid security scenario");
+                    System.out.println("Please enter a valid security scenario number");
                 }
             } catch (NumberFormatException e) {
                 System.out.println(
-                        "Invalid value has been entered. Please select a value from [1 .. 9]");
+                        "Invalid value has been entered. Please select a value between [1  10]");
             }
         }
 
-        System.out.println("Client will be tuned to work on security scenario :  " + scenario);
+        System.out.println("Selected security scenario :  " + scenarioNumber);
 
-        if (scenario == 1) {
+        if (scenarioNumber == 1) {
             // Use HTTPS EPR
             epr.setAddress(serviceEPR);
             stub._getServiceClient().getOptions().setTo(epr);
-            configureUtSec(stub, scenario);
-        } else if (scenario == 9) {
+            configureUtSec(stub, scenarioNumber);
+        } else if (scenarioNumber == 9) {
             // Use HTTPS EPR
             epr.setAddress(serviceEPR);
             stub._getServiceClient().getOptions().setTo(epr);
-            configurekeystoreSec(stub, scenario);
+            configurekeystoreSec(stub, scenarioNumber);
         } else {
             // Use HTTP EPR
-            configurekeystoreSec(stub, scenario);
+            configurekeystoreSec(stub, scenarioNumber);
         }
-
-
+        return scenarioNumber;
     }
 
     private void configureUtSec(Stub stub, int scenario) throws AxisFault, FileNotFoundException,
@@ -469,7 +469,6 @@
                              policy);
 
         if (QOS_VALUE_SECURE_RM.equals(qosValue)) {
-            //TODO added per testing securerm scenario
             stub._getServiceClient().getServiceContext().getConfigurationContext()
                     .getAxisConfiguration().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_POLICY, policy);
         }
@@ -487,7 +486,12 @@
 
     private void configureSecureRM(String[] args,
                                    EndpointReference epr) throws IOException, XMLStreamException {
-        this.configureSecurity(args, epr);
+        int secScenarioNumber = this.configureSecurity(args, epr);
+        if(secScenarioNumber == 1 || secScenarioNumber == 9){
+            System.err.println("Secure-RM not supported for scenarios 1 & 9 since HTTPS is required " +
+                               "on the client side receiver. This is a limitation of the client.");
+            System.exit(1);
+        }
         this.configureRM();
     }
 

Modified: wsas/java/trunk/modules/samples/CommodityQuote/xdocs/commodity_quote_sample.html
==============================================================================
--- wsas/java/trunk/modules/samples/CommodityQuote/xdocs/commodity_quote_sample.html	(original)
+++ wsas/java/trunk/modules/samples/CommodityQuote/xdocs/commodity_quote_sample.html	Mon Dec  4 04:33:36 2006
@@ -13,7 +13,7 @@
 <h1>Commodity Quote Sample Guide for WSO2 Web Services Application Server
 (WSO2 WSAS) for Java, v at wso2wsas_version@</h1>
 
-<p> </p>
+<p>&nbsp;</p>
 
 <p><img alt="Figure:1" src="images/cse.jpg" /><br />
 </p>
@@ -217,7 +217,7 @@
 <pre>STARTING COMMODITY QUOTE SAMPLE CLIENT
 =============================
 
-Enter security scenario [1 .. 10]...
+Enter security scenario [1 - 10]...
 {select a value between 1 to 10}
 </pre>
 <ol>
@@ -235,7 +235,7 @@
 STARTING COMMODITY QUOTE SAMPLE CLIENT
 =============================
 
-Enter security scenario [1 .. 10]...
+Enter security scenario [1 - 10]...
 1
 Client will be tuned to work on security scenario :  1
 Please enter your username :
@@ -308,7 +308,7 @@
         <pre>STARTING COMMODITY QUOTE SAMPLE CLIENT
 =============================
 
-Enter security scenario [1 .. 10]...
+Enter security scenario [1 - 10]...
 2
 Client will be tuned to work on security scenario :  2
 In this demonstration, client will use client.jks and server should use
@@ -378,7 +378,7 @@
         or
         $ sh run-client.sh -qos rm</pre>
 
-<p> </p>
+<p>�</p>
 <pre>   
 STARTING COMMODITY QUOTE SAMPLE CLIENT
 =============================
@@ -399,7 +399,8 @@
 
 <h4><em>sample 4: -qos securerm : When Rampart/Rahas and Sandesha been
 engaged. </em></h4>
-
+<b>Scenarios 1 & 9 with Secure-RM are not supported since since HTTPS is required on the client side receiver.
+    This is a limitation of the client.</b>
 <p>From CommodityQuote directory type:</p>
 <pre>   $ sh run-client.sh -qos securerm</pre>
 




More information about the Wsas-java-dev mailing list