You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2006/02/20 17:18:00 UTC

svn commit: r379153 - /webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java

Author: dug
Date: Mon Feb 20 08:17:56 2006
New Revision: 379153

URL: http://svn.apache.org/viewcvs?rev=379153&view=rev
Log:
Move loading of RM/Sec impls to a common spot

Modified:
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java?rev=379153&r1=379152&r2=379153&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java Mon Feb 20 08:17:56 2006
@@ -60,6 +60,25 @@
     RMInterface           rmImpl      = null ;
     WSSecInterface        secImpl     = null ;
 
+    private void loadImpls(MessageContext msgContext) throws Exception {
+      if ( rmImpl != null ) return ;
+      if ( secImpl != null ) return ;
+
+      // Look for WSSecurity impl
+      String cls = msgContext.getStrProp( "WSSecurityImpl" );
+      if ( cls == null ) 
+        cls = (String) msgContext.getAxisEngine().getOption("WSSecurityImpl");
+      if ( cls != null )
+        secImpl = (WSSecInterface) Class.forName(cls).newInstance();
+
+      // Look for WSRM impl
+      cls = msgContext.getStrProp( "WSRMImpl" );
+      if ( cls == null ) 
+        cls = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
+      if ( cls != null )
+        rmImpl = (RMInterface) Class.forName(cls).newInstance();
+    }
+
     public AxisClient(EngineConfiguration config) {
         super(config);
     }
@@ -79,6 +98,8 @@
     public void invokeOutbound(MessageContext msgContext) throws Exception {
         Handler h = null ;
 
+        loadImpls(msgContext);
+
         /* Process the Service Specific Request Chain */
         /**********************************************/
         SOAPService service = msgContext.getService();
@@ -119,7 +140,6 @@
           }
         }
 
-        // Run the security code - Init security sessions if needed
         if ( secImpl != null )
           secImpl.init( msgContext );
     }
@@ -137,6 +157,8 @@
         String  hName = msgContext.getTransportName();
         Handler h     = null ;
 
+        loadImpls(msgContext);
+
         if ( hName != null && (h = getTransport( hName )) != null )  {
           // Piggy-back any RM headers (like ACKs)
           if ( rmImpl != null ) 
@@ -240,20 +262,7 @@
             // set active context
             setCurrentMessageContext(msgContext);
 
-            // Look for WSSecurity impl
-            String cls = msgContext.getStrProp( "WSSecurityImpl" );
-            if ( cls == null ) 
-              cls = (String) msgContext.getAxisEngine()
-                                       .getOption("WSSecurityImpl");
-            if ( cls != null )
-              secImpl = (WSSecInterface) Class.forName(cls).newInstance();
-
-            // Look for WSRM impl
-            cls = msgContext.getStrProp( "WSRMImpl" );
-            if ( cls == null ) 
-              cls = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
-            if ( cls != null )
-              rmImpl = (RMInterface) Class.forName(cls).newInstance();
+            loadImpls(msgContext);
 
             // Do WSA processing first
             WSAHandler.invoke( msgContext );