aslom       2004/08/06 23:20:49

  Modified:    java/src/org/apache/wsif/base WSIFServiceImpl.java
  Log:
  more diagnostic info in exception
  
  Revision  Changes    Path
  1.42      +229 -214  ws-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java
  
  Index: WSIFServiceImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- WSIFServiceImpl.java      1 Mar 2004 23:53:14 -0000       1.41
  +++ WSIFServiceImpl.java      7 Aug 2004 06:20:49 -0000       1.42
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2003,2004 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.
  @@ -93,7 +93,7 @@
       private Map typeReg = null;
       private Port chosenPort = null;
       private WSIFMessage context;
  -
  +    
       protected ArrayList schemaTypes = new ArrayList();
       protected WSIFMappingConvention mapCon = null;
       protected WSIFMapper mapper = null;
  @@ -103,9 +103,9 @@
       private boolean schemaTypesInitialised = false;
       // WSDLLocator needed to find imported xsd files if parsing the schema
       private WSDLLocator specialistLocator = null;
  -
  +    
       protected Map features = null;
  -
  +    
       /**
        * Create a WSIF service instance from WSDL document URL.
        * <br> If serviceName or serviceNS is null,
  @@ -114,7 +114,7 @@
        *   then WSDL document must have exactly one portType in it
        *   and all ports of the selected service must
        *    implement the same portType.
  -     * <br>NOTE: 
  +     * <br>NOTE:
        * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
        * should be used to create a WSIFService.
        */
  @@ -133,9 +133,9 @@
               serviceName,
               portTypeNS,
               portTypeName);
  -
  +        
           this.features = factoryFeatures;
  -
  +        
           // load WSDL defintion
           Definition def = null;
           try {
  @@ -143,7 +143,7 @@
               PasswordAuthentication pa = getProxyAuthentication();
               if (pa != null) {
                   def = WSIFUtils.readWSDLThroughAuthProxy(wsdlLoc, pa);
  -
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator =
  @@ -157,32 +157,32 @@
               Trc.exception(ex);
               throw new WSIFException("could not load " + wsdlLoc, ex);
           }
  -
  +        
           // select WSDL service if given name
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
  -
  +        
           // select WSDL portType if given name
           PortType portType =
               WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
  -
  +        
           init(def, service, portType);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
  -      * Create a WSIF service instance from WSDL document URL
  -      * using a ClassLoader to find local resources.
  -      * <br> If serviceName or serviceNS is null,
  -      *   then WSDL document must have exactly one service in it.
  -      * <br> If portTypeName or portTypeNS is null,
  -      *   then WSDL document must have exactly one portType in it
  -      *   and all ports of the selected service must
  -      *    implement the same portType.
  -      * <br>NOTE: 
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance from WSDL document URL
  +     * using a ClassLoader to find local resources.
  +     * <br> If serviceName or serviceNS is null,
  +     *   then WSDL document must have exactly one service in it.
  +     * <br> If portTypeName or portTypeNS is null,
  +     *   then WSDL document must have exactly one portType in it
  +     *   and all ports of the selected service must
  +     *    implement the same portType.
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(
           String wsdlLoc,
           ClassLoader cl,
  @@ -200,9 +200,9 @@
               serviceName,
               portTypeNS,
               portTypeName);
  -
  +        
           this.features = factoryFeatures;
  -
  +        
           // load WSDL defintion
           Definition def = null;
           try {
  @@ -210,7 +210,7 @@
               PasswordAuthentication pa = getProxyAuthentication();
               if (pa != null) {
                   def = WSIFUtils.readWSDLThroughAuthProxy(wsdlLoc, pa);
  -
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator =
  @@ -218,7 +218,7 @@
               }
               if (def == null) {
                   def = WSIFUtils.readWSDL(null, wsdlLoc, cl);
  -
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  @@ -228,46 +228,46 @@
               Trc.exception(ex);
               throw new WSIFException("could not load " + wsdlLoc, ex);
           }
  -
  +        
           // select WSDL service if given name
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
  -
  +        
           // select WSDL portType if given name
           PortType portType =
               WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
  -
  +        
           init(def, service, portType);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
  -      * Create a WSIF service instance
  -      * <br>NOTE:
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(Definition def, Map factoryFeatures) throws WSIFException {
           this(def, null, factoryFeatures);
       }
  -
  +    
       /**
  -      * Create a WSIF service instance
  -      * <br>NOTE: 
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(Definition def, Service service, Map factoryFeatures)
           throws WSIFException {
           this(def, service, null, factoryFeatures);
       }
  -
  +    
       /**
  -      * Create a WSIF service instance
  -      * <br>NOTE: 
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(
           Definition def,
           Service service,
  @@ -275,38 +275,38 @@
           Map factoryFeatures)
           throws WSIFException {
           Trc.entry(this, def, service, portType, factoryFeatures);
  -
  +        
           this.features = factoryFeatures;
           try {
               PasswordAuthentication pa = getProxyAuthentication();
               if (pa != null) {
                   def =
                       WSIFUtils.readWSDLThroughAuthProxy(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  -
  +                    def.getDocumentBaseURI(),
  +                    pa);
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator =
                       new AuthenticatingProxyWSDLLocatorImpl(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  +                    def.getDocumentBaseURI(),
  +                    pa);
               }
           } catch (WSDLException we) {
               Trc.ignoredException(we);
           }
  -
  +        
           init(def, service, portType);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
  -      * Create a WSIF service instance
  -      * <br>NOTE: 
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(
           Definition def,
           String serviceNS,
  @@ -314,40 +314,40 @@
           Map factoryFeatures)
           throws WSIFException {
           Trc.entry(this, def, serviceNS, serviceName, factoryFeatures);
  -
  +        
           this.features = factoryFeatures;
           try {
               PasswordAuthentication pa = getProxyAuthentication();
               if (pa != null) {
                   def =
                       WSIFUtils.readWSDLThroughAuthProxy(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  -
  +                    def.getDocumentBaseURI(),
  +                    pa);
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator =
                       new AuthenticatingProxyWSDLLocatorImpl(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  +                    def.getDocumentBaseURI(),
  +                    pa);
               }
           } catch (WSDLException we) {
               Trc.ignoredException(we);
           }
  -
  +        
           // select WSDL service if given by name or only one
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
           init(def, service, null);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
  -      * Create a WSIF service instance
  -      * <br>NOTE: 
  -      * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  -      * should be used to create a WSIFService.
  -      */
  +     * Create a WSIF service instance
  +     * <br>NOTE:
  +     * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
  +     * should be used to create a WSIFService.
  +     */
       WSIFServiceImpl(
           Definition def,
           String serviceNS,
  @@ -364,52 +364,52 @@
               portTypeNS,
               portTypeName,
               factoryFeatures);
  -
  +        
           this.features = factoryFeatures;
           try {
               PasswordAuthentication pa = getProxyAuthentication();
               if (pa != null) {
                   def =
                       WSIFUtils.readWSDLThroughAuthProxy(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  -
  +                    def.getDocumentBaseURI(),
  +                    pa);
  +                
                   // We'll need to use a non default WSDLLocator to help find imported
                   // xsd files if parsing the schema, so store it
                   specialistLocator =
                       new AuthenticatingProxyWSDLLocatorImpl(
  -                        def.getDocumentBaseURI(),
  -                        pa);
  +                    def.getDocumentBaseURI(),
  +                    pa);
               }
           } catch (WSDLException we) {
               Trc.ignoredException(we);
           }
  -
  +        
           checkWSDLForWSIF(def);
  -
  +        
           // select WSDL service if given by name or only one
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
  -
  +        
           // select WSDL portType if given by name or only one portType
           PortType portType =
               WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
  -
  +        
           init(def, service, portType);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
  -      * Create a WSIF service instance from another instance. This constructor
  -      * is used by the caching mechanism in WSIFServiceFactoryImpl
  -      */
  +     * Create a WSIF service instance from another instance. This constructor
  +     * is used by the caching mechanism in WSIFServiceFactoryImpl
  +     */
       WSIFServiceImpl(WSIFServiceImpl wsi) throws WSIFException {
           Trc.entry(this, wsi);
           copyInitializedService(wsi);
           if (Trc.ON)
               Trc.exit(deep());
       }
  -
  +    
       /**
        * Copy the "read-only" parts of an initialized WSIFServiceImpl
        */
  @@ -432,14 +432,14 @@
               this.features = svc.features;
           }
       }
  -
  +    
       /**
        * Set the preferred port
        * @param portName The name of the port to use
        */
       public void setPreferredPort(String portName) throws WSIFException {
           Trc.entry(this, portName);
  -
  +        
           if (portName == null) {
               throw new WSIFException("Preferred port name cannot be null");
           }
  @@ -455,7 +455,7 @@
           }
           Trc.exit();
       }
  -
  +    
       /**
        * Create a PortType object from the name of a port
        * @param portName The name of the port
  @@ -485,7 +485,7 @@
           checkPortTypeInformation(def, pt);
           return pt;
       }
  -
  +    
       /**
        * Get the names of the available ports
        * @return Iterator for list of available port names.
  @@ -499,7 +499,7 @@
           Trc.exit(it);
           return it;
       }
  -
  +    
       /**
        * Create dynamic port instance from WSDL model defnition and port.
        */
  @@ -525,12 +525,12 @@
           wsifPort.setContext(getContext());
           return wsifPort;
       }
  -
  +    
       public WSIFPort getPort() throws WSIFException {
           Trc.entry(this);
           WSIFPort wp = null;
           if (preferredPort != null
  -            && availablePorts.get(preferredPort) != null) {
  +                && availablePorts.get(preferredPort) != null) {
               wp = getPort(this.preferredPort);
           } else {
               if (preferredPort != null)
  @@ -540,14 +540,14 @@
           Trc.exit(wp);
           return wp;
       }
  -
  +    
       /**
        * Return dynamic port instance selected by port name.
        */
       public WSIFPort getPort(String portName) throws WSIFException {
           Trc.entry(this, portName);
           Port port = null;
  -
  +        
           if (portName == null) {
               // Get first available port
               if (availablePorts.size() > 0) {
  @@ -558,12 +558,27 @@
               }
           } else {
               port = (Port) availablePorts.get(portName);
  +            // produce list of available port types (better exception message)
  +            String listOfPortNames = "{empty list}";
  +            {
  +                StringBuffer sbuf = new StringBuffer();
  +                for(Iterator i = availablePorts.keySet().iterator() ; i.hasNext();) 
{
  +                    String portNameCand = (String) i.next();
  +                    if(sbuf.length() > 0) {
  +                        sbuf.append(",");
  +                    }
  +                    sbuf.append(portNameCand);
  +                }
  +                if(sbuf.length() > 0) {
  +                    listOfPortNames = "{" + sbuf.toString() + "}";
  +                }
  +            }
               if (port == null) {
                   throw new WSIFException(
                       "Port '"
                           + portName
                           + "' is not available and "
  -                        + " no alternative can be found");
  +                        + "no alternative can be found in "+listOfPortNames);
               }
           }
           
  @@ -579,17 +594,17 @@
           }
           // Store the chosen port so that we can query which was is being used
           chosenPort = port;
  -
  +        
           Trc.exit(portInstance);
           return portInstance;
       }
  -
  +    
       /**
        * Add an association between XML and Java type.
        * @param xmlType The qualified xml name
        * @param javaType The Java class
        * @param force flag to indicate if mapping should override an existing one
  -     * for the same xmlType 
  +     * for the same xmlType
        */
       private void mapType(QName xmlType, Class javaType, boolean force)
           throws WSIFException {
  @@ -597,11 +612,11 @@
           typeMap.mapType(xmlType, javaType, force);
           Trc.exit();
       }
  -
  +    
       /**
        * Add association between XML and Java type.
        * @param xmlType The qualified xml name
  -     * @param javaType The Java class 
  +     * @param javaType The Java class
        */
       public void mapType(QName xmlType, Class javaType) throws WSIFException {
           Trc.entry(this, xmlType, javaType);
  @@ -609,12 +624,12 @@
               mapper.overrideTypeMapping(xmlType, javaType.getName());
           }
           if (!schemaTypesInitialised) {
  -            // Map it directly now!          
  +            // Map it directly now!
               typeMap.mapType(xmlType, javaType, true);
           }
           Trc.exit();
       }
  -
  +    
       /**
        * Add association between XML and Java type.
        * @param xmlType The qualified xml name
  @@ -631,9 +646,9 @@
               try {
                   clazz =
                       Class.forName(
  -                        className,
  -                        true,
  -                        Thread.currentThread().getContextClassLoader());
  +                    className,
  +                    true,
  +                    Thread.currentThread().getContextClassLoader());
               } catch (ClassNotFoundException e) {
                   // Ignore error - mapping will not be added
                   Trc.ignoredException(e);
  @@ -644,10 +659,10 @@
           }
           Trc.exit();
       }
  -
  +    
       /**
        * Add an association between a namespace URI and and a Java package. Calling
  -     * this method will trigger the automatic mapping of types, regardless of what 
  +     * this method will trigger the automatic mapping of types, regardless of what
        * was set at the WSIFServiceFactory level, since all the types in the schema(s)
        * need to be examined in order to use the information provided.
        * @param namespace The namespace URI
  @@ -659,13 +674,13 @@
           // In order to use package mapping information, we need a list
           // of types to apply the mapping to, so let's make sure we have one!
           populateSchemaTypes(specialistLocator);
  -
  +        
           if (mapCon != null) {
               mapCon.overridePackageMapping(namespace, packageName);
           }
           Trc.exit();
       }
  -
  +    
       /**
        * @deprecated this method is replaced by the getProvider
        * method in the org.apache.util.WSIFPluggableProviders class
  @@ -676,7 +691,7 @@
           Trc.exit(p);
           return p;
       }
  -
  +    
       /**
        * @deprecated this method is replaced by the overrideDefaultProvider
        * method in the org.apache.util.WSIFPluggableProviders class
  @@ -685,14 +700,14 @@
           String providerNamespaceURI,
           WSIFProvider provider) {
           Trc.entry(null, providerNamespaceURI, provider);
  -
  +        
           WSIFPluggableProviders.overrideDefaultProvider(
               providerNamespaceURI,
               provider);
  -
  +        
           Trc.exit();
       }
  -
  +    
       /**
        * @deprecated this method is replaced by the setAutoLoadProviders
        * method in the org.apache.util.WSIFPluggableProviders class
  @@ -702,89 +717,89 @@
           WSIFPluggableProviders.setAutoLoadProviders(b);
           Trc.exit();
       }
  -
  +    
       /**
        * Get the dynamic proxy that will implement the interface iface
        * for the port portName.
        */
       public Object getStub(String portName, Class iface) throws WSIFException {
           Trc.entry(this, portName, iface);
  -
  +        
           // Stub support has always included automatically mapping
           // types, albeit badly! So we need to make sure that we
  -        // do it now, regardless of what flag is set on the WSIFServiceFactory      
         
  +        // do it now, regardless of what flag is set on the WSIFServiceFactory
           populateSchemaTypes(specialistLocator);
  -
  +        
           // if the port is not available, force the expection now rather
  -        // rather than go through the rest of this method            
  +        // rather than go through the rest of this method
           WSIFPort wsifPort = getPort(portName);
  -
  +        
           // If we've got to this line then the port must be available
           PortType pt = getPortTypeFromPortName(portName);
  -
  +        
           // If the user has already created a proxy for this interface before
           // but is now asking for a proxy for the same interface but a different
  -        // portName, we should cache the proxy here and just call 
  +        // portName, we should cache the proxy here and just call
           // clientProxy.setPort() instead.
           WSIFClientProxy clientProxy =
               WSIFClientProxy.newInstance(
  -                iface,
  -                def,
  -                service.getQName().getNamespaceURI(),
  -                service.getQName().getLocalPart(),
  -                portType.getQName().getNamespaceURI(),
  -                portType.getQName().getLocalPart(),
  -                typeMap);
  -
  +            iface,
  +            def,
  +            service.getQName().getNamespaceURI(),
  +            service.getQName().getLocalPart(),
  +            portType.getQName().getNamespaceURI(),
  +            portType.getQName().getLocalPart(),
  +            typeMap);
  +        
           clientProxy.setPort(wsifPort);
           Object proxy = clientProxy.getProxy();
  -
  +        
           // Tracing the proxy causes a hang!
           Trc.exit();
           return proxy;
       }
  -
  +    
       /**
        * Get the dynamic proxy that will implement the interface iface
        */
       public Object getStub(Class iface) throws WSIFException {
           Trc.entry(this, iface);
  -
  +        
           // Stub support has always included automatically mapping
           // types, albeit badly! So we need to make sure that we
           // do it now, regardless of what flag is set on the WSIFServiceFactory
           populateSchemaTypes(specialistLocator);
  -
  +        
           // if the port is not available, force the expection now rather
  -        // rather than go through the rest of this method            
  +        // rather than go through the rest of this method
           WSIFPort wsifPort = getPort();
  -
  +        
           // Chosen port has been stored so use it to find portType
           String portName = chosenPort.getName();
           PortType pt = getPortTypeFromPortName(portName);
  -
  +        
           // If the user has already created a proxy for this interface before
           // but is now asking for a proxy for the same interface but a different
  -        // portName, we should cache the proxy here and just call 
  +        // portName, we should cache the proxy here and just call
           // clientProxy.setPort() instead.
           WSIFClientProxy clientProxy =
               WSIFClientProxy.newInstance(
  -                iface,
  -                def,
  -                service.getQName().getNamespaceURI(),
  -                service.getQName().getLocalPart(),
  -                pt.getQName().getNamespaceURI(),
  -                pt.getQName().getLocalPart(),
  -                typeMap);
  -
  +            iface,
  +            def,
  +            service.getQName().getNamespaceURI(),
  +            service.getQName().getLocalPart(),
  +            pt.getQName().getNamespaceURI(),
  +            pt.getQName().getLocalPart(),
  +            typeMap);
  +        
           clientProxy.setPort(wsifPort);
           Object proxy = clientProxy.getProxy();
  -
  +        
           // Tracing the proxy causes a hang!
           Trc.exit();
           return proxy;
       }
  -
  +    
       /**
        * Add new WSDL model extension registry that is shared by all
        * dynamic WSIF providers.
  @@ -794,7 +809,7 @@
           providersExtRegs.addExtensionRegistry(reg);
           Trc.exit();
       }
  -
  +    
       /**
        * Return extension registry that contains ALL declared extensions.
        * This is special registry that does not allow to register serializers
  @@ -808,20 +823,20 @@
           Trc.exit(providersExtRegs);
           return providersExtRegs;
       }
  -
  +    
       private void init(Definition def, Service service, PortType portType)
           throws WSIFException {
           if (def == null)
               throw new IllegalArgumentException("WSDL definition can not be null");
           checkWSDLForWSIF(def);
  -
  +        
           if (service == null) {
               Map services = WSIFUtils.getAllItems(def, "Service");
  -
  +            
               service =
                   (Service) WSIFUtils.getNamedItem(services, null, "Service");
           }
  -
  +        
           if (portType == null) {
               // if all ports have the same portType --> use it
               Map ports = service.getPorts();
  @@ -830,7 +845,7 @@
                       "WSDL must contain at least one port in "
                           + service.getQName());
               }
  -
  +            
               for (Iterator i = ports.values().iterator(); i.hasNext();) {
                   Port port = (Port) i.next();
                   if (portType == null) {
  @@ -848,27 +863,27 @@
               if (portType == null) {
                   throw new IllegalArgumentException(
                       "WSDL more than one portType in service " + service);
  -
  +                
               }
           }
           this.def = def;
           this.service = service;
           this.portType = portType;
  -
  -        // checkPortTypeIsRPC(Definition def, PortType portType) has been replaced 
by 
  +        
  +        // checkPortTypeIsRPC(Definition def, PortType portType) has been replaced 
by
           // checkPortTypeInformation(Definition def, PortType portType) since "Input 
Only"
           // operations are supported.
           checkPortTypeInformation(def, portType);
  -
  +        
           // get all ports from service that has given portType
  -
  +        
           Map ports = service.getPorts();
           // check that service has at least one port ...
           if (ports.size() == 0) {
               throw new WSIFException(
                   "WSDL must contain at least one port in " + service.getQName());
           }
  -
  +        
           availablePorts = new Hashtable();
           for (Iterator i = ports.values().iterator(); i.hasNext();) {
               Port port = (Port) i.next();
  @@ -891,7 +906,7 @@
                           addressNS = bindingNS;
                       }
                       if (WSIFPluggableProviders
  -                        .isProviderAvailable(bindingNS, addressNS)) {
  +                            .isProviderAvailable(bindingNS, addressNS)) {
                           // check if port has the same port type
                           QName ptName = portType.getQName();
                           if (binding.getPortType().getQName().equals(ptName)) {
  @@ -902,7 +917,7 @@
                   }
               }
           }
  -
  +        
           // Set up the WSIFMapper and WSIFMappingConvention appropriately
           String mapperClass = null;
           String mappingConvClass = null;
  @@ -915,20 +930,20 @@
           try {
               mappingConvClass =
                   (String) features.get(
  -                    WSIFConstants.WSIF_FEATURE_MAPPINGCONVENTION_CLASS);
  +                WSIFConstants.WSIF_FEATURE_MAPPINGCONVENTION_CLASS);
           } catch (ClassCastException cce) {
               Trc.ignoredException(cce);
           }
  -
  +        
           overrideMapper(mapperClass);
           overrideMappingConvention(mappingConvClass);
  -
  +        
           // If automatic mapping of types is required, generate the list of 
SchemaType objects
           if (autoMapTypesOn()) {
               populateSchemaTypes(specialistLocator);
           }
       }
  -
  +    
       /**
        * Check PortType information is consistent. This method can be updated when
        * new operation types are supported.
  @@ -936,7 +951,7 @@
       private void checkPortTypeInformation(Definition def, PortType portType)
           throws WSIFException {
           List operationList = portType.getOperations();
  -
  +        
           // process each operation to create dynamic operation instance
           for (Iterator i = operationList.iterator(); i.hasNext();) {
               Operation op = (Operation) i.next();
  @@ -971,7 +986,7 @@
                       "WSIF.0004E",
                       opType,
                       portType.getQName().getLocalPart());
  -
  +                
                   // End message
                   throw new WSIFException(
                       "operation type "
  @@ -981,7 +996,7 @@
               }
           }
       }
  -
  +    
       private void checkWSDLForWSIF(Definition def) throws WSIFException {
           try {
               checkWSDL(def);
  @@ -992,7 +1007,7 @@
                   ex);
           }
       }
  -
  +    
       /**
        * Check WSDL defintion to make sure it does not contain undefined
        * elements (typical case is referncing not defined portType).
  @@ -1002,7 +1017,7 @@
        */
       private void checkWSDL(Definition def) throws WSDLException {
           for (Iterator i = def.getMessages().values().iterator();
  -            i.hasNext();
  +                 i.hasNext();
               ) {
               Message v = (Message) i.next();
               if (v.isUndefined()) {
  @@ -1012,7 +1027,7 @@
               }
           }
           for (Iterator i = def.getPortTypes().values().iterator();
  -            i.hasNext();
  +                 i.hasNext();
               ) {
               PortType v = (PortType) i.next();
               if (v.isUndefined()) {
  @@ -1022,7 +1037,7 @@
               }
           }
           for (Iterator i = def.getBindings().values().iterator();
  -            i.hasNext();
  +                 i.hasNext();
               ) {
               Binding v = (Binding) i.next();
               if (v.isUndefined()) {
  @@ -1032,17 +1047,17 @@
               }
           }
       }
  -
  +    
       /**
  -    * Get the Definition object representing the wsdl document
  -    * @return The Definition object
  -    */
  +     * Get the Definition object representing the wsdl document
  +     * @return The Definition object
  +     */
       public Definition getDefinition() {
           Trc.entry(this);
           Trc.exit(def);
           return def;
       }
  -
  +    
       /**
        * Gets the context information for this WSIFService.
        * @return context
  @@ -1064,7 +1079,7 @@
           Trc.exit(contextCopy);
           return contextCopy;
       }
  -
  +    
       /**
        * Sets the context information for this WSIFService.
        * @param WSIFMessage the new context information
  @@ -1077,7 +1092,7 @@
           this.context = context;
           Trc.exit();
       }
  -
  +    
       /**
        * Override the WSIFMapper used by this WSIFService
        * @param mapperClassName The class name for the WSIFMapper implementation to 
be used by this WSIFService
  @@ -1091,10 +1106,10 @@
               mapper = WSIFMapperFactory.newMapper();
           }
       }
  -
  +    
       /**
        * Override the WSIFMappingConvention used by this WSIFService
  -     * @param mappingConvClassName The class name for the WSIFMappingConvention 
implementation 
  +     * @param mappingConvClassName The class name for the WSIFMappingConvention 
implementation
        * to be used by this WSIFService
        * @throws A WSIFException if the WSIFMappingConvention cannot be found or set
        */
  @@ -1103,13 +1118,13 @@
           if (mappingConvClassName != null) {
               mapCon =
                   WSIFMappingConventionFactory.newMappingConvention(
  -                    mappingConvClassName);
  +                mappingConvClassName);
           } else {
               mapCon = WSIFMappingConventionFactory.newMappingConvention();
           }
           mapper.setMappingConvention(mapCon);
       }
  -
  +    
       /**
        * Parse the schema(s) associated with the wsdl and find all the types/elements 
that are defined.
        * @param loc A WSDLLocator to use in finding imported xsd files
  @@ -1117,7 +1132,7 @@
        */
       protected void populateSchemaTypes(WSDLLocator loc) throws WSIFException {
           // Get a lock on the list of type. Nobody else should be able to alter it
  -        // while we are working in this method.      
  +        // while we are working in this method.
           synchronized (schemaTypes) {
               // Don't parse the schema if we've already done it!!
               if (schemaTypesInitialised)
  @@ -1125,12 +1140,12 @@
               if (loc == null) {
                   loc =
                       new WSIFWSDLLocatorImpl(
  -                        (String) null,
  -                        (String) null,
  -                        (ClassLoader) null);
  +                                               (String) null,
  +                                               (String) null,
  +                                               (ClassLoader) null);
               }
               Parser.getAllSchemaTypes(def, schemaTypes, loc);
  -
  +            
               // if we can, close the WSDLLocator
               if (loc instanceof ClosableLocator) {
                   try {
  @@ -1140,19 +1155,19 @@
                       Trc.ignoredException(ioe);
                   }
               }
  -
  -            // Add a read-only version of the list of types to the context message 
  +            
  +            // Add a read-only version of the list of types to the context message
               // so that providers can use the information if needed
               WSIFMessage ctx = getContext();
               ctx.setObjectPart(
                   WSIFConstants.CONTEXT_SCHEMA_TYPES,
                   Collections.unmodifiableList(schemaTypes));
               setContext(ctx);
  -
  +            
               schemaTypesInitialised = true;
           }
       }
  -
  +    
       /**
        * Create and set all mappings from xml types to Java classes
        * @throws A WSIFException if the mapping process fails
  @@ -1166,8 +1181,8 @@
               // existing mappings could be added.
               if (typeMapInitialised)
                   return;
  -
  -            // Without a mapper we can't do any mapping!!            
  +            
  +            // Without a mapper we can't do any mapping!!
               if (mapper == null) {
                   Trc.event(
                       this,
  @@ -1176,8 +1191,8 @@
                   return;
               }
               SchemaType[] types = new SchemaType[schemaTypes.size()];
  -            schemaTypes.toArray(types);         
  -                       
  +            schemaTypes.toArray(types);
  +            
               Map mappings = mapper.getMappings(types);
               if (mappings != null) {
                   Iterator it = mappings.keySet().iterator();
  @@ -1189,16 +1204,16 @@
                           try {
                               clazz =
                                   Class.forName(
  -                                    clsName,
  -                                    true,
  -                                    Thread
  -                                        .currentThread()
  -                                        .getContextClassLoader());
  +                                clsName,
  +                                true,
  +                                Thread
  +                                    .currentThread()
  +                                    .getContextClassLoader());
                           } catch (ClassNotFoundException e) {
                               // Ignore error - mapping will not be added
                               Trc.ignoredException(e);
                           }
  -                        // Create a new mapping but don't override an existing 
  +                        // Create a new mapping but don't override an existing
                           // one for the same type
                           if (clazz != null) {
                               mapType(xmlType, clazz, false);
  @@ -1209,7 +1224,7 @@
               typeMapInitialised = true;
           }
       }
  -
  +    
       private boolean autoMapTypesOn() {
           if (features == null) {
               return false;
  @@ -1225,7 +1240,7 @@
               return false;
           }
       }
  -
  +    
       private PasswordAuthentication getProxyAuthentication() {
           if (features != null) {
               Object pa =
  @@ -1236,15 +1251,15 @@
           }
           return null;
       }
  -
  +    
       public String deep() {
           String buff = "";
           try {
               buff = new String(this.toString());
               buff += "\nprovidersExtRegs:"
                   + (providersExtRegs == null
  -                    ? "null"
  -                    : providersExtRegs.toString());
  +                       ? "null"
  +                       : providersExtRegs.toString());
               buff += "\ndef:" + Trc.brief(def);
               buff += "\nservice:"; + Trc.brief(service);
               buff += "\nportType:" + Trc.brief(portType);
  
  
  

Reply via email to