axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/i18n resource.properties
Date Thu, 16 Oct 2003 13:53:37 GMT
dims        2003/10/16 06:53:37

  Modified:    java/src/org/apache/axis/providers BasicProvider.java
               java/src/org/apache/axis Constants.java
               java/src/org/apache/axis/transport/http QSWSDLHandler.java
               java/src/org/apache/axis/i18n resource.properties
  Log:
  Fix for Bug 23844 - Duplicated and misplaced code in BasicProvider
  from bayer@oio.de (Thomas Bayer)
  
  Revision  Changes    Path
  1.16      +11 -138   ws-axis/java/src/org/apache/axis/providers/BasicProvider.java
  
  Index: BasicProvider.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/providers/BasicProvider.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BasicProvider.java	22 Apr 2003 19:35:32 -0000	1.15
  +++ BasicProvider.java	16 Oct 2003 13:53:36 -0000	1.16
  @@ -59,14 +59,10 @@
   import org.apache.axis.Constants;
   import org.apache.axis.MessageContext;
   import org.apache.axis.components.logger.LogFactory;
  -import org.apache.axis.description.ServiceDesc;
  -import org.apache.axis.encoding.TypeMapping;
   import org.apache.axis.handlers.BasicHandler;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.utils.Messages;
  -import org.apache.axis.wsdl.fromJava.Emitter;
   import org.apache.commons.logging.Log;
  -import org.w3c.dom.Document;
   
   import javax.xml.namespace.QName;
   import java.util.Hashtable;
  @@ -137,141 +133,18 @@
       /**
        * Generate the WSDL for this service.
        *
  -     * Put in the "WSDL" property of the message context
  -     * as a org.w3c.dom.Document
  +     * This method can be overwritten in a subclass with
  +     * code that put in the "WSDL" property of the message 
  +     * context as a org.w3c.dom.Document
        */
       public void generateWSDL(MessageContext msgContext) throws AxisFault {
  -        if (log.isDebugEnabled())
  -            log.debug("Enter: BSFProvider::generateWSDL (" + this + ")");
  -
  -        /* Find the service we're invoking so we can grab it's options */
  -        /***************************************************************/
  -        SOAPService service = msgContext.getService();
  -        ServiceDesc serviceDesc = service.getInitializedServiceDesc(msgContext);
  -
  -        // Calculate the appropriate namespaces for the WSDL we're going
  -        // to put out.
  -        //
  -        // If we've been explicitly told which namespaces to use, respect
  -        // that.  If not:
  -        //
  -        // The "interface namespace" should be either:
  -        // 1) The namespace of the ServiceDesc
  -        // 2) The transport URL (if there's no ServiceDesc ns)
  -
  -        try {
  -            // Location URL is whatever is explicitly set in the MC
  -            String locationUrl =
  -                    msgContext.getStrProp(MessageContext.WSDLGEN_SERV_LOC_URL);
  -
  -            if (locationUrl == null) {
  -                // If nothing, try what's explicitly set in the ServiceDesc
  -                locationUrl = serviceDesc.getEndpointURL();
  -            }
  -
  -            if (locationUrl == null) {
  -                // If nothing, use the actual transport URL
  -                locationUrl = msgContext.getStrProp(MessageContext.TRANS_URL);
  -            }
  -
  -            // Interface namespace is whatever is explicitly set
  -            String interfaceNamespace =
  -                    msgContext.getStrProp(MessageContext.WSDLGEN_INTFNAMESPACE);
  -
  -            if (interfaceNamespace == null) {
  -                // If nothing, use the default namespace of the ServiceDesc
  -                interfaceNamespace = serviceDesc.getDefaultNamespace();
  -            }
  -
  -            if (interfaceNamespace == null) {
  -                // If nothing still, use the location URL determined above
  -                interfaceNamespace = locationUrl;
  -            }
  -
  -//  Do we want to do this?
  -//
  -//            if (locationUrl == null) {
  -//                locationUrl = url;
  -//            } else {
  -//                try {
  -//                    URL urlURL = new URL(url);
  -//                    URL locationURL = new URL(locationUrl);
  -//                    URL urlTemp = new URL(urlURL.getProtocol(),
  -//                            locationURL.getHost(),
  -//                            locationURL.getPort(),
  -//                            urlURL.getFile());
  -//                    interfaceNamespace += urlURL.getFile();
  -//                    locationUrl = urlTemp.toString();
  -//                } catch (Exception e) {
  -//                    locationUrl = url;
  -//                    interfaceNamespace = url;
  -//                }
  -//            }
  -
  -            Emitter emitter = new Emitter();
  -
  -            // Set the name for the target service.
  -            emitter.setServiceElementName(serviceDesc.getName());
  -            
  -            // service alias may be provided if exact naming is required,
  -            // otherwise Axis will name it according to the implementing class name
  -            String alias = (String) service.getOption("alias");
  -            if (alias != null) emitter.setServiceElementName(alias);
  -
  -            // Set style/use
  -            emitter.setStyle(serviceDesc.getStyle());
  -            emitter.setUse(serviceDesc.getUse());
  -
  -            emitter.setClsSmart(serviceDesc.getImplClass(), locationUrl);
  -
  -            // If a wsdl target namespace was provided, use the targetNamespace.
  -            // Otherwise use the interfaceNamespace constructed above.
  -            String targetNamespace = (String) service.getOption(OPTION_WSDL_TARGETNAMESPACE);
  -            if (targetNamespace == null ||
  -                    targetNamespace.length() == 0) {
  -                targetNamespace = interfaceNamespace;
  -            }
  -            emitter.setIntfNamespace(targetNamespace);
  -
  -            emitter.setLocationUrl(locationUrl);
  -            emitter.setServiceDesc(serviceDesc);
  -            emitter.setTypeMapping((TypeMapping) msgContext.getTypeMappingRegistry()
  -                    .getTypeMapping(serviceDesc.getUse().getEncoding()));
  -            emitter.setDefaultTypeMapping((TypeMapping) msgContext.getTypeMappingRegistry().
  -                    getDefaultTypeMapping());
  -
  -            String wsdlPortType = (String) service.getOption(OPTION_WSDL_PORTTYPE);
  -            String wsdlServiceElement = (String) service.getOption(OPTION_WSDL_SERVICEELEMENT);
  -            String wsdlServicePort = (String) service.getOption(OPTION_WSDL_SERVICEPORT);
  -
  -            if (wsdlPortType != null && wsdlPortType.length() > 0) {
  -                emitter.setPortTypeName(wsdlPortType);
  -            }
  -            if (wsdlServiceElement != null && wsdlServiceElement.length() >
0) {
  -                emitter.setServiceElementName(wsdlServiceElement);
  -            }
  -            if (wsdlServicePort != null && wsdlServicePort.length() > 0) {
  -                emitter.setServicePortName(wsdlServicePort);
  -            }
  -
  -            String wsdlInputSchema = (String)
  -                    service.getOption(OPTION_WSDL_INPUTSCHEMA);
  -            if (null != wsdlInputSchema && wsdlInputSchema.length() > 0) {
  -                emitter.setInputSchema(wsdlInputSchema);
  -            }
  -
  -            Document doc = emitter.emit(Emitter.MODE_ALL);
  -
  -            msgContext.setProperty("WSDL", doc);
  -        } catch (NoClassDefFoundError e) {
  -            entLog.info(Messages.getMessage("toAxisFault00"), e);
  -            throw new AxisFault(e.toString(), e);
  -        } catch (Exception e) {
  -            entLog.info(Messages.getMessage("toAxisFault00"), e);
  -            throw AxisFault.makeFault(e);
  -        }
  -
  -        if (log.isDebugEnabled())
  -            log.debug("Exit: JavaProvider::generateWSDL (" + this + ")");
  +         
  +      AxisFault fault = new AxisFault( Messages.getMessage("noWSDL03"));
  +      
  +      // set the fault code, so that QSWSDLHandler could deside to report "nowsdl"
  +      // instead of throwing an AxisFault
  +      fault.setFaultCode( Constants.QNAME_NO_WSDLGENERATOR_FAULT_CODE);
  +      
  +      throw fault;
       }
   }
  
  
  
  1.124     +5 -0      ws-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- Constants.java	5 Oct 2003 07:04:34 -0000	1.123
  +++ Constants.java	16 Oct 2003 13:53:37 -0000	1.124
  @@ -658,6 +658,11 @@
       public static final QName QNAME_NO_SERVICE_FAULT_CODE
               = new QName(NS_URI_AXIS, "Server.NoService");
   
  +    /**
  +     * the provider for the service does not support WSDL generation
  +     */
  +    public static final QName QNAME_NO_WSDLGENERATOR_FAULT_CODE = new QName( NS_URI_AXIS,
"Server.NoWSDLSupport");          
  +    
       // Misc Strings
       //////////////////////////////////////////////////////////////////////////
   
  
  
  
  1.3       +8 -3      ws-axis/java/src/org/apache/axis/transport/http/QSWSDLHandler.java
  
  Index: QSWSDLHandler.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/transport/http/QSWSDLHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QSWSDLHandler.java	15 Aug 2003 19:19:31 -0000	1.2
  +++ QSWSDLHandler.java	16 Oct 2003 13:53:37 -0000	1.3
  @@ -136,9 +136,14 @@
                   response.setStatus (HttpURLConnection.HTTP_NOT_FOUND);
   
                   reportNoWSDL (response, writer, "noWSDL01", axisFault);
  -            }
  -
  -            else {
  +                
  +            } else if (axisFault.getFaultCode().equals(Constants.QNAME_NO_WSDLGENERATOR_FAULT_CODE))
{              
  +              // the provider for the service doesn't support WSDL generation
  +              response.setStatus (HttpURLConnection.HTTP_NOT_FOUND);
  +           
  +              // report WSDL support is missing                 
  +              reportNoWSDL (response, writer, "noWSDL03", axisFault);
  +            } else {
                   //all other faults get thrown
   
                   throw axisFault;
  
  
  
  1.72      +2 -0      ws-axis/java/src/org/apache/axis/i18n/resource.properties
  
  Index: resource.properties
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/i18n/resource.properties,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- resource.properties	13 Oct 2003 18:04:06 -0000	1.71
  +++ resource.properties	16 Oct 2003 13:53:37 -0000	1.72
  @@ -474,6 +474,8 @@
   noWSDL01=There is no SOAP service at this location
   # NOTE:  in noWSDL02, do not translate "WSDL"
   noWSDL02=There is a service at this location, but Axis did not generate the WSDL for it.
Perhaps it is is misconfigured. 
  +# NOTE:   in noWSDL03, do not translate "WSDL"
  +noWSDL03=The provider of this service does not support WSDL generation
   
   null00={0} is null
   
  
  
  

Mime
View raw message