You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2005/12/09 17:22:27 UTC

svn commit: r355529 [1/4] - in /beehive/trunk: system-controls/ system-controls/external/webservice/ system-controls/src/ejb/org/apache/beehive/controls/system/ejb/ system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ system-co...

Author: cschoett
Date: Fri Dec  9 08:21:32 2005
New Revision: 355529

URL: http://svn.apache.org/viewcvs?rev=355529&view=rev
Log:
A first round of refactoring for the service control. Still a bit rough around the edges but functionally complete.  
Changes include:

*) Support for faults/exceptions
*) Support for attachments (Image attachments right now, the rest to follow)
*) Removal of XMLBeans dependency for parsing wsdl's (now use wsdl4j)
*) A new AXIS abstraction layer for the service control.
*) Bug fixes for RPC style service controls.
*) A number of new tests for the service control, including tests for attachments and faults.
*) Service control is now about 90% decoupled from wsm.


Added:
    beehive/trunk/system-controls/external/webservice/
    beehive/trunk/system-controls/external/webservice/activation-1.0.2.jar   (with props)
    beehive/trunk/system-controls/external/webservice/mailapi-1.3.2.jar   (with props)
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java   (with props)
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java   (with props)
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java   (with props)
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/ControlWsdlLocator.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/DomUtils.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java   (with props)
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlNamespaceResolver.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFault.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFaultList.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpReturnType.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOperation.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlUtils.java
    beehive/trunk/system-controls/test/src/webservice/schemas/ImagesDocLitWrapped.wsdl
    beehive/trunk/system-controls/test/src/webservice/schemas/ImagesRpcLit.wsdl
    beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/ImagesRpcEnc.wsdl
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/attachments/
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/attachments/ImageAttachments.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/ComplexAddressException.java
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/ImagesDocLitWrapped.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/ImagesRpcEnc.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/ImagesRpcLit.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/resources/
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/resources/beehive_logo.gif   (with props)
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/attachments/images/resources/bird1.jpg   (with props)
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/ImageAttachementDocLitWrappedTest.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/ImageAttachementRpcEncTest.java   (with props)
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/ImageAttachementRpcLitTest.java   (with props)
Removed:
    beehive/trunk/system-controls/test/src/webservice/schemas/ServiceWS.wsdl
Modified:
    beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/servicecontrol.vm
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java
    beehive/trunk/system-controls/systemcontrols-imports.xml
    beehive/trunk/system-controls/test/src/webservice/build.xml
    beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java
    beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java
    beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java
    beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordDocLit.wsdl
    beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordRpcLit.wsdl
    beehive/trunk/system-controls/test/src/webservice/schemas/DocumentLiteralWrappedSample.wsdl
    beehive/trunk/system-controls/test/src/webservice/schemas/RpcLiteralSample.wsdl
    beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/web/complex/DocumentLiteralWrappedSample.java
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/RpcLitWebServiceTest.java
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/SoapMarshallingRpcEncArrayTypesTest.java
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/SoapMarshallingRpcLitArrayTypesTest.java
    beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/dlwservice/DocLitWrapWebServiceTest.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/controls/ControlProvider.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java

Added: beehive/trunk/system-controls/external/webservice/activation-1.0.2.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/external/webservice/activation-1.0.2.jar?rev=355529&view=auto
==============================================================================
Binary file - no diff available.

Propchange: beehive/trunk/system-controls/external/webservice/activation-1.0.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: beehive/trunk/system-controls/external/webservice/mailapi-1.3.2.jar
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/external/webservice/mailapi-1.3.2.jar?rev=355529&view=auto
==============================================================================
Binary file - no diff available.

Propchange: beehive/trunk/system-controls/external/webservice/mailapi-1.3.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.java (original)
+++ beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.java Fri Dec  9 08:21:32 2005
@@ -81,7 +81,9 @@
             // Generate a unique local jndi name to associate w/ the link,
             // based upon the local control service uri and control id
             //
-            _jndiName = JNDI_APPSCOPED_PREFIX + EJBInfo.getEJBRefName(context.getControlInterface());
+            // todo: doesn't work this way!
+//            _jndiName = JNDI_APPSCOPED_PREFIX + EJBInfo.getEJBRefName(context.getControlInterface());
+            _jndiName = EJBInfo.getEJBRefName(context.getControlInterface());
         }
 
         // Obtain the JCX interface and identify the home/remote

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java Fri Dec  9 08:21:32 2005
@@ -65,7 +65,7 @@
     @PropertySet(
         prefix = "OperationName",
         externalConfig = false,
-        optional = true,
+        optional = false,
         hasSetters = false
     )
     @Retention(RetentionPolicy.RUNTIME)
@@ -88,7 +88,44 @@
     public @interface WSDL {
         @AnnotationMemberTypes.FilePath String path();
 
-        String service() default "";
+        String service();
+        String serviceTns();
+        String portName();
+    }
+
+    /**
+     * Currently the only service provider supported is Apache AXIS.
+     * As new service providers are added this enumeration should be updated.
+     */
+    public enum ServiceFactoryProviderType {
+       APACHE_AXIS ("org.apache.axis.client.ServiceFactory"),
+       DEFAULT ("org.apache.axis.client.ServiceFactory") ;
+
+        private String _serviceFactoryClassName;
+
+        ServiceFactoryProviderType(String serviceFactoryClassName) {
+            _serviceFactoryClassName = serviceFactoryClassName;
+        }
+
+        public String getServiceFactoryClassName() {
+            return _serviceFactoryClassName;
+        }
+    }
+
+    /**
+     * Specify the JAXRPC ServiceFactory implementation for a webservice control.
+     * Currently only Apache AXIS is supported.
+     */
+    @PropertySet(
+      prefix="",
+            externalConfig = false,
+            optional = false,
+            hasSetters = false
+            )
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE})
+    public @interface ServiceFactoryProvider {
+        ServiceFactoryProviderType value() default ServiceFactoryProviderType.DEFAULT;
     }
 
     /**

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java Fri Dec  9 08:21:32 2005
@@ -17,7 +17,6 @@
  */
 package org.apache.beehive.controls.system.webservice.generator;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.LinkedList;
 
@@ -27,23 +26,37 @@
 public final class MethodInfo {
 
     private LinkedList<ParameterInfo> _params;
-    private String _name;
+    private String _methodName;
     private String _returnTypeName;
+    private String _operationName;
 
     /**
+     * Create a new Method info instance.
      */
     MethodInfo() {
         _params = new LinkedList<ParameterInfo>();
     }
 
-    void setName(String name) {
-        if (!GeneratorUtils.isValidJavaIdentifier(name)) {
-            _name = GeneratorUtils.transformInvalidJavaIdentifier(name);
-
-            /* todo: i18n */
-            System.out.println("Warning: method name " + name + " is not a valid Java method name, changing to: " + _name);
+    /**
+     *
+     * @param methodName
+     */
+    void setMethodName(String methodName) {
+        if (!GeneratorUtils.isValidJavaIdentifier(methodName)) {
+            _methodName = GeneratorUtils.transformInvalidJavaIdentifier(methodName);
+            System.out.println("Warning: method name " + methodName
+                    + " is not a valid Java method name, changing to: " + _methodName);
+        } else {
+            _methodName = methodName;
         }
-        else _name = name;
+    }
+
+    /**
+     *
+     * @param operationName
+     */
+    void setOperationName(String operationName) {
+        _operationName = operationName;
     }
 
     /**
@@ -68,8 +81,8 @@
      * Get the name of this method.
      * @return String
      */
-    public String getName() {
-        return _name;
+    public String getMethodName() {
+        return _methodName;
     }
 
     void setReturnTypeName(String returnType) {
@@ -77,6 +90,14 @@
         if (_returnTypeName.startsWith("java.lang.")) {
             _returnTypeName = _returnTypeName.substring(_returnTypeName.lastIndexOf('.')+1);
         }
+    }
+
+    /**
+     * Get the operation name this method corresponds to in the WSDL.
+     * @return String
+     */
+    public String getOperationName() {
+        return _operationName;
     }
 
     /**

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java Fri Dec  9 08:21:32 2005
@@ -15,24 +15,12 @@
  */
 package org.apache.beehive.controls.system.webservice.generator;
 
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Properties;
-import javax.jws.WebParam;
-
 import org.apache.axis.wsdl.toJava.Utils;
+import org.apache.beehive.controls.system.webservice.wsdl.Wsdl;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpParameter;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpReturnType;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
 import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
-import org.apache.beehive.wsm.wsdl.Utilities;
-import org.apache.beehive.wsm.wsdl.WSDLParser;
 import org.apache.beehive.wsm.util.JavaClassUtils;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
@@ -41,13 +29,23 @@
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
-import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
 
 /**
  * Generate a service control from a WSDL using Velocity.
  */
-public final class ServiceControlGenerator
-{
+public final class ServiceControlGenerator {
     private static final FileFilter FILE_FILTER_WSDL = new WSDLFilter();
     private static final String WSDL_FILE_EXTENSION = "wsdl";
     private static final String SERVICE_CONTROL_FILE_EXTENSION = ".java";
@@ -68,8 +66,7 @@
      * @throws Exception
      */
     static void generateJCXs(File wsdlDirectory, File outputDir, String pkgName, String wsdlPathAnnotation)
-            throws Exception
-    {
+            throws Exception {
         assert wsdlDirectory.isDirectory() : "wsdlLocation must be a directory!";
         for (File wsdlFile : wsdlDirectory.listFiles(FILE_FILTER_WSDL)) {
             generateJCX(wsdlFile, outputDir, pkgName, wsdlPathAnnotation);
@@ -86,40 +83,42 @@
      * @throws Exception
      */
     static void generateJCX(File wsdlFile, File outputDir, String pkgName, String wsdlPathAnnotation)
-            throws Exception
-    {
+            throws Exception {
         assert wsdlFile.isFile() : "wsdlFile must be a file!";
         final String wsdlPath;
 
         // todo:  Does this make sense here?
-        if (wsdlPathAnnotation != null)
+        if (wsdlPathAnnotation != null) {
             wsdlPath = genWsdlPath(wsdlPathAnnotation + File.pathSeparatorChar + wsdlFile.getName());
-        else wsdlPath = genWsdlPath(wsdlFile.getName());
+        }
+        else {
+            wsdlPath = genWsdlPath(wsdlFile.getName());
+        }
 
-        DefinitionsDocument wsdlDocument = Utilities.parseWSDL(wsdlFile);
-        final String serviceURLString = new WSDLParser(wsdlDocument).getSoapAddressLocation();
-        XmlBeanWSDLProcessor xbwp = new XmlBeanWSDLProcessor(wsdlDocument, new SystemTypeLookupService());
-        BeehiveWsTypeMetadata bwtm = xbwp.getObjectModel();
-        ArrayList<MethodInfo> methodList = buildMethodList(bwtm);
+        Wsdl wsdl = new Wsdl(wsdlFile.toURI());
+        List<MethodInfo> methodList = buildMethodList(wsdl);
 
         if (pkgName == null)
-            pkgName = Utils.makePackageName(bwtm.getTargetNamespace());
+            pkgName = Utils.makePackageName(wsdl.getTargetNamespace());
 
         if (_velocityEngine == null)
             initializeVelocity();
 
         VelocityContext context = new VelocityContext();
         context.put("controlPackageName", pkgName);
-        context.put("serviceName", bwtm.getServiceName());
-        context.put("serviceURLString", serviceURLString);
+        context.put("serviceName", wsdl.getServiceName());
+        context.put("serviceTns", wsdl.getTargetNamespace());
+        context.put("serviceURLString", wsdl.getServiceEndpoint());
         context.put("wsdlPath", wsdlPath);
         context.put("methodList", methodList);
+        context.put("portName", wsdl.getPortName());
 
-        Writer jcxWriter = getJcxWriter(outputDir, pkgName, bwtm.getServiceName());
+        Writer jcxWriter = getJcxWriter(outputDir, pkgName, wsdl.getServiceName());
 
         try {
             _velocityTemplate.merge(context, jcxWriter);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             throw(e);
         } finally {
             jcxWriter.close();
@@ -132,6 +131,7 @@
 
     /**
      * Initialize the velocity engine.
+     *
      * @throws Exception
      * @throws ResourceNotFoundException
      * @throws ParseErrorException
@@ -139,8 +139,7 @@
      */
     static private void initializeVelocity()
             throws Exception, ResourceNotFoundException,
-            ParseErrorException, MethodInvocationException
-    {
+            ParseErrorException, MethodInvocationException {
         Properties p = new Properties();
         p.setProperty(VelocityEngine.RESOURCE_LOADER, "class");
         p.setProperty("class." + VelocityEngine.RESOURCE_LOADER + ".class", ClasspathResourceLoader.class.getName());
@@ -152,17 +151,18 @@
 
     /**
      * gen the wsdl path.
+     *
      * @param wsdlPath
      * @return String
      */
-    static private String genWsdlPath(String wsdlPath)
-    {
+    static private String genWsdlPath(String wsdlPath) {
         return wsdlPath.replace('\\', File.pathSeparatorChar);
     }
 
     /**
      * Create a Writer for the JCX control.
-     * @param outputDir The output directory.
+     *
+     * @param outputDir   The output directory.
      * @param packageName Package name for the service control.
      * @param serviceName The web service name.
      * @return java.io.Writer
@@ -170,8 +170,7 @@
      * @throws UnsupportedEncodingException
      */
     static private Writer getJcxWriter(File outputDir, String packageName, String serviceName)
-            throws FileNotFoundException, UnsupportedEncodingException
-    {
+            throws FileNotFoundException, UnsupportedEncodingException {
         assert serviceName != null : "genJcxWriter: Service name can not be null!";
         assert packageName != null : "genJcxWriter: Package name can not be null!";
 
@@ -185,45 +184,86 @@
             if (subDir.isDirectory()) {
                 File jcx = new File(subDir, serviceName + SERVICE_CONTROL_FILE_EXTENSION);
                 return new PrintWriter(jcx, SERVICE_CONTROL_FILE_ENCODING);
-            } else {
+            }
+            else {
                 throw new RuntimeException(subDir.getPath() + " is not a directory");
             }
-        } else {
+        }
+        else {
             throw new RuntimeException("Service and package name must not be null");
         }
     }
 
     /**
      * Builds a list of methods from the beehive type metadata.
-     * @param wsm BeehiveWsTypeMetadata model
+     *
+     * @param wsdlDefinition A WSDL definition.
      * @return An array list containing the methods of the service control.
      */
-    private static ArrayList<MethodInfo> buildMethodList(BeehiveWsTypeMetadata wsm) {
+    static private ArrayList<MethodInfo> buildMethodList(Wsdl wsdlDefinition) {
         ArrayList<MethodInfo> methodList = new ArrayList<MethodInfo>();
 
-        for(BeehiveWsMethodMetadata method : wsm.getMethods()) {
-            MethodInfo m = new  MethodInfo();
-            m.setName(method.getWmOperationName());
-            /* todo: need to put this readable name stuff into a single place... */
-            m.setReturnTypeName(JavaClassUtils.convertToReadableName(method.getJavaReturnType()));
-
-            for(BeehiveWsParameterMetadata param : method.getParams()) {
-                String javaType = JavaClassUtils.convertToReadableName(param.getJavaType());
-
-                if (param.getWpMode() == WebParam.Mode.IN)
-                    m.addParameter(param.getWpName(), javaType);
-                else m.addOutParameter(param.getWpName(), javaType);
+        for (WsdlOperation operation : wsdlDefinition.getOperations()) {
+            WsdlOpReturnType rtype = operation.getReturnType();
+            Class javaReturnType;
+            if (rtype != null) {
+                javaReturnType = getClass(rtype.getXmlType(), rtype.getItemXmlType(), rtype.isArray());
+            }
+            else {
+                javaReturnType = getClass(null, null, false);
+            }
+
+            MethodInfo m = new MethodInfo();
+            m.setMethodName(operation.getOperationName().getLocalPart());
+            m.setOperationName(operation.getOperationName().getLocalPart());
+            m.setReturnTypeName(JavaClassUtils.convertToReadableName(javaReturnType.getCanonicalName()));
+
+            for (WsdlOpParameter param : operation.getParameters()) {
+                Class paramType = getClass(param.getXmlType(), param.getItemXmlType(), param.isArray());
+                if (param.getMode() == WsdlOpParameter.ParameterMode.IN) {
+                    m.addParameter(param.getName().getLocalPart(),
+                                   JavaClassUtils.convertToReadableName(paramType.getCanonicalName()));
+                }
+                else {
+                    m.addOutParameter(param.getName().getLocalPart(),
+                                      JavaClassUtils.convertToReadableName(paramType.getCanonicalName()));
+                }
             }
             methodList.add(m);
         }
         return methodList;
     }
 
+    static private Class getClass(QName xmlType, QName itemXmlType, boolean isArray) {
+
+        if (xmlType == null) {
+            return void.class;
+        }
+
+        SystemTypeLookupService stls = new SystemTypeLookupService();
+        if (!isArray) {
+            return stls.qname2class(xmlType);
+        }
+
+        //
+        // this is an array type, if the itemXmlType is not null, lookup the java class mapping
+        // using it.  If its not defined use the xmlType. Typically not defined for doc/lit/wrap.
+        //
+        Class javaReturnType;
+        if (itemXmlType != null) {
+            javaReturnType = stls.qname2class(itemXmlType);
+        }
+        else {
+            javaReturnType = stls.qname2class(xmlType);
+        }
+        Object o = Array.newInstance(javaReturnType, 1);
+        return o.getClass();
+    }
+
     /**
      * FileFilter for WSDL files.
      */
-    private static final class WSDLFilter implements FileFilter
-    {
+    private static final class WSDLFilter implements FileFilter {
         public final boolean accept(File f) {
             return f.isFile() && (f.getName().toLowerCase().endsWith(WSDL_FILE_EXTENSION));
         }

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java Fri Dec  9 08:21:32 2005
@@ -47,6 +47,8 @@
     private String _destPackageName;
     private String _wsdlPathAnnotation;
 
+    //@todo: should add settings for service name and binding name
+
     /**
      * Create a new ServiceControlGeneratorTask.
      */

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/servicecontrol.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/servicecontrol.vm?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/servicecontrol.vm (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/servicecontrol.vm Fri Dec  9 08:21:32 2005
@@ -39,6 +39,9 @@
 import org.apache.beehive.controls.system.webservice.ServiceControl;
 import org.apache.beehive.controls.system.webservice.ServiceControl.Location;
 import org.apache.beehive.controls.system.webservice.ServiceControl.WSDL;
+import org.apache.beehive.controls.system.webservice.ServiceControl.OperationName;
+import org.apache.beehive.controls.system.webservice.ServiceControl.ServiceFactoryProvider;
+import org.apache.beehive.controls.system.webservice.ServiceControl.ServiceFactoryProviderType;
 
 /**
  * This file is service control which was automatically generated from wsdl:
@@ -46,12 +49,14 @@
  */
 @ControlExtension
 @Location(urls = {"$serviceURLString"})
-@WSDL(path = "$wsdlPath", service = "$serviceName")
+@WSDL(path = "$wsdlPath", service = "$serviceName", serviceTns="$serviceTns", portName="$portName")
+@ServiceFactoryProvider(ServiceFactoryProviderType.APACHE_AXIS)
 public interface $serviceName
     extends ServiceControl {
 
 #foreach($method in $methodList)
-    public $method.returnTypeName $method.name(
+    @OperationName("$method.operationName")
+    public $method.returnTypeName $method.methodName(
 #if($method.params.size() > 0)
 #params($method)
 #else
@@ -59,4 +64,7 @@
 #end
        throws Exception;
 #end
+
+
+
 }

Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java Fri Dec  9 08:21:32 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.jaxrpc;
+
+import org.apache.axis.constants.Use;
+import org.apache.axis.description.ParameterDesc;
+import org.apache.axis.encoding.XMLType;
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpParameter;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
+import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
+import org.apache.beehive.wsm.axis.registration.AxisTypeRegistrar;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.encoding.TypeMapping;
+
+
+/**
+ * This is the AXIS 1.2 implementation of the call abstraction layer of the service control.
+ */
+public final class ScAxisCall extends ScCall
+{
+
+    private AxisTypeRegistrar _typeRegistrar;
+
+    /**
+     * Create a new ScAxisCall instance.
+     *
+     * @param service Service to create the call with.
+     * @throws ServiceException On error.
+     */
+    ScAxisCall(Service service) throws ServiceException {
+        _call = service.createCall();
+        TypeMapping typeMapping = service.getTypeMappingRegistry().getDefaultTypeMapping();
+        _typeRegistrar = new AxisTypeRegistrar(typeMapping, new SystemTypeLookupService());
+    }
+
+    /* -----------------------------   Protected Methods ------------------------- */
+
+    /**
+     * Add a fault to the Call.
+     *
+     * @param faultName     QName of the fault.
+     * @param xmlType       QName of the xmltype of the fault.
+     * @param isComplexType Is the xmlType a complex type?
+     * @param style         SOAPBinding style.
+     * @param use           SOAPBinding use.
+     */
+    protected void addFault(QName faultName, QName xmlType, boolean isComplexType,
+                            WsdlOperation.SOAPBindingStyle style, WsdlOperation.SOAPBindingUse use) {
+
+        SystemTypeLookupService lookup = new SystemTypeLookupService();
+        Class javaType = lookup.qname2class(xmlType);
+        QName registeredTypeQName = registerType(javaType, xmlType, style, use);
+        ((org.apache.axis.client.Call) _call).addFault(faultName, javaType, registeredTypeQName, isComplexType);
+    }
+
+    /**
+     * Add a parameter to the Call.
+     *
+     * @param paramName  QName of the parameter to add.
+     * @param paramClass Class of the parameter to add.
+     * @param xmlType    XMLType of the parameter to add.
+     * @param mode       Mode of the parameter.
+     * @param isHeader   True if this parameter should be placed in the header of the SOAP message.
+     */
+    protected void addParameter(QName paramName, Class paramClass, QName xmlType, WsdlOpParameter.ParameterMode mode, boolean isHeader) {
+
+        ParameterMode jaxrpcMode;
+        if (mode == WsdlOpParameter.ParameterMode.IN) {
+            jaxrpcMode = ParameterMode.IN;
+        }
+        else if (mode == WsdlOpParameter.ParameterMode.INOUT) {
+            jaxrpcMode = ParameterMode.INOUT;
+        }
+        else {
+            jaxrpcMode = ParameterMode.OUT;
+        }
+
+        if (isHeader) {
+            ((org.apache.axis.client.Call) _call).addParameterAsHeader(paramName, xmlType, paramClass,
+                                                                       jaxrpcMode, jaxrpcMode);
+        }
+        else {
+            ((org.apache.axis.client.Call) _call).addParameter(paramName, xmlType, paramClass, jaxrpcMode);
+        }
+    }
+
+    /**
+     * Register a type.
+     *
+     * @param typeClass
+     * @param xmlName
+     * @param style
+     * @param use
+     * @return QName
+     */
+    protected QName registerType(Class typeClass, QName xmlName,
+                                 WsdlOperation.SOAPBindingStyle style, WsdlOperation.SOAPBindingUse use) {
+
+        SOAPBinding.Style jaxrpcStyle =
+                (style == WsdlOperation.SOAPBindingStyle.DOCUMENT) ? SOAPBinding.Style.DOCUMENT : SOAPBinding.Style.RPC;
+        SOAPBinding.Use jaxrpcUse =
+                (use == WsdlOperation.SOAPBindingUse.LITERAL) ? SOAPBinding.Use.LITERAL : SOAPBinding.Use.ENCODED;
+
+        return _typeRegistrar.registerType(typeClass, xmlName, jaxrpcStyle, jaxrpcUse);
+    }
+
+    /**
+     * Set the operational style of the Call.
+     *
+     * @param style          JAX-RPC style.
+     * @param parameterStyle JAX-RPC parameter style.
+     * @param use            JAX-RPC use.
+     */
+    protected void setOperationStyle(WsdlOperation.SOAPBindingStyle style,
+                                     WsdlOperation.SOAPParameterStyle parameterStyle,
+                                     WsdlOperation.SOAPBindingUse use) {
+        super.setOperationStyle(style, parameterStyle, use);
+
+        if (style == WsdlOperation.SOAPBindingStyle.RPC && use == WsdlOperation.SOAPBindingUse.LITERAL) {
+            ((org.apache.axis.client.Call) _call).setOperationUse(Use.LITERAL);
+        }
+    }
+
+    /**
+     * Set the return type for the Call.
+     *
+     * @param returnType    Java return type.
+     * @param xmlReturnType Xml return type.
+     */
+    protected void setReturnType(Class returnType, QName xmlReturnType) {
+        if (!_isOneWay && returnType != void.class) {
+            super.setReturnType(returnType, xmlReturnType);
+        }
+        else {
+            _call.setReturnType(XMLType.AXIS_VOID);
+        }
+    }
+
+    /**
+     * Set the port name for the call.
+     *
+     * @param portQName QName .
+     */
+    protected void setServicePortName(QName portQName) {
+        _call.setProperty(org.apache.axis.client.Call.WSDL_PORT_NAME, portQName);
+    }
+}

Propchange: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java
------------------------------------------------------------------------------
    svn:executable = *

Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java Fri Dec  9 08:21:32 2005
@@ -0,0 +1,403 @@
+/*
+ * B E A   S Y S T E M S
+ *
+ * N E T U I
+ *
+ * Copyright (c) 2001-2003  BEA Systems, Inc.
+ *
+ * All Rights Reserved. Unpublished rights reserved under the copyright laws
+ * of the United States. The software contained on this media is proprietary
+ * to and embodies the confidential technology of BEA Systems, Inc. The
+ * possession or receipt of this information does not convey any right to
+ * disclose its contents, reproduce it, or use,  or license the use,
+ * for manufacture or sale, the information or anything described
+ * therein. Any use, disclosure, or reproduction without BEA System's
+ * prior written permission is strictly prohibited.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.jaxrpc;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.system.webservice.utils.HolderUtils;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpFault;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpFaultList;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpParameter;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOpReturnType;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
+import org.apache.beehive.wsm.registration.TypeRegistrar;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Call;
+import javax.xml.rpc.holders.Holder;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * The abstract base class for the service control's JAX-RPC Call abstraction layer.  Due to some
+ * JAX-RPC limitations it becomes necessary for the service control to use some implementation specific
+ * API's.  This base class and classes derived from it are used to hide any SOAP stack implementation
+ * specific APIs and enable the service control to perform dynamic discovery of its runtime environment.
+ */
+public abstract class ScCall
+{
+    /**
+     * Value for wrapped operation style.
+     */
+    protected static final String WRAPPED_OPSTYLE = "wrapped";
+
+    /**
+     * Value for document operation style.
+     */
+    protected static final String DOCUMENT_OPSTYLE = "document";
+
+    /**
+     * Value for rpc operation style.
+     */
+    protected static final String RPC_OPSTYLE = "rpc";
+
+    /**
+     * JAX-RPC call.
+     */
+    protected Call _call;
+
+    /**
+     * Wsdl operation object model this call was configured with.
+     */
+    private WsdlOperation _op;
+
+    /**
+     * Number of call parameters.
+     */
+    private int _parameterCount;
+
+    /**
+     * Is this a oneway call? See JSR 181 specification.
+     */
+    protected boolean _isOneWay = false;
+
+    /**
+     * Configure this call for the specified wsdl operation.
+     *
+     * @param op       WsdlOperation used to configure the call.
+     * @param method   Webservice control's method.
+     * @param portType The port type to configure call with.
+     */
+    void configure(WsdlOperation op, Method method, QName portType) {
+
+        _op = op;
+        setOperationName(_op.getOperationName());
+        setOperationStyle(_op.getSOAPBindingStyle(), _op.getSOAPParameterStyle(), _op.getSOAPBindingUse());
+        setCallParameters(method);
+        setCallReturnType(method.getReturnType());
+        setFaults();
+        setServicePortName(portType);
+    }
+
+    /**
+     * Invoke the call.  Basically the same as calling the invoke() method on a standard JAX-RPC call object.
+     * As an added bonus this invoke method does not require that you remove any OUT mode parameters from the
+     * args array.
+     *
+     * @param args Values for the call's parameters.
+     * @return The result from the call.
+     * @throws RemoteException On error.
+     */
+    Object invoke(Object[] args) throws RemoteException {
+        Object result = _call.invoke(processArgs(args));
+        setHolderValues(args);
+        return result;
+    }
+
+    /**
+     * Set user defined properties from the service control.  Each of these property values can be set
+     * by the user and may change on a per-call basis.
+     *
+     * @param wsdlPort        The WSDL port. Equivalent to the setPortTypeName() JAX-RPC API.
+     * @param serviceEndpoint The service endpoint. Equivalent to the setTargetEndpointAddress() JAX-RPC API.
+     * @param username        Username for the call. Equivalent to the JAX-RPC Call.USERNAME_PROPERTY.
+     * @param password        Password for the call. Equivalent to the JAX-RPC Call.PASSWORD_PROPERTY.
+     */
+    void setUserDefinedProperties(QName wsdlPort, String serviceEndpoint, String username, String password) {
+        _call.setPortTypeName(wsdlPort);
+        _call.setTargetEndpointAddress(serviceEndpoint);
+
+        if (username != null) {
+            _call.setProperty(Call.USERNAME_PROPERTY, username);
+        }
+        else {
+            _call.removeProperty(Call.USERNAME_PROPERTY);
+        }
+
+        if (password != null) {
+            _call.setProperty(Call.PASSWORD_PROPERTY, password);
+        }
+        else {
+            _call.removeProperty(Call.PASSWORD_PROPERTY);
+        }
+    }
+
+    /* -----------------------------  Abstract Methods ------------------------- */
+
+    /**
+     * Add a parameter to the Call (abstract).
+     *
+     * @param paramName  QName of the parameter.
+     * @param paramClass Class of the parameter.
+     * @param xmlType    XMLType of the parameter.
+     * @param mode       JAX-RPC parameter mode.
+     * @param isHeader   true if this parameter should be placed in the header of the message.
+     */
+    abstract protected void addParameter(QName paramName, Class paramClass, QName xmlType,
+                                         WsdlOpParameter.ParameterMode mode, boolean isHeader);
+
+    /**
+     * Add a fault to the Call (abstract).
+     *
+     * @param faultName     QName of the fault.
+     * @param xmlType       QName of the fault's xml type.
+     * @param isComplexType Is this fault a complex data type?
+     * @param style         SOAPBindingStyle.
+     * @param use           SOAPBindingUse.
+     */
+    abstract protected void addFault(QName faultName, QName xmlType, boolean isComplexType,
+                                     WsdlOperation.SOAPBindingStyle style, WsdlOperation.SOAPBindingUse use);
+
+    /**
+     * Register a type.
+     *
+     * @param typeClass Class of type to register.
+     * @param xmlName   XML type of class to register.
+     * @param style     SOAPBinding style.
+     * @param use       SOAPBinding use.
+     * @return QName of the registered type.
+     */
+    abstract protected QName registerType(Class typeClass, QName xmlName,
+                                          WsdlOperation.SOAPBindingStyle style, WsdlOperation.SOAPBindingUse use);
+
+    /**
+     * Set the service port name for the call (abstract).  May be necessary to support JAX-RPC handlers.
+     *
+     * @param portQName QName of the service port.
+     */
+    abstract protected void setServicePortName(QName portQName);
+
+    /* -----------------------------   Protected Methods ------------------------- */
+
+    /**
+     * Mark this call as a oneway call (no return value).  See JSR181 specification for details.
+     *
+     * @param isOneWay true if one way.
+     */
+    protected void setOneWay(boolean isOneWay) {
+        _isOneWay = isOneWay;
+    }
+
+    /**
+     * Set the operation name for the call.
+     *
+     * @param opName The operation QName.
+     */
+    protected void setOperationName(QName opName) {
+        _call.setOperationName(opName);
+    }
+
+    /**
+     * Set the operation style for this call.
+     *
+     * @param style          JAX-RPC style.
+     * @param parameterStyle JAX-RPC parameter style.
+     * @param use            JAX-RPC use.
+     */
+    protected void setOperationStyle(WsdlOperation.SOAPBindingStyle style,
+                                     WsdlOperation.SOAPParameterStyle parameterStyle,
+                                     WsdlOperation.SOAPBindingUse use) {
+
+        if (style == WsdlOperation.SOAPBindingStyle.DOCUMENT) {
+            if (parameterStyle == WsdlOperation.SOAPParameterStyle.WRAPPED) {
+                _call.setProperty(Call.OPERATION_STYLE_PROPERTY, WRAPPED_OPSTYLE);
+            }
+            else {
+                _call.setProperty(Call.OPERATION_STYLE_PROPERTY, DOCUMENT_OPSTYLE);
+            }
+
+        }
+        else if (style == WsdlOperation.SOAPBindingStyle.RPC) {
+            _call.setProperty(Call.OPERATION_STYLE_PROPERTY, RPC_OPSTYLE);
+
+        }
+        else {
+            throw new ControlException("Invalid Binding style: " + style);
+        }
+    }
+
+    /**
+     * Set the return type of the Call.
+     *
+     * @param returnType    Return type class.
+     * @param xmlReturnType Return Xml type.
+     */
+    protected void setReturnType(Class returnType, QName xmlReturnType) {
+        _call.setReturnType(xmlReturnType, returnType);
+    }
+
+    /**
+     * Process the argument list for the call before the call's invoke() method is called.
+     * Processing consists of removing any OUT mode parameters and pulling values from Holders
+     * and placing them in the new argument list.
+     *
+     * @param args Argument list for a Call.
+     * @return A new argument list with any OUT mode parameters removed and Holder values insterted.
+     */
+    protected Object[] processArgs(Object[] args) {
+        ArrayList<Object> pList = new ArrayList<Object>();
+        List<WsdlOpParameter> parameters = _op.getParameters();
+
+        for (int i = 0; i < _parameterCount; i++) {
+            WsdlOpParameter.ParameterMode mode = parameters.get(i).getMode();
+            if (mode.equals(WsdlOpParameter.ParameterMode.IN)) {
+                pList.add(args[i]);
+
+            }
+            else if (mode.equals(WsdlOpParameter.ParameterMode.INOUT)) {
+                if (args[i] instanceof Holder) {
+                    try {
+                        Holder holder = (Holder) args[i];
+                        Field valueField = holder.getClass().getField("value");
+                        pList.add(valueField.get(holder));
+                    }
+                    catch (Exception e) {
+                        throw new ControlException("failed in getting holder value for call argument");
+                    }
+                }
+                else {
+                    pList.add(args[i]);
+                }
+            }
+        }
+        return pList.toArray();
+    }
+
+    /**
+     * After a Call has been invoked it is necessary to map values for OUT and INOUT mode parameters back
+     * into their Holders from the arg list to the Call.
+     *
+     * @param args The argument list which the Call was invoked with.
+     */
+    protected void setHolderValues(Object[] args) {
+        Map outParams = _call.getOutputParams();
+        if (outParams.isEmpty()) {
+            return;
+        }
+
+        List<WsdlOpParameter> parameters = _op.getParameters();
+        for (int i = 0; i < _parameterCount; i++) {
+
+            WsdlOpParameter param = parameters.get(i);
+            if (!param.getMode().equals(WsdlOpParameter.ParameterMode.IN)
+                    && args[i] instanceof Holder) {
+
+                QName paramQName = param.getName();
+                if (!param.isElementFormQualified()) {
+                    paramQName = new QName(paramQName.getLocalPart());
+                }
+
+                try {
+                    Holder holder = (Holder) args[i];
+                    if (outParams.containsKey(paramQName)) {
+                        HolderUtils.stuffHolderValue(holder, outParams.get(paramQName));
+                    }
+                }
+                catch (Exception e) {
+                    throw new ControlException("Failed in getting holder value for: " + paramQName);
+                }
+            }
+        }
+    }
+
+    /* -----------------------------   Protected Methods ------------------------- */
+
+    /**
+     * Set the parameter list for this call.
+     *
+     * @param method service control method.
+     */
+    private void setCallParameters(Method method) {
+
+        WsdlOpParameter[] operationParameters = _op.getParameters().toArray(new WsdlOpParameter[0]);
+        Class[] methodParameterTypes = method.getParameterTypes();
+        Type[] genericMethodParamTypes = method.getGenericParameterTypes();
+        _parameterCount = operationParameters.length;
+
+        if (operationParameters.length != methodParameterTypes.length) {
+            throw new ControlException("Object model and method definition don't match!");
+        }
+
+        for (int i = 0; i < methodParameterTypes.length; i++) {
+            setCallParameter(operationParameters[i], methodParameterTypes[i], genericMethodParamTypes[i]);
+        }
+    }
+
+    /**
+     * Set a call pararmeter on the call.
+     *
+     * @param opParam     Parameter.
+     * @param javaType    Java type of parameter.
+     * @param genericType Generic type of the java class.
+     */
+    private void setCallParameter(WsdlOpParameter opParam, Class javaType, Type genericType) {
+
+        WsdlOpParameter.ParameterMode mode = opParam.getMode();
+        if (mode != WsdlOpParameter.ParameterMode.IN && Holder.class.isAssignableFrom(javaType)) {
+            javaType = TypeRegistrar.getHoldersValueClass(genericType);
+        }
+
+        QName registeredTypeQName = registerType(javaType, opParam.getXmlType(),
+                                                 _op.getSOAPBindingStyle(), _op.getSOAPBindingUse());
+
+        QName paramName = opParam.getName();
+        if (!opParam.isElementFormQualified()) {
+            paramName = new QName(paramName.getLocalPart());
+        }
+        addParameter(paramName, javaType, registeredTypeQName, mode, opParam.isHeader());
+    }
+
+    /**
+     * Set the return type for the call.
+     *
+     * @param returnType Return type class.
+     */
+    private void setCallReturnType(Class returnType) {
+
+        WsdlOpReturnType rtype = _op.getReturnType();
+        QName resultTypeName = (rtype != null) ? rtype.getXmlType() : null;
+        if (!_op.isOneway() && returnType != void.class) {
+            resultTypeName = registerType(returnType, resultTypeName, _op.getSOAPBindingStyle(), _op.getSOAPBindingUse());
+        }
+        setOneWay(_op.isOneway());
+        setReturnType(returnType, resultTypeName);
+    }
+
+    /**
+     * Set the faults for the call.
+     */
+    private void setFaults() {
+
+        WsdlOpFaultList faultList = _op.getFaults();
+        for (WsdlOpFault fault : faultList) {
+            QName faultName = fault.getName();
+            if (!fault.isElementFormQualified()) {
+                faultName = new QName(faultName.getLocalPart());
+            }
+
+            addFault(faultName, fault.getXmlType(), fault.isComplextType(),
+                     _op.getSOAPBindingStyle(), _op.getSOAPBindingUse());
+        }
+    }
+}

Propchange: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCall.java
------------------------------------------------------------------------------
    svn:executable = *

Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java Fri Dec  9 08:21:32 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.jaxrpc;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+
+
+/**
+ * Factory for creating the JAX-RPC call abstraction used by the service control.  This factory
+ * determines the JAX-RPC implementations available at runtime by attemmpting to load various
+ * implementations using the class loader.  If found an implementation is added to the _callMappings
+ * Map along with its service control Call abstraction.
+ */
+public final class ScCallFactory
+{
+
+    /**
+     * Return an new ScCall based on the implementation of the Service instance.
+     *
+     * @param service Service to create call for.
+     * @return An ScCall instance.
+     */
+    static ScCall getCall(Service service, ServiceControl.ServiceFactoryProviderType provider) {
+
+        try {
+            switch (provider) {
+                case APACHE_AXIS:
+                case DEFAULT:
+                    return new ScAxisCall(service);
+                default:
+                    throw new UnsupportedOperationException("JAX-RPC service implementation for: "
+                            + service.getClass().getName() + "has not been registered with the ScCallFactory!");
+            }
+        }
+        catch (ServiceException se) {
+            throw new ControlException("Error creating CALL: " + se.getMessage(), se);
+
+        }
+    }
+}

Propchange: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScCallFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java Fri Dec  9 08:21:32 2005
@@ -15,57 +15,31 @@
  */
 package org.apache.beehive.controls.system.webservice.jaxrpc;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import javax.jws.WebParam;
-import javax.jws.soap.SOAPBinding;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.Service;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.ServiceFactory;
-import javax.xml.rpc.encoding.TypeMapping;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.holders.Holder;
-
-import org.apache.axis.constants.Use;
 import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.events.EventHandler;
 import org.apache.beehive.controls.api.bean.ControlImplementation;
 import org.apache.beehive.controls.api.bean.Extensible;
 import org.apache.beehive.controls.api.context.ControlBeanContext;
 import org.apache.beehive.controls.api.context.ResourceContext;
+import org.apache.beehive.controls.api.events.EventHandler;
 import org.apache.beehive.controls.system.webservice.ServiceControl;
-import org.apache.beehive.controls.system.webservice.utils.HolderUtils;
-import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
-import org.apache.beehive.wsm.axis.registration.AxisTypeRegistrar;
-import org.apache.beehive.wsm.databinding.BindingLookupService;
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
-import org.apache.beehive.wsm.registration.TypeRegistrar;
-import org.apache.beehive.wsm.wsdl.Utilities;
+import org.apache.beehive.controls.system.webservice.wsdl.Wsdl;
+import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
+import org.apache.beehive.controls.system.webservice.wsdl.ControlWsdlLocator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.xmlbeans.XmlException;
 import org.w3c.dom.Element;
-import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.handler.HandlerInfo;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.HashMap;
 
 @ControlImplementation
 public class ServiceControlImpl implements ServiceControl, Extensible, java.io.Serializable
@@ -81,20 +55,18 @@
     @org.apache.beehive.controls.api.context.Context
     protected ResourceContext _resourceContext;
 
-
     private QName _portType;
-    private BeehiveWsTypeMetadata _beehiveTypeMetadata;
+    private Wsdl _wsdl;
     private URL _endPoint;
     private QName _wsdlPort;
     private QName _serviceName;
     private String _username;
     private String _password;
+    private String _serviceFactoryClassName;
     private int _timeout = TIMOUT_DEFAULT;
-    private Map<String, Boolean> _elementFormQualifiedMap;
 
-    private transient TypeRegistrar _registrar;
     private transient Service _service;
-    private transient HashMap<BeehiveWsMethodMetadata, Call> _callCache;
+    private transient HashMap<String, ScCall> _callCache;
 
     private Element[] _handlerOutputHeaders;
     private HandlerInfo _handlerInfo;
@@ -102,19 +74,25 @@
     /**
      * Constructor.
      */
-    public ServiceControlImpl() { }
+    public ServiceControlImpl() {
+    }
 
     /**
      * Invoked by the controls runtime when a new instance of this class is aquired by the runtime.
      */
     @EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onAcquire")
-    public void onAquire()
-    {
+    public void onAquire() {
+
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("Enter: onAquire()");
         }
 
         if (_service == null) {
+
+            ServiceControl.ServiceFactoryProvider sfp =
+                    _context.getControlPropertySet(ServiceControl.ServiceFactoryProvider.class);
+            _serviceFactoryClassName = sfp.value().getServiceFactoryClassName();
+
             initialize();
         }
     }
@@ -123,8 +101,8 @@
      * Invoked by the controls runtime when an instance of this class is released by the runtime.
      */
     @EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease")
-    public void onRelease()
-    {
+    public void onRelease() {
+
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("Enter: onRelease()");
         }
@@ -143,8 +121,7 @@
      *                   thrown.  If a checked exception is thrown from the implementation that is not declared
      *                   on the original interface, it will be wrapped in a ControlException.
      */
-    public Object invoke(Method method, Object[] args) throws Throwable
-    {
+    public Object invoke(Method method, Object[] args) throws Throwable {
 
         LOGGER.debug("invoke method: " + method.getName());
 
@@ -153,34 +130,21 @@
         handlerConfig.put(HeaderHandler.INPUT_ELEMENTS_KEY, null);
         _handlerInfo.setHandlerConfig(handlerConfig);
 
-        String operationName = method.getName();
-        String alternateOperationName = getAlternateOperationName(method);
-        if(alternateOperationName != null) {
-            operationName = alternateOperationName;
-        }
+        ServiceControl.OperationName opName = _context.getMethodPropertySet(method, ServiceControl.OperationName.class);
+        WsdlOperation op = _wsdl.getOperation(opName.value());
 
-        BeehiveWsMethodMetadata wmm = findMethodInOM(method, operationName);
-        Call call;
-        if (getCallCache().containsKey(wmm)) {
-            call = getCallCache().get(wmm);
+        ScCall call;
+        if (getCallCache().containsKey(opName.value())) {
+            call = getCallCache().get(opName.value());
         } else {
-            call = buildCallObject(method, wmm);
-            getCallCache().put(wmm, call);
+            call = buildCallObject(method, op);
+            getCallCache().put(opName.value(), call);
         }
 
-        initCallObject(call);
-
-        Object[] callArgs = prepareArgsForSend(method, wmm, args);
+        call.setUserDefinedProperties(getWsdlPort(), getEndPoint().toExternalForm(),
+                getUsername(), getPassword());
 
-        Object res;
-        try {
-            res = call.invoke(callArgs);
-        } catch(RemoteException e) {
-            throw new ControlException(e.getMessage(), e);
-        }
-
-        fillHolders(method, wmm, call, args);
-        return res;
+        return call.invoke(args);
     }
 
     /**
@@ -253,6 +217,7 @@
      * @param wsdlPort The wsdlPort to set.
      */
     public void setWsdlPort(QName wsdlPort) {
+        _wsdl.setPort(wsdlPort);
         this._wsdlPort = wsdlPort;
     }
 
@@ -270,17 +235,16 @@
     /**
      * Contains the list of headers recived from the web service, processed by HeaderHandler.
      */
-    public Element[] getInputHeaders()
-    {
-        return (Element[])_handlerInfo.getHandlerConfig().get(HeaderHandler.INPUT_ELEMENTS_KEY);
+    public Element[] getInputHeaders() {
+        return (Element[]) _handlerInfo.getHandlerConfig().get(HeaderHandler.INPUT_ELEMENTS_KEY);
     }
 
     /**
      * Set the list of output headers to add to the call's request to the webservice.
+     *
      * @param headers
      */
-    public void setOutputHeaders(Element[] headers)
-    {
+    public void setOutputHeaders(Element[] headers) {
         _handlerOutputHeaders = headers;
     }
 
@@ -289,431 +253,36 @@
     /* --------------------------------------------------------------------------------------- */
 
     /**
-     * Create a new copy of the args where holders value have been extracted.
-     * Ignore the out values.
-     *
-     * @param method Method being processed.
-     * @param wmm beehive ws object model.
-     * @param args call arguments.
-     * @return An argument list with all OUT mode parameters removed.
-     */
-    private Object[] prepareArgsForSend(Method method,
-                                        BeehiveWsMethodMetadata wmm,
-                                        Object[] args) {
-
-        ArrayList argsList = new ArrayList();
-        Class[] methodParameterTypes = method.getParameterTypes();
-        Iterator<BeehiveWsParameterMetadata> it = wmm.getParams().iterator();
-
-        // size of the param list must be the size of the args array
-        for(int i = 0; i < methodParameterTypes.length; i++) {
-            Class javaTypeFromClass = methodParameterTypes[i];
-            BeehiveWsParameterMetadata nxtParamMetaData = it.next();
-            if(nxtParamMetaData.getWpMode() == WebParam.Mode.OUT)
-                continue; // don't send OUT parameters.
-
-            if((nxtParamMetaData.getWpMode() == WebParam.Mode.INOUT)
-                && Holder.class.isAssignableFrom(javaTypeFromClass)) {
-                try {
-                    Holder holder = (Holder)args[i];
-                    Field valueField = holder.getClass().getField("value");
-                    argsList.add(valueField.get(holder));
-                }
-                catch(Exception e) {
-                    throw new ControlException(
-                        "failed in getting holder value for: "
-                            + nxtParamMetaData.getWpName());
-                }
-
-            }
-            else {
-                argsList.add(args[i]);
-            }
-        }
-
-        return argsList.toArray(new Object[argsList.size()]);
-    }
-
-    /**
-     *  Fill the hodlers in the argument array with the result of the call.
-     * @param method Method being processed.
-     * @param wmm beehive object model
-     * @param call Call
-     * @param args call arguments.
-     */
-    private void fillHolders(Method method, BeehiveWsMethodMetadata wmm,
-                             Call call, Object[] args)
-    {
-        Map outParam = call.getOutputParams();
-
-        if(outParam.isEmpty())
-            return;
-
-        for(Object nxtOutParamKey : outParam.keySet()) {
-            LOGGER.info("Got outparam: " + nxtOutParamKey + " value: "
-                + outParam.get(nxtOutParamKey)
-                + " Stuff this into the holders");
-        }
-
-        Class[] methodParameterTypes = method.getParameterTypes();
-        Iterator<BeehiveWsParameterMetadata> it = wmm.getParams().iterator();
-        // size of the param list must be the size of the args array
-        for(int i = 0; i < methodParameterTypes.length; i++) {
-            Class javaTypeFromClass = methodParameterTypes[i];
-            BeehiveWsParameterMetadata nxtParamMetaData = it.next();
-
-            if((nxtParamMetaData.getWpMode() == WebParam.Mode.INOUT || nxtParamMetaData
-                .getWpMode() == WebParam.Mode.OUT)
-                && Holder.class.isAssignableFrom(javaTypeFromClass)) {
-
-                try {
-                    LOGGER.info("Fill the holder object: " + nxtParamMetaData.getWpName());
-                    Holder holder = (Holder)args[i];
-                    Object value = null;
-
-                    // find the value, only check for
-                    // localpart of the name, as the namespace may not be filled
-                    boolean hasReturnValue = false;
-                    for(Object nxtOutParamKey : outParam.keySet()) {
-                        if(((QName)nxtOutParamKey).getLocalPart().equals(nxtParamMetaData.getWpName())) {
-                            value = outParam.get(nxtOutParamKey);
-                            hasReturnValue = true;
-                            break;
-                        }
-                    }
-
-                    if(hasReturnValue)
-                        stuffHolderValue(holder, value);
-
-                }
-                catch(Exception e) {
-                    throw new ControlException("Failed in getting holder value for: " + nxtParamMetaData.getWpName());
-                }
-            }
-        }
-    }
-
-    /**
-     * Stuff a value into a holder.
-     * @param holder Holder to recive the value.
-     * @param value The value.
-     * @throws NoSuchFieldException
-     * @throws IllegalAccessException
-     */
-    private void stuffHolderValue(Holder holder, Object value)
-        throws NoSuchFieldException, IllegalAccessException {
-        HolderUtils.stuffHolderValue(holder, value);
-    }
-
-    private void initCallObject(Call call) {
-
-        call.setPortTypeName(getWsdlPort());
-
-        if(getUsername() != null) {
-            call.setProperty(Call.USERNAME_PROPERTY, getUsername());
-        } else {
-            call.removeProperty(Call.USERNAME_PROPERTY);
-        }
-
-        if(getPassword() != null) {
-            call.setProperty(Call.PASSWORD_PROPERTY, getPassword());
-        } else {
-            call.removeProperty(Call.PASSWORD_PROPERTY);
-        }
-
-        LOGGER.debug("endpoint: " + getEndPoint().toExternalForm());
-        call.setTargetEndpointAddress(getEndPoint().toExternalForm());
-    }
-
-    /**
      * Build a call object for the specified web method.
+     *
      * @param method
-     * @param wmm
+     * @param op
      * @return Call
      */
-    private Call buildCallObject(Method method, BeehiveWsMethodMetadata wmm) {
+    private ScCall buildCallObject(Method method, WsdlOperation op) {
 
-        Call call;
 
-        try {
-            call = getService(_serviceName).createCall();
-        } catch(ServiceException se) {
-            throw new ControlException(se.getMessage(), se);
-        }
-
-        call.setOperationName(new QName(_beehiveTypeMetadata.getTargetNamespace(), wmm.getWmOperationName()));
+        ServiceControl.ServiceFactoryProviderType sfpt =
+                _context.getControlPropertySet(ServiceControl.ServiceFactoryProvider.class).value();
 
-        SOAPBinding.Style omStyle = _beehiveTypeMetadata.getSoapBinding().getStyle();
-        final String style;
-        if(omStyle == SOAPBinding.Style.DOCUMENT) {
-            if(_beehiveTypeMetadata.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED) {
-                style = "wrapped";
-            } else {
-                style = "document";
-            }
-        } else if(omStyle == SOAPBinding.Style.RPC) {
-            style = "rpc";
-        } else {
-            throw new ControlException("Invalid Binding style: " + omStyle);
-        }
-
-        LOGGER.debug("Call style: " + style);
-        call.setProperty(Call.OPERATION_STYLE_PROPERTY, style);
-
-        if("rpc".equals(style) && SOAPBinding.Use.LITERAL == _beehiveTypeMetadata.getSoapBinding().getUse()) {
-            ((org.apache.axis.client.Call)call).setOperationUse(Use.LITERAL);
-        }
-
-        // walk the argument meta data list, register type of parameters, add
-        // parameters to the call object
-        List<BeehiveWsParameterMetadata> omArgMetaDataList = new ArrayList<BeehiveWsParameterMetadata>();
-        omArgMetaDataList.addAll(wmm.getParams());
-
-        Class[] methodParameterTypes = method.getParameterTypes();
-        Type[] genericMethodParamTypes = method.getGenericParameterTypes();
-
-        if(omArgMetaDataList.size() != methodParameterTypes.length) {
-            throw new ControlException("Object model and method definition don't match!");
-        }
-
-        for(int i = 0; i < methodParameterTypes.length; i++) {
-
-            BeehiveWsParameterMetadata nxtArgMetaData = omArgMetaDataList.get(i);
-            Class javaTypeFromClass = methodParameterTypes[i];
-
-            // make sure the type is registered
-            ParameterMode mode;
-            WebParam.Mode omMode = nxtArgMetaData.getWpMode();
-            if(omMode == WebParam.Mode.IN) {
-                mode = ParameterMode.IN;
-            }
-            else if(omMode == WebParam.Mode.OUT) {
-                mode = ParameterMode.OUT;
-            }
-            else if(omMode == WebParam.Mode.INOUT) {
-                if(!Holder.class.isAssignableFrom(javaTypeFromClass)) {
-                    throw new ControlException("Holder classes are required for the in/out parameters.");
-                }
-                mode = ParameterMode.INOUT;
-            }
-            else {
-                throw new ControlException("Invalid parameter mode: " + omMode);
-            }
-
-            // if mode is in or in/out and the type is holder then holder, get
-            // its value type
-            QName registeredTypeQName;
-
-            if((mode == ParameterMode.OUT || mode == ParameterMode.INOUT)
-                && Holder.class.isAssignableFrom(javaTypeFromClass)) {
-                javaTypeFromClass = TypeRegistrar.getHoldersValueClass(genericMethodParamTypes[i]);
-            }
-
-            registeredTypeQName =
-                getRegistrar().registerType(javaTypeFromClass,
-                                       nxtArgMetaData.getXmlType(),
-                                       _beehiveTypeMetadata.getSoapBinding().getStyle(),
-                                       _beehiveTypeMetadata.getSoapBinding().getUse());
-
-            final QName headerParamQName;
-            Boolean isElementFormQualified = _elementFormQualifiedMap.get(nxtArgMetaData.getWpTargetNamespace());
-            if (isElementFormQualified == null || !isElementFormQualified) {
-                headerParamQName = new QName(nxtArgMetaData.getWpName());
-            } else {
-                headerParamQName = new QName(nxtArgMetaData.getWpTargetNamespace(), nxtArgMetaData.getWpName());
-            }
-
-            if(nxtArgMetaData.isWpHeader()) {
-                // TODO: addParameterAsHeader is Axis specific, later abstract out Axis from this implementation
-                LOGGER.debug("Argument: " + nxtArgMetaData.getWpName()
-                    + " in method: " + method.getName()
-                    + " is send as soap header");
-
-                ((org.apache.axis.client.Call)call).addParameterAsHeader(headerParamQName, registeredTypeQName,
-                                                                         javaTypeFromClass, mode, mode);
-            }
-            else {
-                LOGGER.debug("Argument: " + nxtArgMetaData.getWpName()
-                    + " in method: " + method.getName()
-                    + " is send in the soap body");
-                  ((org.apache.axis.client.Call)call).addParameter(headerParamQName, registeredTypeQName,
-                                                                   javaTypeFromClass, mode);
-            }
-        }
-
-        // register the return type
-        final Class javaTypeFromClass = method.getReturnType();
-        if(!wmm.isOneWay() && javaTypeFromClass != void.class) {
-            QName resultsRegisteredTypeQName = getRegistrar().registerType(
-                javaTypeFromClass,
-                wmm.getXmlReturnType(),
-                _beehiveTypeMetadata.getSoapBinding().getStyle(),
-                _beehiveTypeMetadata.getSoapBinding().getUse());
-
-            call.setReturnType(resultsRegisteredTypeQName, javaTypeFromClass);
-        } else {
-            call.setReturnType(getRegistrar().getVoidType());
-        }
-
-        // AXIS dependecy... this is needed for the Handlers
-        call.setProperty(org.apache.axis.client.Call.WSDL_PORT_NAME, _portType);
+        ScCall call = ScCallFactory.getCall(getService(_serviceName), sfpt);
+        call.configure(op, method, _portType);
         return call;
     }
 
     /**
-     * Find the method which we are processing in the ws object model.
-     * @param method Method being processed.
-     * @param operationName Name of operation.
-     * @return BeehiveWsMethodMetadata
-     */
-    private BeehiveWsMethodMetadata findMethodInOM(Method method, String operationName) {
-
-        // the obejct model doesn't store holders, rather the underlying
-        // types, so to get the method
-        // we need to get the underlying types. After the loop above the
-        // paramTypes have the underlying types
-        // for any holders in the arg list.
-
-        Type[] genericParamTypes = method.getGenericParameterTypes();
-        Class[] paramTypes = method.getParameterTypes();
-        String[] paramTypeNames = new String[paramTypes.length];
-        for(int i = 0; i < paramTypes.length; i++) {
-            if(Holder.class.isAssignableFrom(paramTypes[i])) {
-                paramTypeNames[i] = TypeRegistrar.getHoldersValueClass(genericParamTypes[i]).getCanonicalName();
-            }
-            else paramTypeNames[i] = paramTypes[i].getCanonicalName();
-        }
-
-        BeehiveWsMethodMetadata wmm = _beehiveTypeMetadata.getMethod(operationName, paramTypeNames);
-        if(wmm == null) {
-            StringBuffer sb = new StringBuffer("No Jsr181MethodMetadata found for " + operationName + '(');
-            boolean first = true;
-            for(Class cls : paramTypes) {
-                if(first) {
-                    first = false;
-                }
-                else {
-                    sb.append(',');
-                }
-                sb.append(cls.getName());
-            }
-            sb.append(')');
-            throw new ControlException("", new NoSuchMethodException(sb.toString()));
-
-        }
-        return wmm;
-    }
-
-    /**
      * Initialize the service control. Invoked during onAquire() event.
      */
     private void initialize() {
 
-        BindingLookupService lookupService = new SystemTypeLookupService();
-        XmlBeanWSDLProcessor wsdlProcessor = new XmlBeanWSDLProcessor(parseWSDL(), lookupService);
-        _serviceName = wsdlProcessor.getServiceName();
-
-        try {
-            _beehiveTypeMetadata = wsdlProcessor.getObjectModel();
-            _elementFormQualifiedMap = wsdlProcessor.genElementFormQualifiedMap();
-        } catch(Exception e) {
-            throw new ControlException(e.getMessage(), e);
-        }
+        ServiceControl.WSDL wsdl = _context.getControlPropertySet(ServiceControl.WSDL.class);
+        _serviceName = new QName(wsdl.serviceTns(), wsdl.service());
+        ControlWsdlLocator locator = new ControlWsdlLocator(wsdl.path(), _context);
+        _wsdl = new Wsdl(locator, _serviceName, wsdl.portName());
 
         _handlerInfo = new HandlerInfo();
         _handlerInfo.setHandlerClass(HeaderHandler.class);
-        _portType = new QName(_beehiveTypeMetadata.getTargetNamespace(), _beehiveTypeMetadata.getName());
-
-        configureEndPoint();
-    }
-
-    /**
-     * Get the alternate operation name (if OperationName annoation has been set).
-     * @param method Service control method we are processing.
-     * @return Alternate operation name, null if not defined.
-     */
-    private String getAlternateOperationName(Method method)
-    {
-        ServiceControl.OperationName opName = _context.getMethodPropertySet(method, ServiceControl.OperationName.class);
-        if(opName != null) {
-            return opName.value();
-        }
-
-        return null;
-    }
-
-    /**
-     * Load the serialized object model from disk.
-     * @return DefinitionsDocument
-     */
-    private DefinitionsDocument parseWSDL()
-    {
-        File f = null;
-        URL url = null;
-        InputStream wsdlStream = null;
-
-        try {
-
-            ServiceControl.WSDL wsdl = _context.getControlPropertySet(ServiceControl.WSDL.class);
-
-            assert(wsdl != null) : "The control is mising the required @WSDL annotations";
-            assert(wsdl.path() != null) : "The control is missing the required path attribute for the @WSDL annotations";
-
-            if(wsdl == null) {
-                throw new ControlException("No WSDL annotation found.");
-            }
-
-            LOGGER.debug("read wsdl from: " + wsdl.path());
-
-            if(wsdl.path().startsWith("http://") || wsdl.path().startsWith("file:/")) {
-                url = new URL(wsdl.path());
-                wsdlStream = url.openStream();
-
-            } else {
-
-                // it is a local file name
-                wsdlStream = _context.getBeanContext().getResourceAsStream(wsdl.path(), null);
-
-                if(wsdlStream == null) {
-                    LOGGER.info("Failed to load the wsdl from context, will try classloader!");
-                    wsdlStream = this.getClass().getClassLoader().getResourceAsStream(wsdl.path());
-
-                    //todo: why does this try to load from a hard file path? this value is generally unstable in a running server
-                    if(null == wsdlStream) {
-                        f = new File(wsdl.path());
-                        wsdlStream = new FileInputStream(f);
-                    }
-                }
-            }
-            return Utilities.parseWSDL(wsdlStream);
-        }
-        catch(MalformedURLException e) {
-            LOGGER.error("ERROR: WSDL is not found, invalid URL  " + url);
-            throw new ControlException("ERROR: WSDL is not found, invalid URL  " + url, e);
-        }
-        catch(FileNotFoundException e) {
-            String fpath = null;
-            try {
-                fpath = f.getCanonicalPath();
-            }
-            catch(IOException ioe) {
-                // noop
-            }
-            LOGGER.error("ERROR: WSDL File not found: " + fpath);
-            throw new ControlException("ERROR: WSDL File not found: " + fpath, e);
-        }
-        catch(IOException e) {
-            LOGGER.error("ERROR: IO Exception in reading WSDL File");
-            throw new ControlException("ERROR: IO Exception in reading WSDL File.", e);
-        }
-        catch(XmlException e) {
-            throw new ControlException(e.getMessage(), e);
-        }
-        finally {
-            if(wsdlStream != null) {
-                try { wsdlStream.close(); } catch(IOException ioe) { /* noop */ }
-            }
-        }
+        _portType = _wsdl.getPortTypeQName();
     }
 
     /**
@@ -721,22 +290,21 @@
      * use that endpoint.  If an endpoint has not been set get the endpoint from the ServiceControl.Location
      * annotation.
      */
-    private void configureEndPoint()
-    {
-        if(_endPoint == null) {
-            ServiceControl.Location location = _context.getControlPropertySet(ServiceControl.Location.class);
+    private void configureEndPoint() {
 
-            if(location != null) {
+        if (_endPoint == null) {
+            ServiceControl.Location location = _context.getControlPropertySet(ServiceControl.Location.class);
+            if (location != null) {
                 assert location.urls() != null;
                 assert location.urls().length > 0;
-
                 try {
                     setEndPoint(new URL(location.urls()[0]));
-                } catch(MalformedURLException e) {
+                }
+                catch (MalformedURLException e) {
                     throw new ControlException(e.getMessage(), e);
                 }
-
-            } else {
+            }
+            else {
                 throw new ControlException("No Location annotation found.");
             }
         }
@@ -747,9 +315,9 @@
      * if a serialization has occured.
      * @return HashMap
      */
-    private HashMap<BeehiveWsMethodMetadata, Call> getCallCache() {
+    private HashMap<String, ScCall> getCallCache() {
         if (_callCache == null) {
-            _callCache = new HashMap<BeehiveWsMethodMetadata, Call>();
+            _callCache = new HashMap<String, ScCall>();
         }
         return _callCache;
     }
@@ -765,27 +333,24 @@
 
         if (_service == null) {
             try {
-                _service = ServiceFactory.newInstance().createService(serviceName);
-            } catch (ServiceException e) {
+                Class factory = Class.forName(_serviceFactoryClassName);
+                ServiceFactory sf = (ServiceFactory) factory.newInstance();
+                _service = sf.createService(serviceName);
+            }
+            catch (ClassNotFoundException e) {
+                throw new ControlException("Can not find ServiceFactory class: " + _serviceFactoryClassName);
+            }
+            catch (IllegalAccessException e) {
+                throw new ControlException("Can not create instance of ServiceFactory class: " + _serviceFactoryClassName);
+            }
+            catch (InstantiationException e) {
+                throw new ControlException("Can not create instance of ServiceFactory class: " + _serviceFactoryClassName);
+            }
+            catch (ServiceException e) {
                 throw new ControlException(e.getMessage(), e);
             }
             _service.getHandlerRegistry().getHandlerChain(_portType).add(_handlerInfo);
         }
         return _service;
-    }
-
-    /**
-     * Get a TypeRegistrar, TypeRegistrar is transient so may need to create a new one
-     * if a serialization has occured.
-     * @return TypeRegistrar
-     */
-    private TypeRegistrar getRegistrar() {
-
-        if (_registrar == null) {
-            BindingLookupService lookupService = new SystemTypeLookupService();
-            TypeMapping tm = getService(_serviceName).getTypeMappingRegistry().getDefaultTypeMapping();
-            _registrar = new AxisTypeRegistrar(tm, lookupService);
-        }
-        return _registrar;
     }
 }