Author: djencks Date: Mon Apr 11 19:16:00 2005 New Revision: 161006 URL: http://svn.apache.org/viewcvs?view=rev&rev=161006 Log: Another attempt to publish all the wsdls and schemas via http. I have no indications that this fails.
Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/OperationDescBuilder.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ServiceInfo.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java Mon Apr 11 19:16:00 2005 @@ -40,6 +40,7 @@ import javax.wsdl.Operation; import javax.wsdl.Port; import javax.wsdl.PortType; +import javax.wsdl.WSDLException; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap.SOAPBinding; import javax.xml.namespace.QName; @@ -108,12 +109,11 @@ //WebServiceBuilder public void configurePOJO(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject, String seiClassName, ClassLoader classLoader) throws DeploymentException { PortInfo portInfo = (PortInfo) portInfoObject; - ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(moduleFile, portInfo, classLoader); + ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, classLoader); JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc(); - Class pojoClass = null; try { - pojoClass = classLoader.loadClass(seiClassName); + classLoader.loadClass(seiClassName); } catch (ClassNotFoundException e) { throw new DeploymentException("Unable to load servlet class for pojo webservice: "+seiClassName, e); } @@ -125,7 +125,7 @@ service.setServiceDescription(serviceDesc); service.setOption("className", seiClassName); - HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(serviceInfo.getHanlderInfos()); + HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(serviceInfo.getHandlerInfos()); service.setOption(org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN, handlerInfoChainFactory); URI location = null; @@ -134,9 +134,21 @@ } catch (URISyntaxException e) { throw new DeploymentException("Invalid webservice endpoint URI", e); } + URI wsdlURI = null; + try { + wsdlURI = new URI(serviceDesc.getWSDLFile()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid wsdl URI", e); + + } classLoader = new ClassLoaderReference(classLoader); - AxisWebServiceContainer axisWebServiceContainer = new AxisWebServiceContainer(location, serviceDesc.getWSDLFile(), service, classLoader); + AxisWebServiceContainer axisWebServiceContainer = null; + try { + axisWebServiceContainer = new AxisWebServiceContainer(location, wsdlURI, service, serviceInfo.getWsdlMap(), classLoader); + } catch (WSDLException e) { + throw new DeploymentException("Could not construct AxisWebServiceContainer", e); + } //targetGBean.setAttribute("webServiceContainer", axisWebServiceContainer); try { targetGBean.setAttribute("webServiceContainer", new StoredObject(axisWebServiceContainer)); // Hack! @@ -153,15 +165,15 @@ //ServicereferenceBuilder public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Map portLocationMap, Map credentialsNameMap, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException { JarFile moduleFile = module.getModuleFile(); - Definition definition = null; + SchemaInfoBuilder schemaInfoBuilder = null; JavaWsdlMappingType mapping = null; if (wsdlURI != null) { - definition = WSDescriptorParser.readWsdl(moduleFile, wsdlURI); + schemaInfoBuilder = new SchemaInfoBuilder(moduleFile, wsdlURI); mapping = WSDescriptorParser.readJaxrpcMapping(moduleFile, jaxrpcMappingURI); } - Object service = createService(serviceInterface, definition, mapping, serviceQName, SOAP_VERSION, handlerInfos, portLocationMap, credentialsNameMap, deploymentContext, module, classLoader); + Object service = createService(serviceInterface, schemaInfoBuilder, mapping, serviceQName, SOAP_VERSION, handlerInfos, portLocationMap, credentialsNameMap, deploymentContext, module, classLoader); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { @@ -176,12 +188,12 @@ return reference; } - public Object createService(Class serviceInterface, Definition definition, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos, Map portLocationMap, Map credentialsNameMap, DeploymentContext context, Module module, ClassLoader classloader) throws DeploymentException { + public Object createService(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos, Map portLocationMap, Map credentialsNameMap, DeploymentContext context, Module module, ClassLoader classloader) throws DeploymentException { Map seiPortNameToFactoryMap = new HashMap(); Map seiClassNameToFactoryMap = new HashMap(); Object serviceInstance = createServiceInterfaceProxy(serviceInterface, seiPortNameToFactoryMap, seiClassNameToFactoryMap, context, module, classloader); - if (definition != null) { - buildSEIFactoryMap(serviceInterface, definition, portLocationMap, credentialsNameMap, mapping, handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, serviceInstance, context, module, classloader); + if (schemaInfoBuilder != null) { + buildSEIFactoryMap(serviceInterface, schemaInfoBuilder, portLocationMap, credentialsNameMap, mapping, handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, serviceInstance, context, module, classloader); } return serviceInstance; } @@ -218,18 +230,16 @@ } } - public void buildSEIFactoryMap(Class serviceInterface, Definition definition, Map portLocationMap, Map credentialsNameMap, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, Object serviceImpl, DeploymentContext context, Module module, ClassLoader classLoader) throws DeploymentException { + public void buildSEIFactoryMap(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder, Map portLocationMap, Map credentialsNameMap, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, Object serviceImpl, DeploymentContext context, Module module, ClassLoader classLoader) throws DeploymentException { //find the service we are working with - javax.wsdl.Service service = getService(serviceQName, definition); + javax.wsdl.Service service = getService(serviceQName, schemaInfoBuilder.getDefinition()); if (portLocationMap != null) { - WSDescriptorParser.updatePortLocations(service, portLocationMap); + SchemaInfoBuilder.updatePortLocations(service, portLocationMap); } Map exceptionMap = WSDescriptorParser.getExceptionMap(mapping); - JarFile moduleFile = module.getModuleFile(); - SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(moduleFile, definition); Map schemaTypeKeyToSchemaTypeMap = schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(); Map complexTypeMap = schemaInfoBuilder.getComplexTypesInWsdl(); Map elementMap = schemaInfoBuilder.getElementToTypeMap(); @@ -281,7 +291,7 @@ } private Style getStyle(Binding binding) throws DeploymentException { - SOAPBinding soapBinding = (SOAPBinding) WSDescriptorParser.getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); + SOAPBinding soapBinding = (SOAPBinding) SchemaInfoBuilder.getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); // String transportURI = soapBinding.getTransportURI(); String portStyleString = soapBinding.getStyle(); Style portStyle = Style.getStyle(portStyleString); @@ -289,7 +299,7 @@ } private URL getAddressLocation(Port port) throws DeploymentException { - SOAPAddress soapAddress = (SOAPAddress) WSDescriptorParser.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); + SOAPAddress soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); String locationURIString = soapAddress.getLocationURI(); URL location = null; try { @@ -419,7 +429,7 @@ if (javaXmlTypeMapping.isSetRootTypeQname()) { typeName = javaXmlTypeMapping.getRootTypeQname().getQNameValue(); key = new SchemaTypeKey(typeName, isElement, isSimpleType, false); - + // Skip the wrapper elements. if (wrapperElementQNames.contains(typeName)) { continue; @@ -433,7 +443,7 @@ //this appears to be ignored... typeName = new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 1)); key = new SchemaTypeKey(typeName, isElement, isSimpleType, true); - + // Skip the wrapper elements. if (wrapperElementQNames.contains(new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 2)))) { continue; @@ -445,7 +455,7 @@ if (schemaType == null) { throw new DeploymentException("Schema type key " + key + " not found in analyzed schema: " + schemaTypeKeyToSchemaTypeMap); } - + //default settings Class serializerFactoryClass = BeanSerializerFactory.class; Class deserializerFactoryClass = BeanDeserializerFactory.class; Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java Mon Apr 11 19:16:00 2005 @@ -32,17 +32,26 @@ import org.apache.geronimo.kernel.ClassLoading; import org.apache.geronimo.xbeans.j2ee.*; import org.apache.xmlbeans.SchemaType; +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlException; +import org.w3.x2001.xmlSchema.SchemaDocument; +import org.w3.x2001.xmlSchema.ImportDocument; +import org.w3.x2001.xmlSchema.IncludeDocument; +import org.w3c.dom.Element; import javax.wsdl.*; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap.SOAPBinding; import javax.wsdl.extensions.soap.SOAPBody; +import javax.wsdl.extensions.schema.Schema; import javax.xml.namespace.QName; import javax.xml.rpc.handler.HandlerInfo; import java.lang.String; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.util.*; import java.util.jar.JarFile; @@ -70,9 +79,7 @@ // Grab the portInfo for this ejb PortInfo portInfo = (PortInfo) portComponentsMap.get(ejbName); - JavaServiceDesc serviceDesc = createServiceDesc(jarFile, portInfo, classLoader); - List handlerInfos = createHandlerInfos(portInfo, classLoader); - return new ServiceInfo(serviceDesc, handlerInfos); + return createServiceInfo(portInfo, classLoader); } public static JavaServiceDesc createEJBServiceDesc(JarFile jarFile, String ejbName, ClassLoader classLoader) throws DeploymentException { @@ -86,7 +93,7 @@ // Grab the portInfo for this ejb PortInfo portInfo = (PortInfo) portComponentsMap.get(ejbName); - return createServiceDesc(jarFile, portInfo, classLoader); + return createServiceDesc(portInfo, classLoader); } private static List createHandlerInfos(PortInfo portInfo, ClassLoader classLoader) throws DeploymentException { @@ -103,7 +110,7 @@ try { handlerClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { - throw new DeploymentException("Unable to load handler class: "+className, e); + throw new DeploymentException("Unable to load handler class: " + className, e); } // config data for the handler @@ -129,13 +136,16 @@ return list; } - public static ServiceInfo createServiceInfo(JarFile moduleFile, PortInfo portInfo, ClassLoader classLoader) throws DeploymentException { - JavaServiceDesc serviceDesc = createServiceDesc(moduleFile, portInfo, classLoader); + public static ServiceInfo createServiceInfo(PortInfo portInfo, ClassLoader classLoader) throws DeploymentException { + JavaServiceDesc serviceDesc = createServiceDesc(portInfo, classLoader); List handlerInfos = createHandlerInfos(portInfo, classLoader); - return new ServiceInfo(serviceDesc, handlerInfos); + SchemaInfoBuilder schemaInfoBuilder = portInfo.getSchemaInfoBuilder(); + Map rawWsdlMap = schemaInfoBuilder.getWsdlMap(); + Map wsdlMap = rewriteWsdlMap(portInfo, rawWsdlMap); + return new ServiceInfo(serviceDesc, handlerInfos, wsdlMap); } - public static JavaServiceDesc createServiceDesc(JarFile moduleFile, PortInfo portInfo, ClassLoader classLoader) throws DeploymentException { + public static JavaServiceDesc createServiceDesc(PortInfo portInfo, ClassLoader classLoader) throws DeploymentException { Port port = portInfo.getPort(); // System.out.println("port = " + port); @@ -148,7 +158,7 @@ } Map exceptionMap = WSDescriptorParser.getExceptionMap(portInfo.getJavaWsdlMapping()); - SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(moduleFile, portInfo.getDefinition()); + SchemaInfoBuilder schemaInfoBuilder = portInfo.getSchemaInfoBuilder(); Map schemaTypeKeyToSchemaTypeMap = schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(); Map complexTypeMap = schemaInfoBuilder.getComplexTypesInWsdl(); Map elementMap = schemaInfoBuilder.getElementToTypeMap(); @@ -164,7 +174,7 @@ BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput(); - SOAPBody soapBody = (SOAPBody) WSDescriptorParser.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements()); + SOAPBody soapBody = (SOAPBody) SchemaInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements()); if (soapBody.getUse() != null) { Use use = Use.getUse(soapBody.getUse()); @@ -212,7 +222,7 @@ if (javaXmlTypeMapping.isSetRootTypeQname()) { typeQName = javaXmlTypeMapping.getRootTypeQname().getQNameValue(); key = new SchemaTypeKey(typeQName, isElement, isSimpleType, false); - + // Skip the wrapper elements. if (wrapperElementQNames.contains(typeQName)) { continue; @@ -258,7 +268,7 @@ serializerFactoryClass = ArraySerializerFactory.class; deserializerFactoryClass = ArrayDeserializerFactory.class; } - + TypeDesc typeDesc = TypeDescBuilder.getTypeDescriptor(clazz, typeQName, javaXmlTypeMapping, schemaType); SerializerFactory ser = BaseSerializerFactory.createFactory(serializerFactoryClass, clazz, typeQName); @@ -311,7 +321,7 @@ private static Set buildOperations(Binding binding, Class serviceEndpointInterface, boolean lightweight, PortInfo portInfo, Map exceptionMap, Map complexTypeMap, Map elementMap, ClassLoader classLoader, JavaServiceDesc serviceDesc) throws DeploymentException { Set wrappedElementQNames = new HashSet(); - + List bindingOperations = binding.getBindingOperations(); for (int i = 0; i < bindingOperations.size(); i++) { BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i); @@ -332,13 +342,13 @@ serviceDesc.addOperationDesc(operationDescBuilder.buildOperationDesc()); } - + return wrappedElementQNames; } private static Style getStyle(Binding binding) throws DeploymentException { - SOAPBinding soapBinding = (SOAPBinding) WSDescriptorParser.getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); + SOAPBinding soapBinding = (SOAPBinding) SchemaInfoBuilder.getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); // String transportURI = soapBinding.getTransportURI(); String portStyleString = soapBinding.getStyle(); Style portStyle = Style.getStyle(portStyleString); @@ -346,7 +356,7 @@ } private static URL getAddressLocation(Port port) throws DeploymentException { - SOAPAddress soapAddress = (SOAPAddress) WSDescriptorParser.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); + SOAPAddress soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); String locationURIString = soapAddress.getLocationURI(); URL location = null; try { @@ -356,4 +366,93 @@ } return location; } + + private static Map rewriteWsdlMap(PortInfo portInfo, Map rawWsdlMap) throws DeploymentException { + URI contextURI = portInfo.getContextURI(); + Map wsdlMap = new HashMap(); + for (Iterator iterator = rawWsdlMap.entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + URI key = (URI) entry.getKey(); + Object value = entry.getValue(); + if (value instanceof SchemaDocument) { + SchemaDocument schemaDocument = (SchemaDocument) ((SchemaDocument) value).copy(); + SchemaDocument.Schema schema = schemaDocument.getSchema(); + rewriteSchema(schema, contextURI, key); + String schemaString = schemaDocument.toString(); + wsdlMap.put(key.toString(), schemaString); + } else if (value instanceof Definition) { + Definition definition = (Definition) value; + Map imports = definition.getImports(); + for (Iterator iterator2 = imports.values().iterator(); iterator2.hasNext();) { + List importList = (List) iterator2.next(); + for (Iterator iterator3 = importList.iterator(); iterator3.hasNext();) { + Import anImport = (Import) iterator3.next(); + String importLocation = anImport.getLocationURI(); + if (!importLocation.startsWith("http://")) { + URI updated = buildQueryURI(contextURI, key, importLocation); + anImport.setLocationURI(updated.toString()); + } + } + } + Types types = definition.getTypes(); + List schemaList = types.getExtensibilityElements(); + for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();) { + Object o = iterator1.next(); + if (o instanceof Schema) { + Schema schemaType = (Schema) o; + Element e = schemaType.getElement(); + try { + SchemaDocument.Schema schema = (SchemaDocument.Schema) XmlObject.Factory.parse(e); + rewriteSchema(schema, contextURI, key); + Element e2 = (Element) schema.newDomNode(); + schemaType.setElement(e2); + } catch (XmlException e1) { + throw new DeploymentException("Could not parse included schema", e1); + } + } + } + wsdlMap.put(key.toString(), definition); + } else { + throw new DeploymentException("Unexpected element in wsdlMap at location: " + key + ", value: " + value); + } + } + return wsdlMap; + } + + private static void rewriteSchema(SchemaDocument.Schema schema, URI contextURI, URI key) throws DeploymentException { + ImportDocument.Import[] imports = schema.getImportArray(); + for (int i = 0; i < imports.length; i++) { + ImportDocument.Import anImport = imports[i]; + if (anImport.isSetSchemaLocation()) { + String schemaLocation = anImport.getSchemaLocation(); + URI absoluteSchemLocation = buildQueryURI(contextURI, key, schemaLocation); + anImport.setSchemaLocation(absoluteSchemLocation.toString()); + } + } + IncludeDocument.Include[] includes = schema.getIncludeArray(); + for (int i = 0; i < includes.length; i++) { + IncludeDocument.Include include = includes[i]; + String schemaLocation = include.getSchemaLocation(); + URI absoluteSchemLocation = buildQueryURI(contextURI, key, schemaLocation); + include.setSchemaLocation(absoluteSchemLocation.toString()); + } + } + + private static URI buildQueryURI(URI contextURI, URI key, String importLocation) throws DeploymentException { + try { + URI importLocationURI = new URI(importLocation); + if (importLocationURI.isAbsolute() || importLocationURI.getPath().startsWith("/")) { + return importLocationURI; + } + return new URI(null, + null, + contextURI.getPath(), + "wsdl=" + key.resolve(importLocationURI), + null); + } catch (URISyntaxException e) { + throw new DeploymentException("Could not construct wsdl location URI", e); + } + } + + } Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java Mon Apr 11 19:16:00 2005 @@ -110,7 +110,7 @@ this.classLoader = classLoader; this.serviceEndpointInterface = serviceEndpointInterface; BindingInput bindingInput = bindingOperation.getBindingInput(); - this.soapBody = (SOAPBody) WSDescriptorParser.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements()); + this.soapBody = (SOAPBody) SchemaInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements()); this.wrappedStype = methodMapping.isSetWrappedElement(); } Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/OperationDescBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/OperationDescBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/OperationDescBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/OperationDescBuilder.java Mon Apr 11 19:16:00 2005 @@ -39,7 +39,7 @@ public OperationDescBuilder(BindingOperation bindingOperation) throws DeploymentException { this.bindingOperation = bindingOperation; this.operation = bindingOperation.getOperation(); - this.soapOperation = (SOAPOperation) WSDescriptorParser.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements()); + this.soapOperation = (SOAPOperation) SchemaInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements()); operationDesc = new OperationDesc(); output = operation.getOutput() == null ? null : operation.getOutput().getMessage(); Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/PortInfo.java Mon Apr 11 19:16:00 2005 @@ -16,6 +16,7 @@ */ package org.apache.geronimo.axis.builder; +import java.net.URI; import javax.wsdl.Definition; import javax.wsdl.Port; import javax.xml.namespace.QName; @@ -30,25 +31,27 @@ public class PortInfo { private final String portName; private final QName portQName; - private final Definition definition; + private final SchemaInfoBuilder schemaInfoBuilder; private final JavaWsdlMappingType javaWsdlMapping; private final ServiceEndpointInterfaceMappingType seiMapping; private final String seInterfaceName; private final PortComponentHandlerType[] handlers; private final Port port; + private final URI contextURI; private final String wsdlLocation; - public PortInfo(String portName, QName portQName, Definition definition, JavaWsdlMappingType javaWsdlMapping, String seiInterfaceName, PortComponentHandlerType[] handlers, Port port, ServiceEndpointInterfaceMappingType seiMapping, String wsdlLocation) { + public PortInfo(String portName, QName portQName, SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType javaWsdlMapping, String seiInterfaceName, PortComponentHandlerType[] handlers, Port port, ServiceEndpointInterfaceMappingType seiMapping, String wsdlLocation, URI contextURI) { this.portName = portName; this.portQName = portQName; - this.definition = definition; + this.schemaInfoBuilder = schemaInfoBuilder; this.javaWsdlMapping = javaWsdlMapping; this.seInterfaceName = seiInterfaceName; this.handlers = handlers; this.port = port; this.seiMapping = seiMapping; this.wsdlLocation = wsdlLocation; + this.contextURI = contextURI; } public String getWsdlLocation() { @@ -71,8 +74,12 @@ return port; } + public SchemaInfoBuilder getSchemaInfoBuilder() { + return schemaInfoBuilder; + } + public Definition getDefinition() { - return definition; + return schemaInfoBuilder.getDefinition(); } public JavaWsdlMappingType getJavaWsdlMapping() { @@ -90,5 +97,9 @@ public PortComponentHandlerType[] getHandlers() { return handlers; + } + + public URI getContextURI() { + return contextURI; } } Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java Mon Apr 11 19:16:00 2005 @@ -18,9 +18,9 @@ import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -28,15 +28,26 @@ import java.util.List; import java.util.Map; import java.util.Stack; -import java.util.zip.ZipEntry; import java.util.jar.JarFile; +import java.util.zip.ZipEntry; import javax.wsdl.Definition; import javax.wsdl.Import; +import javax.wsdl.Port; +import javax.wsdl.Service; import javax.wsdl.Types; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.UnknownExtensibilityElement; +import javax.wsdl.extensions.ExtensionRegistry; import javax.wsdl.extensions.schema.Schema; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLLocator; +import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.geronimo.common.DeploymentException; import org.apache.geronimo.schema.SchemaConversionUtils; import org.apache.xmlbeans.SchemaField; @@ -46,16 +57,17 @@ import org.apache.xmlbeans.SchemaTypeSystem; import org.apache.xmlbeans.XmlBeans; import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlError; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlOptions; -import org.apache.xmlbeans.XmlError; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.w3.x2001.xmlSchema.SchemaDocument; import org.w3c.dom.Element; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import com.ibm.wsdl.extensions.PopulatedExtensionRegistry; +import com.ibm.wsdl.extensions.schema.SchemaConstants; /** * @version $Rev: $ $Date: $ @@ -86,10 +98,21 @@ } private final JarFile moduleFile; + private final Definition definition; private final Stack uris = new Stack(); private final Map schemaTypeKeyToSchemaTypeMap; + private final Map wsdlMap = new HashMap(); + + public SchemaInfoBuilder(JarFile moduleFile, URI wsdlUri) throws DeploymentException { + this.moduleFile = moduleFile; + uris.push(wsdlUri); + definition = readWsdl(moduleFile, wsdlUri); + SchemaTypeSystem schemaTypeSystem = compileSchemaTypeSystem(definition); + schemaTypeKeyToSchemaTypeMap = buildSchemaTypeKeyToSchemaTypeMap(schemaTypeSystem); + } public SchemaInfoBuilder(JarFile moduleFile, Definition definition) throws DeploymentException { + this.definition = definition; this.moduleFile = moduleFile; try { URI uri = new URI(definition.getDocumentBaseURI()); @@ -102,6 +125,7 @@ } SchemaInfoBuilder(JarFile moduleFile, URI uri, SchemaTypeSystem schemaTypeSystem) { + this.definition = null; this.moduleFile = moduleFile; uris.push(uri); schemaTypeKeyToSchemaTypeMap = buildSchemaTypeKeyToSchemaTypeMap(schemaTypeSystem); @@ -111,6 +135,14 @@ return schemaTypeKeyToSchemaTypeMap; } + public Definition getDefinition() { + return definition; + } + + public Map getWsdlMap() { + return wsdlMap; + } + private static final String[] errorNames = { "Error", "Warning", "Info" }; @@ -383,6 +415,90 @@ return elementToTypeMap; } + /** + * Gets a map of all the javax.wsdl.Port instance in the WSDL definition keyed by the port's QName + * <p/> + * WSDL 1.1 spec: 2.6 "The name attribute provides a unique name among all ports defined within in the enclosing WSDL document." + * + * @return + */ + + public Map getPortMap() { + HashMap ports = new HashMap(); + Collection services = definition.getServices().values(); + for (Iterator iterator = services.iterator(); iterator.hasNext();) { + Service service = (Service) iterator.next(); + ports.putAll(service.getPorts()); + } + return ports; + } + + public Definition readWsdl(JarFile moduleFile, URI wsdlURI) throws DeploymentException { + Definition definition; + WSDLFactory wsdlFactory = null; + try { + wsdlFactory = WSDLFactory.newInstance(); + } catch (WSDLException e) { + throw new DeploymentException("Could not create WSDLFactory", e); + } + WSDLReader wsdlReaderNoImport = wsdlFactory.newWSDLReader(); + wsdlReaderNoImport.setFeature("javax.wsdl.importDocuments", false); + ExtensionRegistry extensionRegistry = new PopulatedExtensionRegistry(); + extensionRegistry.mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_1999, + UnknownExtensibilityElement.class); + extensionRegistry.registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999, + extensionRegistry.getDefaultDeserializer()); + extensionRegistry.registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999, + extensionRegistry.getDefaultSerializer()); + + extensionRegistry.mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2000, + UnknownExtensibilityElement.class); + extensionRegistry.registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000, + extensionRegistry.getDefaultDeserializer()); + extensionRegistry.registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000, + extensionRegistry.getDefaultSerializer()); + + extensionRegistry.mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2001, + UnknownExtensibilityElement.class); + extensionRegistry.registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001, + extensionRegistry.getDefaultDeserializer()); + extensionRegistry.registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001, + extensionRegistry.getDefaultSerializer()); + wsdlReaderNoImport.setExtensionRegistry(extensionRegistry); + JarWSDLLocator wsdlLocator = new JarWSDLLocator(wsdlURI, wsdlReaderNoImport); + WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); + try { + definition = wsdlReader.readWSDL(wsdlLocator); + } catch (WSDLException e) { + throw new DeploymentException("Failed to read wsdl document", e); + } + return definition; + } + + public static ExtensibilityElement getExtensibilityElement(Class clazz, List extensibilityElements) throws DeploymentException { + for (Iterator iterator = extensibilityElements.iterator(); iterator.hasNext();) { + ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator.next(); + if (clazz.isAssignableFrom(extensibilityElement.getClass())) { + return extensibilityElement; + } + } + throw new DeploymentException("No element of class " + clazz.getName() + " found"); + } + + public static void updatePortLocations(Service service, Map portLocations) throws DeploymentException { + for (Iterator iterator = portLocations.entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + String portName = (String) entry.getKey(); + String location = (String) entry.getValue(); + Port port = service.getPort(portName); + if (port == null) { + throw new DeploymentException("No port named " + portName + " found in service " + service.getQName()); + } + SOAPAddress soapAddress = (SOAPAddress) getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); + soapAddress.setLocationURI(location); + } + } + private class JarEntityResolver implements EntityResolver { private final static String PROJECT_URL_PREFIX = "project://local/"; @@ -392,24 +508,76 @@ systemId = systemId.substring(PROJECT_URL_PREFIX.length()); } URI location = ((URI) uris.peek()).resolve(systemId); -// System.out.println("SystemId: " + systemId + ", location: " + location); InputStream wsdlInputStream = null; try { ZipEntry entry = moduleFile.getEntry(location.toString()); -// System.out.println("entry: " + entry.getName()); wsdlInputStream = moduleFile.getInputStream(entry); -// byte[] buf = new byte[1024]; -// int i; -// while ((i = wsdlInputStream.read(buf)) > 0 ) { -// System.out.write(buf, 0, i); -// } -// wsdlInputStream.close(); -// wsdlInputStream = moduleFile.getInputStream(entry); - } catch (IOException e) { - throw new RuntimeException("Could not open stream to wsdl file", e); + XmlObject xmlObject = SchemaDocument.Factory.parse(wsdlInputStream); + wsdlMap.put(location, xmlObject); + wsdlInputStream.close(); + wsdlInputStream = moduleFile.getInputStream(entry); + } catch (XmlException e) { + throw (IOException)new IOException("Could not parse schema document").initCause(e); } return new InputSource(wsdlInputStream); } } + class JarWSDLLocator implements WSDLLocator { + + private final URI wsdlURI; + private final WSDLReader wsdlReader; + private URI latestImportURI; + + public JarWSDLLocator(URI wsdlURI, WSDLReader wsdlReader) { + this.wsdlURI = wsdlURI; + this.wsdlReader = wsdlReader; + } + + public InputSource getBaseInputSource() { + InputStream wsdlInputStream = null; + try { + ZipEntry entry = moduleFile.getEntry(wsdlURI.toString()); + wsdlInputStream = moduleFile.getInputStream(entry); + Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new InputSource(wsdlInputStream)); + wsdlMap.put(wsdlURI, definition); + wsdlInputStream.close(); + wsdlInputStream = moduleFile.getInputStream(entry); + } catch (Exception e) { + throw new RuntimeException("Could not open stream to wsdl file", e); + } + return new InputSource(wsdlInputStream); + } + + public String getBaseURI() { + return wsdlURI.toString(); + } + + public InputSource getImportInputSource(String parentLocation, String relativeLocation) { + URI parentURI = URI.create(parentLocation); + latestImportURI = parentURI.resolve(relativeLocation); + InputStream importInputStream = null; + try { + ZipEntry entry = moduleFile.getEntry(latestImportURI.toString()); + importInputStream = moduleFile.getInputStream(entry); + try { + Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new InputSource(importInputStream)); + wsdlMap.put(latestImportURI, definition); + importInputStream.close(); + } catch (WSDLException e) { + //probably was a schema rather than wsdl. If there are real problems they will show up later. + } + importInputStream = moduleFile.getInputStream(entry); + } catch (Exception e) { + throw new RuntimeException("Could not open stream to import file", e); + } + InputSource inputSource = new InputSource(importInputStream); + inputSource.setSystemId(getLatestImportURI()); + return inputSource; + } + + public String getLatestImportURI() { + return latestImportURI.toString(); + } + } } Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/WSDescriptorParser.java Mon Apr 11 19:16:00 2005 @@ -24,23 +24,15 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.net.MalformedURLException; import java.util.Calendar; -import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.jar.JarFile; import javax.wsdl.Definition; import javax.wsdl.Operation; import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.soap.SOAPAddress; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLLocator; -import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; import javax.xml.rpc.holders.BigDecimalHolder; import javax.xml.rpc.holders.BigIntegerHolder; @@ -80,7 +72,6 @@ import org.apache.geronimo.xbeans.j2ee.WebservicesDocument; import org.apache.geronimo.xbeans.j2ee.WebservicesType; import org.apache.xmlbeans.XmlException; -import org.xml.sax.InputSource; /** * @version $Rev: $ $Date: $ @@ -88,115 +79,6 @@ public class WSDescriptorParser { - public static Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB) throws DeploymentException { - try { - WebservicesDocument webservicesDocument = WebservicesDocument.Factory.parse(wsDDUrl); - SchemaConversionUtils.validateDD(webservicesDocument); - WebservicesType webservicesType = webservicesDocument.getWebservices(); - return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB); - } catch (XmlException e) { - throw new DeploymentException("Could not read descriptor document", e); - } catch (IOException e) { - return null; - } - - } - - /** - * Parses a webservice.xml file and returns a map PortInfo instances indexed by the - * corresponding ejb-link or servlet-link element . - * - * @param webservicesType - * @param moduleFile - * @param isEJB - * @return - * @throws DeploymentException - */ - public static Map parseWebServiceDescriptor(WebservicesType webservicesType, JarFile moduleFile, boolean isEJB) throws DeploymentException { - Map portMap = new HashMap(); - WebserviceDescriptionType[] webserviceDescriptions = webservicesType.getWebserviceDescriptionArray(); - for (int i = 0; i < webserviceDescriptions.length; i++) { - WebserviceDescriptionType webserviceDescription = webserviceDescriptions[i]; - URI wsdlURI = null; - try { - wsdlURI = new URI(webserviceDescription.getWsdlFile().getStringValue().trim()); - } catch (URISyntaxException e) { - throw new DeploymentException("could not construct wsdl uri from " + webserviceDescription.getWsdlFile().getStringValue(), e); - } - URI jaxrpcMappingURI = null; - try { - jaxrpcMappingURI = new URI(webserviceDescription.getJaxrpcMappingFile().getStringValue().trim()); - } catch (URISyntaxException e) { - throw new DeploymentException("Could not construct jaxrpc mapping uri from " + webserviceDescription.getJaxrpcMappingFile(), e); - } - Definition definition = readWsdl(moduleFile, wsdlURI); - Map wsdlPortMap = WSDescriptorParser.getPortMap(definition); - - JavaWsdlMappingType javaWsdlMapping = readJaxrpcMapping(moduleFile, jaxrpcMappingURI); - HashMap seiMappings = new HashMap(); - org.apache.geronimo.xbeans.j2ee.ServiceEndpointInterfaceMappingType[] mappings = javaWsdlMapping.getServiceEndpointInterfaceMappingArray(); - for (int j = 0; j < mappings.length; j++) { - ServiceEndpointInterfaceMappingType seiMapping = mappings[j]; - seiMappings.put(seiMapping.getServiceEndpointInterface().getStringValue(), seiMapping); - } - - PortComponentType[] portComponents = webserviceDescription.getPortComponentArray(); - for (int j = 0; j < portComponents.length; j++) { - PortComponentType portComponent = portComponents[j]; - String portComponentName = portComponent.getPortComponentName().getStringValue().trim(); - QName portQName = portComponent.getWsdlPort().getQNameValue(); - String seiInterfaceName = portComponent.getServiceEndpointInterface().getStringValue().trim(); - ServiceImplBeanType serviceImplBeanType = portComponent.getServiceImplBean(); - if (isEJB == serviceImplBeanType.isSetServletLink()) { - throw new DeploymentException("Wrong kind of web service described in web service descriptor: expected " + (isEJB ? "EJB" : "POJO(Servlet)")); - } - String linkName; - if (serviceImplBeanType.isSetServletLink()) { - linkName = serviceImplBeanType.getServletLink().getStringValue().trim(); - } else { - linkName = serviceImplBeanType.getEjbLink().getStringValue().trim(); - } - PortComponentHandlerType[] handlers = portComponent.getHandlerArray(); - - Port port = (Port) wsdlPortMap.get(portQName.getLocalPart()); - if (port == null) { - throw new DeploymentException("No WSDL Port definition for port-component " + portComponentName); - } - - ServiceEndpointInterfaceMappingType seiMapping = (ServiceEndpointInterfaceMappingType) seiMappings.get(seiInterfaceName); - - String wsdlLocation = webserviceDescription.getWsdlFile().getStringValue().trim(); - - PortInfo portInfo = new PortInfo(portComponentName, portQName, definition, javaWsdlMapping, seiInterfaceName, handlers, port, seiMapping, wsdlLocation); - - if (portMap.put(linkName, portInfo) != null) { - throw new DeploymentException("Ambiguous description of port associated with j2ee component " + linkName); - } - } - } - return portMap; - } - - - /** - * Gets a map of all the javax.wsdl.Port instance in the WSDL definition keyed by the port's QName - * <p/> - * WSDL 1.1 spec: 2.6 "The name attribute provides a unique name among all ports defined within in the enclosing WSDL document." - * - * @param definition - * @return - */ - - public static Map getPortMap(Definition definition) { - HashMap ports = new HashMap(); - Collection services = definition.getServices().values(); - for (Iterator iterator = services.iterator(); iterator.hasNext();) { - Service service = (Service) iterator.next(); - ports.putAll(service.getPorts()); - } - return ports; - } - public static JavaWsdlMappingType readJaxrpcMapping(JarFile moduleFile, URI jaxrpcMappingURI) throws DeploymentException { String jaxrpcMappingPath = jaxrpcMappingURI.toString(); return readJaxrpcMapping(moduleFile, jaxrpcMappingPath); @@ -222,24 +104,6 @@ return mapping; } - public static Definition readWsdl(JarFile moduleFile, URI wsdlURI) throws DeploymentException { - Definition definition; - JarWSDLLocator wsdlLocator = new JarWSDLLocator(moduleFile, wsdlURI); - WSDLFactory wsdlFactory = null; - try { - wsdlFactory = WSDLFactory.newInstance(); - } catch (WSDLException e) { - throw new DeploymentException("Could not create WSDLFactory", e); - } - WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); - try { - definition = wsdlReader.readWSDL(wsdlLocator); - } catch (WSDLException e) { - throw new DeploymentException("Failed to read wsdl document", e); - } - return definition; - } - public static Map getExceptionMap(JavaWsdlMappingType mapping) { Map exceptionMap = new HashMap(); @@ -388,30 +252,6 @@ return service; } - public static ExtensibilityElement getExtensibilityElement(Class clazz, List extensibilityElements) throws DeploymentException { - for (Iterator iterator = extensibilityElements.iterator(); iterator.hasNext();) { - ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator.next(); - if (clazz.isAssignableFrom(extensibilityElement.getClass())) { - return extensibilityElement; - } - } - throw new DeploymentException("No element of class " + clazz.getName() + " found"); - } - - public static void updatePortLocations(Service service, Map portLocations) throws DeploymentException { - for (Iterator iterator = portLocations.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - String portName = (String) entry.getKey(); - String location = (String) entry.getValue(); - Port port = service.getPort(portName); - if (port == null) { - throw new DeploymentException("No port named " + portName + " found in service " + service.getQName()); - } - SOAPAddress soapAddress = (SOAPAddress) WSDescriptorParser.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); - soapAddress.setLocationURI(location); - } - } - public static Method getMethodForOperation(Class serviceEndpointInterface, Operation operation) throws DeploymentException { Method[] methods = serviceEndpointInterface.getMethods(); String opName = operation.getName(); @@ -431,47 +271,105 @@ return found; } - static class JarWSDLLocator implements WSDLLocator { + /** + * Parses a webservice.xml file and returns a map PortInfo instances indexed by the + * corresponding ejb-link or servlet-link element . + * + * @param webservicesType + * @param moduleFile + * @param isEJB + * @return + * @throws org.apache.geronimo.common.DeploymentException + */ + public static Map parseWebServiceDescriptor(WebservicesType webservicesType, JarFile moduleFile, boolean isEJB) throws DeploymentException { + Map portMap = new HashMap(); + WebserviceDescriptionType[] webserviceDescriptions = webservicesType.getWebserviceDescriptionArray(); + for (int i = 0; i < webserviceDescriptions.length; i++) { + WebserviceDescriptionType webserviceDescription = webserviceDescriptions[i]; + URI wsdlURI = null; + try { + wsdlURI = new URI(webserviceDescription.getWsdlFile().getStringValue().trim()); + } catch (URISyntaxException e) { + throw new DeploymentException("could not construct wsdl uri from " + webserviceDescription.getWsdlFile().getStringValue(), e); + } + URI jaxrpcMappingURI = null; + try { + jaxrpcMappingURI = new URI(webserviceDescription.getJaxrpcMappingFile().getStringValue().trim()); + } catch (URISyntaxException e) { + throw new DeploymentException("Could not construct jaxrpc mapping uri from " + webserviceDescription.getJaxrpcMappingFile(), e); + } + SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(moduleFile, wsdlURI); + Map wsdlPortMap = schemaInfoBuilder.getPortMap(); - private final JarFile moduleFile; - private final URI wsdlURI; - private URI latestImportURI; + JavaWsdlMappingType javaWsdlMapping = readJaxrpcMapping(moduleFile, jaxrpcMappingURI); + HashMap seiMappings = new HashMap(); + ServiceEndpointInterfaceMappingType[] mappings = javaWsdlMapping.getServiceEndpointInterfaceMappingArray(); + for (int j = 0; j < mappings.length; j++) { + ServiceEndpointInterfaceMappingType seiMapping = mappings[j]; + seiMappings.put(seiMapping.getServiceEndpointInterface().getStringValue(), seiMapping); + } - public JarWSDLLocator(JarFile moduleFile, URI wsdlURI) { - this.moduleFile = moduleFile; - this.wsdlURI = wsdlURI; - } + PortComponentType[] portComponents = webserviceDescription.getPortComponentArray(); + for (int j = 0; j < portComponents.length; j++) { + PortComponentType portComponent = portComponents[j]; + String portComponentName = portComponent.getPortComponentName().getStringValue().trim(); + QName portQName = portComponent.getWsdlPort().getQNameValue(); + String seiInterfaceName = portComponent.getServiceEndpointInterface().getStringValue().trim(); + ServiceImplBeanType serviceImplBeanType = portComponent.getServiceImplBean(); + if (isEJB == serviceImplBeanType.isSetServletLink()) { + throw new DeploymentException("Wrong kind of web service described in web service descriptor: expected " + (isEJB ? "EJB" : "POJO(Servlet)")); + } + String linkName; + if (serviceImplBeanType.isSetServletLink()) { + linkName = serviceImplBeanType.getServletLink().getStringValue().trim(); + } else { + linkName = serviceImplBeanType.getEjbLink().getStringValue().trim(); + } + PortComponentHandlerType[] handlers = portComponent.getHandlerArray(); - public InputSource getBaseInputSource() { - InputStream wsdlInputStream = null; - try { - wsdlInputStream = moduleFile.getInputStream(moduleFile.getEntry(wsdlURI.toString())); - } catch (IOException e) { - throw new RuntimeException("Could not open stream to wsdl file", e); - } - return new InputSource(wsdlInputStream); - } + Port port = (Port) wsdlPortMap.get(portQName.getLocalPart()); + if (port == null) { + throw new DeploymentException("No WSDL Port definition for port-component " + portComponentName); + } - public String getBaseURI() { - return wsdlURI.toString(); - } + ServiceEndpointInterfaceMappingType seiMapping = (ServiceEndpointInterfaceMappingType) seiMappings.get(seiInterfaceName); - public InputSource getImportInputSource(String parentLocation, String relativeLocation) { - URI parentURI = URI.create(parentLocation); - latestImportURI = parentURI.resolve(relativeLocation); - InputStream importInputStream = null; - try { - importInputStream = moduleFile.getInputStream(moduleFile.getEntry(latestImportURI.toString())); - } catch (IOException e) { - throw new RuntimeException("Could not open stream to import file", e); + String wsdlLocation = webserviceDescription.getWsdlFile().getStringValue().trim(); + URI contextURI = getAddressLocation(port); + + PortInfo portInfo = new PortInfo(portComponentName, portQName, schemaInfoBuilder, javaWsdlMapping, seiInterfaceName, handlers, port, seiMapping, wsdlLocation, contextURI); + + if (portMap.put(linkName, portInfo) != null) { + throw new DeploymentException("Ambiguous description of port associated with j2ee component " + linkName); + } } - InputSource inputSource = new InputSource(importInputStream); - inputSource.setSystemId(getLatestImportURI()); - return inputSource; } + return portMap; + } + + private static URI getAddressLocation(Port port) throws DeploymentException { + SOAPAddress soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); + String locationURIString = soapAddress.getLocationURI(); + try { + URI location = new URI(locationURIString); + URI contextPath = new URI(location.getPath()); + return contextPath; + } catch (URISyntaxException e) { + throw new DeploymentException("Could not construct web service location URL from " + locationURIString); + } + } - public String getLatestImportURI() { - return latestImportURI.toString(); + public static Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB) throws DeploymentException { + try { + WebservicesDocument webservicesDocument = WebservicesDocument.Factory.parse(wsDDUrl); + SchemaConversionUtils.validateDD(webservicesDocument); + WebservicesType webservicesType = webservicesDocument.getWebservices(); + return parseWebServiceDescriptor(webservicesType, moduleFile, isEJB); + } catch (XmlException e) { + throw new DeploymentException("Could not read descriptor document", e); + } catch (IOException e) { + return null; } + } } Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original) +++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Mon Apr 11 19:16:00 2005 @@ -156,10 +156,11 @@ public void testBuildFullServiceProxy() throws Exception { Definition definition = buildDefinition(); + SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(null, definition); JavaWsdlMappingType mapping = buildLightweightMappingType(); QName serviceQName = new QName(NAMESPACE, "MockService"); AxisBuilder builder = new AxisBuilder(); - Object proxy = builder.createService(MockService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); + Object proxy = builder.createService(MockService.class, schemaInfoBuilder, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); assertNotNull(proxy); assertTrue(proxy instanceof MockService); MockPort mockPort = ((MockService) proxy).getMockPort(); @@ -171,12 +172,13 @@ WSDLFactory factory = WSDLFactory.newInstance(); WSDLReader reader = factory.newWSDLReader(); Definition definition = reader.readWSDL(wsdl.toURI().toString()); + SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(null, definition); File jaxrpcMapping = new File(basedir, "src/test-resources/BookQuote.xml"); JavaWsdlMappingDocument mappingDocument = JavaWsdlMappingDocument.Factory.parse(jaxrpcMapping); JavaWsdlMappingType mapping = mappingDocument.getJavaWsdlMapping(); QName serviceQName = new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote", "BookQuoteService"); AxisBuilder builder = new AxisBuilder(); - Object proxy = builder.createService(BookQuoteService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); + Object proxy = builder.createService(BookQuoteService.class, schemaInfoBuilder, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); assertNotNull(proxy); assertTrue(proxy instanceof BookQuoteService); BookQuote bookQuote = ((BookQuoteService) proxy).getBookQuotePort(); @@ -188,12 +190,13 @@ WSDLFactory factory = WSDLFactory.newInstance(); WSDLReader reader = factory.newWSDLReader(); Definition definition = reader.readWSDL(wsdlFile.toURI().toString()); + SchemaInfoBuilder schemaInfoBuilder = new SchemaInfoBuilder(null, definition); File jaxrpcMapping = new File(basedir, "src/test-resources/interop/interop-jaxrpcmapping.xml"); JavaWsdlMappingDocument mappingDocument = JavaWsdlMappingDocument.Factory.parse(jaxrpcMapping); JavaWsdlMappingType mapping = mappingDocument.getJavaWsdlMapping(); QName serviceQName = new QName("http://tempuri.org/4s4c/1/3/wsdl/def/interopLab", "interopLab"); AxisBuilder builder = new AxisBuilder(); - Object proxy = builder.createService(InteropLab.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); + Object proxy = builder.createService(InteropLab.class, schemaInfoBuilder, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, portLocationMap, credentialsNameMap, context, module, isolatedCl); assertNotNull(proxy); assertTrue(proxy instanceof InteropLab); InteropTestPortType interopTestPort = ((InteropLab) proxy).getinteropTestPort(); Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java Mon Apr 11 19:16:00 2005 @@ -16,7 +16,9 @@ */ package org.apache.geronimo.axis.server; +import java.io.IOException; import java.io.InputStream; +import java.io.ObjectInputStream; import java.io.OutputStream; import java.net.URI; import java.util.Iterator; @@ -25,11 +27,10 @@ import javax.wsdl.Definition; import javax.wsdl.Port; import javax.wsdl.Service; +import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLLocator; -import javax.wsdl.xml.WSDLReader; import javax.wsdl.xml.WSDLWriter; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; @@ -48,7 +49,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.geronimo.webservices.WebServiceContainer; import org.w3c.dom.Element; -import org.xml.sax.InputSource; /** * @version $Rev$ $Date$ @@ -62,19 +62,21 @@ public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema"; private final URI location; - private final String wsdlLocation; + private final URI wsdlLocation; private final SOAPService service; private final ClassLoader classLoader; - private final Byte wsdlMutext = new Byte((byte) 0); - private transient Definition definition; + private final Map wsdlMap; private transient WSDLWriter wsdlWriter; - public AxisWebServiceContainer(URI location, String wsdlURL, SOAPService service, ClassLoader classLoader) { + public AxisWebServiceContainer(URI location, URI wsdlURL, SOAPService service, Map wsdlMap, ClassLoader classLoader) throws WSDLException { this.location = location; this.wsdlLocation = wsdlURL; this.service = service; + this.wsdlMap = wsdlMap; this.classLoader = classLoader; + WSDLFactory wsdlFactory = WSDLFactory.newInstance(); + wsdlWriter = wsdlFactory.newWSDLWriter(); } public void invoke(Request req, Response res) throws Exception { @@ -198,108 +200,74 @@ } public void getWsdl(Request request, Response response) throws Exception { - - // Avoid concurrent modification of the WSDL dom. - synchronized (wsdlMutext) { - - // Read in the the WSDL in once. - if (definition == null) { - initWSDLDom(); - } - - // Update all the service port soap address elements. - Map services = definition.getServices(); - for (Iterator iter1 = services.values().iterator(); iter1.hasNext();) { - Service service = (Service) iter1.next(); - Map ports = service.getPorts(); - for (Iterator iter2 = ports.values().iterator(); iter2.hasNext();) { - Port port = (Port) iter2.next(); - for (Iterator iter3 = port.getExtensibilityElements().iterator(); iter3.hasNext();) { - ExtensibilityElement element = (ExtensibilityElement) iter3.next(); - if (element instanceof SOAPAddress) { - SOAPAddress soapAddress = (SOAPAddress) element; - URI realLocation = request.getURI(); - // We replace the host and port here. - URI updated = new URI(realLocation.getScheme(), - realLocation.getUserInfo(), - realLocation.getHost(), - realLocation.getPort(), - realLocation.getPath(), // Humm is this right? - null, - null); - soapAddress.setLocationURI(updated.toString()); + URI realLocation = request.getURI(); + String locationKey = request.getParameter("wsdl"); + if (locationKey == null) { + locationKey = request.getParameter("WSDL"); + } + if ("".equals(locationKey)) { + locationKey = wsdlLocation.toString(); + } else if (locationKey == null) { + throw new IllegalStateException("request must contain a wsdl or WSDL parameter: " + request.getParameters()); + } + Object wsdl = wsdlMap.get(locationKey); + if (wsdl == null) { + throw new IllegalStateException("No wsdl or schema known at location: " + locationKey); + } + if (wsdl instanceof String) { + response.getOutputStream().write(((String)wsdl).getBytes()); + } else { + Definition definition = (Definition) wsdl; + synchronized (definition) { + Map services = definition.getServices(); + for (Iterator iter1 = services.values().iterator(); iter1.hasNext();) { + Service service = (Service) iter1.next(); + Map ports = service.getPorts(); + for (Iterator iter2 = ports.values().iterator(); iter2.hasNext();) { + Port port = (Port) iter2.next(); + for (Iterator iter3 = port.getExtensibilityElements().iterator(); iter3.hasNext();) { + ExtensibilityElement element = (ExtensibilityElement) iter3.next(); + if (element instanceof SOAPAddress) { + SOAPAddress soapAddress = (SOAPAddress) element; + // We replace the host and port here. + String oldLocation = soapAddress.getLocationURI(); + URI oldLocationURI = new URI(oldLocation); + URI updated = new URI(realLocation.getScheme(), + realLocation.getUserInfo(), + realLocation.getHost(), + realLocation.getPort(), + oldLocationURI.getPath(), // Humm is this right? + null, + null); + soapAddress.setLocationURI(updated.toString()); + } } } } - } + // Dump the WSDL dom to the output stream + OutputStream out = response.getOutputStream(); + wsdlWriter.writeWSDL(definition, out); - // Dump the WSDL dom to the output stream - OutputStream out = response.getOutputStream(); - wsdlWriter.writeWSDL(definition, out); -// out.close(); + } } } - /** - * @throws Exception - */ - private void initWSDLDom() throws Exception { - WSDLFactory wsdlFactory = WSDLFactory.newInstance(); - wsdlWriter = wsdlFactory.newWSDLWriter(); - WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); - ResourceWSDLLocator wsdlLocator = new ResourceWSDLLocator(wsdlLocation, Thread.currentThread().getContextClassLoader(), classLoader); - definition = wsdlReader.readWSDL(wsdlLocator); - } - public URI getLocation() { return location; } - private static class ResourceWSDLLocator implements WSDLLocator { - - private final String wsdlLocation; - private final ClassLoader classLoader; - private final ClassLoader classLoader2; - - private String latestImportURI; - - public ResourceWSDLLocator(String wsdlLocation, ClassLoader classLoader, ClassLoader classLoader2) { - this.wsdlLocation = wsdlLocation; - this.classLoader = classLoader; - this.classLoader2 = classLoader2; - } - - public InputSource getBaseInputSource() { - InputStream wsdlInputStream = classLoader.getResourceAsStream(wsdlLocation); - if (wsdlInputStream == null) { - wsdlInputStream = classLoader2.getResourceAsStream(wsdlLocation); - if (wsdlInputStream == null) { - throw new IllegalStateException("wsdl not found in classloader at " + wsdlLocation); - } - } - return new InputSource(wsdlInputStream); - } - - public String getBaseURI() { - return wsdlLocation; - } - - public InputSource getImportInputSource(String parentLocation, String relativeLocation) { - URI parentURI = URI.create(parentLocation); - latestImportURI = parentURI.resolve(relativeLocation).toString(); - InputStream importInputStream = classLoader.getResourceAsStream(latestImportURI); - if (importInputStream == null) { - throw new IllegalStateException("wsdl not found in classloader at " + latestImportURI); - } - InputSource inputSource = new InputSource(importInputStream); - inputSource.setSystemId(getLatestImportURI()); - return inputSource; + private void readObject(ObjectInputStream in) throws IOException { + try { + in.defaultReadObject(); + } catch (ClassNotFoundException e) { + throw (IOException)new IOException("Could not deserialize!").initCause(e); } - - public String getLatestImportURI() { - return latestImportURI; + try { + WSDLFactory wsdlFactory = WSDLFactory.newInstance(); + wsdlWriter = wsdlFactory.newWSDLWriter(); + } catch (WSDLException e) { + throw (IOException)new IOException("Could not construct transient wsdlWriter").initCause(e); } } - } Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ServiceInfo.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ServiceInfo.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ServiceInfo.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ServiceInfo.java Mon Apr 11 19:16:00 2005 @@ -18,6 +18,7 @@ import java.io.Serializable; import java.util.List; +import java.util.Map; import org.apache.axis.description.JavaServiceDesc; @@ -27,11 +28,14 @@ public class ServiceInfo implements Serializable { private final JavaServiceDesc serviceDesc; /** List of javax.xml.rpc.handler.HandlerInfo objects */ - private final List hanlderInfos; + private final List handlerInfos; - public ServiceInfo(JavaServiceDesc serviceDesc, List hanlderInfos) { + private final Map wsdlMap; + + public ServiceInfo(JavaServiceDesc serviceDesc, List handlerInfos, Map wsdlMap) { this.serviceDesc = serviceDesc; - this.hanlderInfos = hanlderInfos; + this.handlerInfos = handlerInfos; + this.wsdlMap = wsdlMap; } public JavaServiceDesc getServiceDesc() { @@ -39,8 +43,12 @@ } /** List of javax.xml.rpc.handler.HandlerInfo objects */ - public List getHanlderInfos() { - return hanlderInfos; + public List getHandlerInfos() { + return handlerInfos; + } + + public Map getWsdlMap() { + return wsdlMap; } } Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java Mon Apr 11 19:16:00 2005 @@ -18,6 +18,7 @@ import java.io.InputStream; import java.net.URI; import java.util.HashMap; +import java.util.Map; import javax.xml.namespace.QName; import org.apache.axis.constants.Style; @@ -88,11 +89,12 @@ SOAPService service = new SOAPService(null, provider, null); service.setServiceDescription(sd); service.setOption("className","org.apache.geronimo.axis.testData.echosample.EchoBean"); - String wsdlURL = "echo.wsdl"; + URI wsdlURL = new URI("echo.wsdl"); URI location = new URI(serviceDesc.getEndpointURL()); + Map wsdlMap = new HashMap(); AxisWebServiceContainer continaer = - new AxisWebServiceContainer(location, wsdlURL, service, cl); + new AxisWebServiceContainer(location, wsdlURL, service, wsdlMap, cl); InputStream in = cl.getResourceAsStream("echoString-req.txt"); Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original) +++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Mon Apr 11 19:16:00 2005 @@ -48,6 +48,7 @@ import org.apache.geronimo.axis.builder.PortInfo; import org.apache.geronimo.axis.builder.WSDescriptorParser; +import org.apache.geronimo.axis.builder.SchemaInfoBuilder; import org.apache.geronimo.common.DeploymentException; import org.apache.geronimo.deployment.service.ServiceConfigBuilder; import org.apache.geronimo.deployment.util.DeploymentUtil; Modified: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java?view=diff&r1=161005&r2=161006 ============================================================================== --- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java (original) +++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java Mon Apr 11 19:16:00 2005 @@ -20,12 +20,12 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.URISyntaxException; -import java.util.Map; import java.util.HashMap; +import java.util.Map; import javax.servlet.Servlet; import javax.servlet.ServletConfig; -import javax.servlet.ServletException; import javax.servlet.ServletContext; +import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; @@ -63,7 +63,7 @@ // This is the guy the WebServiceContainer should invoke req.setAttribute(WebServiceContainer.POJO_INSTANCE, pojo); - if (request.getParameter("wsdl") != null || request.getParameter("WSDL") != null) { + if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null) { try { service.getWsdl(request, response); } catch (IOException e) {