Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 98451 invoked from network); 26 Feb 2007 20:18:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2007 20:18:57 -0000 Received: (qmail 75891 invoked by uid 500); 26 Feb 2007 20:19:05 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 75842 invoked by uid 500); 26 Feb 2007 20:19:05 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 75831 invoked by uid 99); 26 Feb 2007 20:19:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 12:19:05 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 12:18:54 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id BF62F1A981A; Mon, 26 Feb 2007 12:18:34 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r511987 - in /geronimo/server/trunk: assemblies/geronimo-jetty6-jee5/src/main/var/config/ assemblies/geronimo-tomcat6-jee5/src/main/var/config/ configs/axis2-deployer/src/plan/ configs/axis2/ configs/openejb-deployer/src/plan/ modules/geron... Date: Mon, 26 Feb 2007 20:18:34 -0000 To: scm@geronimo.apache.org From: dims@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070226201834.BF62F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dims Date: Mon Feb 26 12:18:33 2007 New Revision: 511987 URL: http://svn.apache.org/viewvc?view=rev&rev=511987 Log: Fix for GERONIMO-2876 - Initial web service EJB support for Axis2 Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java Removed: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java Modified: geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml geronimo/server/trunk/configs/axis2-deployer/src/plan/plan.xml geronimo/server/trunk/configs/axis2/pom.xml geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java geronimo/server/trunk/modules/geronimo-axis2/pom.xml geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java Modified: geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml (original) +++ geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml Mon Feb 26 12:18:33 2007 @@ -157,11 +157,21 @@ - - - + + + ?name=JettyWebContainer + + + + + org.apache.geronimo.configs + jetty6 + car + + + + + Modified: geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml (original) +++ geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml Mon Feb 26 12:18:33 2007 @@ -164,10 +164,21 @@ - - + + + ?name=TomcatWebContainer + + + + + org.apache.geronimo.configs + tomcat6 + car + + + + + - - - - - - - - - - - - org.apache.geronimo.configs - axis2 - car - - - - - - - - http://java.sun.com/xml/ns/javaee - - - - - org.apache.geronimo.configs - axis2 - car - - - - - - Axis2Builder - - - - - http://java.sun.com/xml/ns/javaee - - - - - org.apache.geronimo.modules - geronimo-axis2 - jar - - - - - - Axis2Builder - - - - - + + + + + + + + + + + + + org.apache.geronimo.configs + axis2 + car + + + + + + + + http://java.sun.com/xml/ns/javaee + + + + + org.apache.geronimo.configs + axis2 + car + + + + + + Axis2Builder + + + + + http://java.sun.com/xml/ns/javaee + + + + + org.apache.geronimo.modules + geronimo-axis2 + jar + + + + + + Axis2Builder + + + + + + ?name=WebContainer + + + Axis2Builder + + + Axis2WebServiceEJBLinkTemplate + + + + + + Modified: geronimo/server/trunk/configs/axis2/pom.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/axis2/pom.xml?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/configs/axis2/pom.xml (original) +++ geronimo/server/trunk/configs/axis2/pom.xml Mon Feb 26 12:18:33 2007 @@ -44,6 +44,13 @@ org.apache.geronimo.configs + openejb + ${version} + car + + + + org.apache.geronimo.configs webservices-common car ${version} @@ -171,8 +178,8 @@ annogen - org.apache.woden - woden + org.apache.woden + woden javax.xml.bind Modified: geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml (original) +++ geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml Mon Feb 26 12:18:33 2007 @@ -28,6 +28,9 @@ CXFModuleBuilderExtension + + Axis2ModuleBuilderExtension + SecurityBuilder Modified: geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java (original) +++ geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java Mon Feb 26 12:18:33 2007 @@ -17,6 +17,24 @@ package org.apache.geronimo.axis2.builder; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.net.URI; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.jar.JarFile; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.transform.stream.StreamSource; + import org.apache.axis2.jaxws.javaee.HandlerChainsType; import org.apache.axis2.jaxws.javaee.PortComponentType; import org.apache.axis2.jaxws.javaee.ServiceImplBeanType; @@ -28,8 +46,6 @@ import org.apache.geronimo.axis2.client.Axis2ServiceReference; import org.apache.geronimo.common.DeploymentException; import org.apache.geronimo.deployment.DeploymentContext; -import org.apache.geronimo.deployment.util.DeploymentUtil; -import org.apache.geronimo.gbean.AbstractName; import org.apache.geronimo.gbean.GBeanData; import org.apache.geronimo.gbean.GBeanInfo; import org.apache.geronimo.gbean.GBeanInfoBuilder; @@ -41,37 +57,14 @@ import org.apache.geronimo.jaxws.builder.EndpointInfoBuilder; import org.apache.geronimo.jaxws.builder.JAXWSServiceBuilder; import org.apache.geronimo.jaxws.client.EndpointInfo; -import org.apache.geronimo.kernel.GBeanNotFoundException; import org.apache.geronimo.kernel.repository.Environment; import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType; import org.apache.geronimo.xbeans.javaee.ServiceRefHandlerChainsType; -import javax.wsdl.Definition; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.transform.stream.StreamSource; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.net.URI; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.jar.JarFile; - public class Axis2Builder extends JAXWSServiceBuilder { private static final Log log = LogFactory.getLog(Axis2Builder.class); - private Definition wsdlDefinition = null; - public Axis2Builder(Environment defaultEnviroment) { super(defaultEnviroment); } @@ -120,28 +113,7 @@ for (PortComponentType port : desc.getPortComponent()) { - org.apache.geronimo.axis2.PortInfo portInfo = new org.apache.geronimo.axis2.PortInfo(); - - if(wsdlFile != null && !wsdlFile.equals("")){ - URL wsdlURL = DeploymentUtil.createJarURL(moduleFile, wsdlFile); - InputStream wsdlStream = wsdlURL.openStream(); - if(wsdlStream == null){ - throw new DeploymentException("unable to read descriptor "+wsdlURL); - }else { - try { - WSDLFactory factory = WSDLFactory.newInstance(); - WSDLReader reader = factory.newWSDLReader(); - reader.setFeature("javax.wsdl.importDocuments", true); - reader.setFeature("javax.wsdl.verbose", false); - wsdlDefinition = reader.readWSDL(wsdlURL.toString()); - portInfo.setWsdlDefinition(wsdlDefinition); - wsdlStream.close(); - } catch (RuntimeException e) { - throw new DeploymentException("invalid WSDL provided "+wsdlURL); - } - } - } - + PortInfo portInfo = new PortInfo(); String serviceLink = null; ServiceImplBeanType beanType = port.getServiceImplBean(); if (beanType.getEjbLink() != null) { @@ -224,7 +196,7 @@ Map portInfoMap = (Map) sharedContext.get(getKey()); if(portInfoMap != null && portInfoMap.get(servletName) != null){ - org.apache.geronimo.jaxws.PortInfo portInfo = (org.apache.geronimo.jaxws.PortInfo) portInfoMap.get(servletName); + PortInfo portInfo = (PortInfo) portInfoMap.get(servletName); processURLPattern(contextRoot, portInfo); } @@ -283,7 +255,7 @@ return in; } - private void processURLPattern(String contextRoot, org.apache.geronimo.jaxws.PortInfo portInfo) throws DeploymentException { + private void processURLPattern(String contextRoot, PortInfo portInfo) throws DeploymentException { //if the user specifies a url-pattern, set it here. String oldup = portInfo.getLocation(); if (oldup == null || oldup.length() == 0) { Modified: geronimo/server/trunk/modules/geronimo-axis2/pom.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/pom.xml?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/pom.xml (original) +++ geronimo/server/trunk/modules/geronimo-axis2/pom.xml Mon Feb 26 12:18:33 2007 @@ -43,6 +43,11 @@ org.apache.geronimo.modules + geronimo-openejb + ${version} + + + org.apache.geronimo.modules geronimo-transaction ${version} @@ -51,128 +56,126 @@ geronimo-jaxws ${version} - - com.sun.xml.bind - jaxb-xjc - 2.0.2 - - - com.sun.xml.bind - jaxb-impl - 2.0.2 - - - jsr173 - javax.xml - - - - - org.apache.axis2 - axis2-java2wsdl - - - org.apache.axis2 - axis2-kernel - - - org.apache.axis2 - axis2-adb - - - org.apache.axis2 - axis2-jaxws-api - - - org.apache.axis2 - axis2-metadata - - - org.apache.ws.commons.axiom - axiom-api - - - org.apache.ws.commons.axiom - axiom-impl - - - org.apache.ws.commons - XmlSchema - - - org.apache.neethi - neethi - - - commons-logging - commons-logging - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - - - commons-httpclient - commons-httpclient - - - commons-codec - commons-codec - - - stax - stax-api - - - javax.mail - mail - - - javax.activation - activation - - - xalan - xalan - - - xmlbeans - xbean - - - jaxen - jaxen - - - backport-util-concurrent - backport-util-concurrent - - - annogen - annogen - - - org.apache.woden - woden - - - javax.xml.bind - jaxb-api - + com.sun.xml.bind + jaxb-xjc + 2.0.2 + + + com.sun.xml.bind + jaxb-impl + 2.0.2 + + + jsr173 + javax.xml + + + + + org.apache.axis2 + axis2-java2wsdl + + + org.apache.axis2 + axis2-kernel + + + org.apache.axis2 + axis2-adb + + + org.apache.axis2 + axis2-jaxws-api + + + org.apache.axis2 + axis2-metadata + + + org.apache.ws.commons.axiom + axiom-api + + + org.apache.ws.commons.axiom + axiom-impl + + + org.apache.ws.commons + XmlSchema + + + org.apache.neethi + neethi + + + commons-logging + commons-logging + + + log4j + log4j + + + logkit + logkit + + + avalon-framework + avalon-framework + + + + + commons-httpclient + commons-httpclient + + + commons-codec + commons-codec + + + stax + stax-api + + + javax.mail + mail + + + javax.activation + activation + + + xalan + xalan + + + xmlbeans + xbean + + + jaxen + jaxen + + + backport-util-concurrent + backport-util-concurrent + + + annogen + annogen + + + org.apache.woden + woden + + + javax.xml.bind + jaxb-api + - Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original) +++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Mon Feb 26 12:18:33 2007 @@ -70,6 +70,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor; import org.apache.geronimo.jaxws.JNDIResolver; +import org.apache.geronimo.jaxws.PortInfo; import org.apache.geronimo.jaxws.ServerJNDIResolver; import org.apache.geronimo.jaxws.annotations.AnnotationException; import org.apache.geronimo.webservices.WebServiceContainer; @@ -85,7 +86,7 @@ private transient final ClassLoader classLoader; private final String endpointClassName; - private final PortInfo portInfo; + private final org.apache.geronimo.jaxws.PortInfo portInfo; private ConfigurationContext configurationContext; private String contextRoot = null; private Map servicesMap; @@ -94,6 +95,7 @@ private Object endpointInstance; private List chain; private AxisService service; + private URL configurationBaseUrl; public Axis2WebServiceContainer(PortInfo portInfo, String endpointClassName, @@ -103,13 +105,14 @@ this.classLoader = classLoader; this.endpointClassName = endpointClassName; this.portInfo = portInfo; + this.configurationBaseUrl = configurationBaseUrl; try { configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext(); configurationContext.setServicePath(portInfo.getLocation()); - if(portInfo.getWsdlDefinition() != null){ //WSDL Has been provided + if(portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")){ //WSDL file Has been provided AxisServiceGenerator serviceGen = new AxisServiceGenerator(); - service = serviceGen.getServiceFromWSDL(portInfo, endpointClassName, classLoader); + service = serviceGen.getServiceFromWSDL(portInfo, endpointClassName, configurationBaseUrl, classLoader); }else { //No WSDL, Axis2 will handle it. Is it ? service = AxisService.createService(endpointClassName, configurationContext.getAxisConfiguration(), JAXWSMessageReceiver.class); @@ -124,7 +127,7 @@ throw new RuntimeException(e); } jndiResolver = new ServerJNDIResolver(context); - } + } public void getWsdl(Request request, Response response) throws Exception { doService(request, response); @@ -303,11 +306,14 @@ } } if (uri.getQuery().startsWith("wsdl")) { - if(portInfo.getWsdlDefinition() != null){ - WSDLFactory factory = WSDLFactory.newInstance(); - WSDLWriter writer = factory.newWSDLWriter(); - writer.writeWSDL(portInfo.getWsdlDefinition(), response.getOutputStream()); - return; + if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) { //wsdl file has been provided + Definition wsdlDefinition = new AxisServiceGenerator().getWSDLDefition(portInfo, configurationBaseUrl, classLoader); + if(wsdlDefinition != null){ + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLWriter writer = factory.newWSDLWriter(); + writer.writeWSDL(wsdlDefinition, response.getOutputStream()); + return; + } }else { service.printWSDL(response.getOutputStream()); return; Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java (original) +++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainerFactoryGBean.java Mon Feb 26 12:18:33 2007 @@ -39,12 +39,12 @@ private static final Log log = LogFactory.getLog(Axis2WebServiceContainerFactoryGBean.class); private final ClassLoader classLoader; - private final org.apache.geronimo.axis2.PortInfo portInfo; + private final org.apache.geronimo.jaxws.PortInfo portInfo; private final String endpointClassName; private URL configurationBaseUrl; private Context context; - public Axis2WebServiceContainerFactoryGBean(org.apache.geronimo.axis2.PortInfo portInfo, + public Axis2WebServiceContainerFactoryGBean(org.apache.geronimo.jaxws.PortInfo portInfo, String endpointClassName, ClassLoader classLoader, Map componentContext, @@ -78,7 +78,7 @@ static { GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(Axis2WebServiceContainerFactoryGBean.class, NameFactory.GERONIMO_SERVICE); - infoBuilder.addAttribute("portInfo", org.apache.geronimo.axis2.PortInfo.class, true, true); + infoBuilder.addAttribute("portInfo", org.apache.geronimo.jaxws.PortInfo.class, true, true); infoBuilder.addAttribute("endpointClassName", String.class, true, true); infoBuilder.addAttribute("classLoader", ClassLoader.class, false); infoBuilder.addAttribute("componentContext", Map.class, true, true); Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java (original) +++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java Mon Feb 26 12:18:33 2007 @@ -18,9 +18,13 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.io.StringReader; import java.lang.reflect.Method; +import java.net.MalformedURLException; import java.net.URI; +import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -29,7 +33,9 @@ import javax.wsdl.Definition; import javax.wsdl.Port; import javax.wsdl.Service; +import javax.wsdl.WSDLException; import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; import javax.wsdl.xml.WSDLWriter; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; @@ -61,9 +67,9 @@ import org.apache.axis2.util.XMLUtils; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; +import org.apache.geronimo.jaxws.PortInfo; import org.apache.ws.commons.schema.XmlSchemaComplexType; import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaObject; import org.apache.ws.commons.schema.XmlSchemaParticle; import org.apache.ws.commons.schema.XmlSchemaSequence; import org.apache.ws.commons.schema.XmlSchemaType; @@ -81,12 +87,12 @@ super(); } - public AxisService getServiceFromWSDL(PortInfo portInfo, String endpointClassName, ClassLoader classLoader) throws Exception { + public AxisService getServiceFromWSDL(PortInfo portInfo, String endpointClassName, URL configurationBaseUrl, ClassLoader classLoader) throws Exception { WSDLToAxisServiceBuilder wsdlBuilder = null; WSDLFactory factory = WSDLFactory.newInstance(); WSDLWriter writer = factory.newWSDLWriter(); + Definition wsdlDefinition = getWSDLDefition(portInfo, configurationBaseUrl, classLoader); - Definition wsdlDefinition = portInfo.getWsdlDefinition(); ByteArrayOutputStream out = new ByteArrayOutputStream(); writer.writeWSDL(wsdlDefinition, out); String wsdlContent = out.toString(WSDL_ENCODING); //Will the Axis2 give us this information soon ? @@ -129,17 +135,17 @@ Class endPointClass = classLoader.loadClass(endpointClassName); Method[] classMethods = endPointClass.getMethods(); - for (Iterator opIterator = service.getOperations(); opIterator.hasNext();) { - AxisOperation operation = opIterator.next(); - operation.setMessageReceiver(JAXWSMessageReceiver.class.newInstance()); - - for (Method method : classMethods) { - String axisOpName = operation.getName().getLocalPart(); - if (method.getName().equals(axisOpName)) { - fillOperationInformation(method, operation, dbc); - } - } - } + for(Iterator opIterator = service.getOperations() ; opIterator.hasNext() ;){ + AxisOperation operation = opIterator.next(); + operation.setMessageReceiver(JAXWSMessageReceiver.class.newInstance()); + + for(Method method : classMethods){ + String axisOpName = operation.getName().getLocalPart(); + if(method.getName().equals(axisOpName)){ + fillOperationInformation(method, operation, dbc); + } + } + } dbc.setWebServiceAnnot(serviceAnnot); dbc.setWsdlDefinition(wsdlDefinition); @@ -155,56 +161,56 @@ } private void fillOperationInformation(Method method, AxisOperation operation, DescriptionBuilderComposite dbc) throws Exception{ - MethodDescriptionComposite mdc = new MethodDescriptionComposite(); - WebMethodAnnot webMethodAnnot = WebMethodAnnot.createWebMethodAnnotImpl(); - webMethodAnnot.setOperationName(method.getName()); - - if(operation.getStyle().equals(AxisOperation.STYLE_DOC)){ - fillDocOperationInfo(method, operation, dbc, mdc, webMethodAnnot); - }else if(operation.getStyle().equals(AxisOperation.STYLE_RPC)){ - throw new RuntimeException("Not Yet Implemented"); - } + MethodDescriptionComposite mdc = new MethodDescriptionComposite(); + WebMethodAnnot webMethodAnnot = WebMethodAnnot.createWebMethodAnnotImpl(); + webMethodAnnot.setOperationName(method.getName()); + + if(operation.getStyle().equals(AxisOperation.STYLE_DOC)){ + fillDocOperationInfo(method, operation, dbc, mdc, webMethodAnnot); + }else if(operation.getStyle().equals(AxisOperation.STYLE_RPC)){ + throw new RuntimeException("Not Yet Implemented"); + } } private void fillDocOperationInfo(Method method, AxisOperation operation, DescriptionBuilderComposite dbc, MethodDescriptionComposite mdc, WebMethodAnnot webMethodAnnot ) throws Exception{ mdc.setWebMethodAnnot(webMethodAnnot); mdc.setMethodName(method.getName()); - String MEP = operation.getMessageExchangePattern(); + String MEP = operation.getMessageExchangePattern(); - if (WSDLUtil.isInputPresentForMEP(MEP)) { - AxisMessage inAxisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); - if(inAxisMessage != null){ + if (WSDLUtil.isInputPresentForMEP(MEP)) { + AxisMessage inAxisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + if(inAxisMessage != null){ - XmlSchemaElement element = inAxisMessage.getSchemaElement(); - XmlSchemaType schemaType = element.getSchemaType(); + XmlSchemaElement element = inAxisMessage.getSchemaElement(); + XmlSchemaType schemaType = element.getSchemaType(); - if(schemaType instanceof XmlSchemaComplexType){ + if(schemaType instanceof XmlSchemaComplexType){ - XmlSchemaComplexType complexSchemaType = (XmlSchemaComplexType)element.getSchemaType(); - XmlSchemaParticle particle = complexSchemaType.getParticle(); + XmlSchemaComplexType complexSchemaType = (XmlSchemaComplexType)element.getSchemaType(); + XmlSchemaParticle particle = complexSchemaType.getParticle(); // TODO: What if we have more than one complex type in a sequence ??? - if (particle instanceof XmlSchemaSequence) { - XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; - Iterator iterator = xmlSchemaSequence.getItems().getIterator(); + if (particle instanceof XmlSchemaSequence) { + XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; + Iterator iterator = xmlSchemaSequence.getItems().getIterator(); - while (iterator.hasNext()) { - XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next(); - XmlSchemaType innerElementSchemaType = innerElement.getSchemaType(); + while (iterator.hasNext()) { + XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next(); + XmlSchemaType innerElementSchemaType = innerElement.getSchemaType(); - if(!(innerElementSchemaType instanceof XmlSchemaComplexType)){ - element = innerElement; - break; - }else { - XmlSchemaComplexType innerComplexSchemaType = (XmlSchemaComplexType)innerElementSchemaType; - XmlSchemaParticle innerParticle = innerComplexSchemaType.getParticle(); - XmlSchemaSequence innerXmlSchemaSequence = (XmlSchemaSequence) innerParticle; - iterator = innerXmlSchemaSequence.getItems().getIterator(); - } - } - } - } + if(!(innerElementSchemaType instanceof XmlSchemaComplexType)){ + element = innerElement; + break; + }else { + XmlSchemaComplexType innerComplexSchemaType = (XmlSchemaComplexType)innerElementSchemaType; + XmlSchemaParticle innerParticle = innerComplexSchemaType.getParticle(); + XmlSchemaSequence innerXmlSchemaSequence = (XmlSchemaSequence) innerParticle; + iterator = innerXmlSchemaSequence.getItems().getIterator(); + } + } + } + } ParameterDescriptionComposite pdc = new ParameterDescriptionComposite(); WebParamAnnot webParamAnnot = WebParamAnnot.createWebParamAnnotImpl(); @@ -220,46 +226,46 @@ } mdc.addParameterDescriptionComposite(pdc); - } - } + } + } - if (WSDLUtil.isOutputPresentForMEP(MEP)) { - AxisMessage outAxisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); + if (WSDLUtil.isOutputPresentForMEP(MEP)) { + AxisMessage outAxisMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); - if(outAxisMessage != null){ + if(outAxisMessage != null){ - if(!method.getReturnType().toString().equals("void")){ - mdc.setReturnType(method.getReturnType().toString().split(" ")[1]); + if(!method.getReturnType().toString().equals("void")){ + mdc.setReturnType(method.getReturnType().toString().split(" ")[1]); - XmlSchemaElement element = outAxisMessage.getSchemaElement(); - XmlSchemaType schemaType = element.getSchemaType(); + XmlSchemaElement element = outAxisMessage.getSchemaElement(); + XmlSchemaType schemaType = element.getSchemaType(); - if(schemaType instanceof XmlSchemaComplexType){ + if(schemaType instanceof XmlSchemaComplexType){ - XmlSchemaComplexType complexSchemaType = (XmlSchemaComplexType)element.getSchemaType(); - XmlSchemaParticle particle = complexSchemaType.getParticle(); + XmlSchemaComplexType complexSchemaType = (XmlSchemaComplexType)element.getSchemaType(); + XmlSchemaParticle particle = complexSchemaType.getParticle(); -// TODO: What if we have more than one complex type in a sequence ??? - if (particle instanceof XmlSchemaSequence) { - XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; - Iterator iterator = xmlSchemaSequence.getItems().getIterator(); +// TODO: What if we have more than one complex type in a sequence ??? + if (particle instanceof XmlSchemaSequence) { + XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle; + Iterator iterator = xmlSchemaSequence.getItems().getIterator(); - while (iterator.hasNext()) { - XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next(); - XmlSchemaType innerElementSchemaType = innerElement.getSchemaType(); + while (iterator.hasNext()) { + XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next(); + XmlSchemaType innerElementSchemaType = innerElement.getSchemaType(); - if(!(innerElementSchemaType instanceof XmlSchemaComplexType)){ - element = innerElement; - break; - }else { - XmlSchemaComplexType innerComplexSchemaType = (XmlSchemaComplexType)innerElementSchemaType; - XmlSchemaParticle innerParticle = innerComplexSchemaType.getParticle(); - XmlSchemaSequence innerXmlSchemaSequence = (XmlSchemaSequence) innerParticle; - iterator = innerXmlSchemaSequence.getItems().getIterator(); - } - } - } - } + if(!(innerElementSchemaType instanceof XmlSchemaComplexType)){ + element = innerElement; + break; + }else { + XmlSchemaComplexType innerComplexSchemaType = (XmlSchemaComplexType)innerElementSchemaType; + XmlSchemaParticle innerParticle = innerComplexSchemaType.getParticle(); + XmlSchemaSequence innerXmlSchemaSequence = (XmlSchemaSequence) innerParticle; + iterator = innerXmlSchemaSequence.getItems().getIterator(); + } + } + } + } WebResultAnnot webResult = WebResultAnnot.createWebResultAnnotImpl(); webResult.setName(element.getName()); @@ -268,18 +274,17 @@ ResponseWrapperAnnot responseWrap = ResponseWrapperAnnot.createResponseWrapperAnnotImpl(); responseWrap.setClassName(getWrapperClassName(outAxisMessage.getElementQName())); mdc.setResponseWrapperAnnot(responseWrap); - } - - } - } + } + } + } - List faultMessages = operation.getFaultMessages(); - if(faultMessages != null){//TODO Implement it + List faultMessages = operation.getFaultMessages(); + if(faultMessages != null){//TODO Implement it - } + } - mdc.setWebMethodAnnot(webMethodAnnot); - dbc.addMethodDescriptionComposite(mdc); + mdc.setWebMethodAnnot(webMethodAnnot); + dbc.addMethodDescriptionComposite(mdc); } //TODO: Has to verify how JAXB default class wrapper class generation logic @@ -334,5 +339,59 @@ composite.setWsdlDefinition(testMap); return composite; } + } + + protected Definition getWSDLDefition(PortInfo portInfo, URL configurationBaseUrl, ClassLoader classLoader) throws IOException, WSDLException { + String wsdlFile = portInfo.getWsdlFile(); + Definition wsdlDefinition = null; + + if(wsdlFile == null || wsdlFile.equals("")) + return null; + else { + URL wsdlURL = getWsdlURL(wsdlFile, configurationBaseUrl, classLoader); + InputStream wsdlStream; + try { + wsdlStream = wsdlURL.openStream(); + if(wsdlStream == null){ + throw new IOException("unable to read descriptor " + wsdlURL); + } + else { + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + reader.setFeature("javax.wsdl.verbose", false); + wsdlDefinition = reader.readWSDL(wsdlURL.toString()); + wsdlStream.close(); + } + } catch (RuntimeException e) { + throw new RuntimeException("invalid WSDL provided " + wsdlURL); + } + return wsdlDefinition; + } + } + + private URL getWsdlURL(String wsdlFile, URL configurationBaseUrl, ClassLoader classLoader) { + URL wsdlURL = null; + if (wsdlFile != null) { + + try { + wsdlURL = new URL(wsdlFile); + } catch (MalformedURLException e) { + // Not a URL, try as a resource + wsdlURL = classLoader.getResource("/" + wsdlFile); + + if (wsdlURL == null && configurationBaseUrl != null) { + // Cannot get it as a resource, try with + // configurationBaseUrl + try { + wsdlURL = new URL(configurationBaseUrl.toString() + + wsdlFile); + } catch (MalformedURLException ee) { + // ignore + } + } + } + } + return wsdlURL; } } Added: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java?view=auto&rev=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java (added) +++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/EJBWebServiceGBean.java Mon Feb 26 12:18:33 2007 @@ -0,0 +1,127 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis2; + +import java.net.URL; + +import javax.naming.Context; + +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.GBeanLifecycle; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.jaxws.PortInfo; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.openejb.EjbDeployment; +import org.apache.geronimo.webservices.SoapHandler; + +public class EJBWebServiceGBean implements GBeanLifecycle { + + private SoapHandler soapHandler; + private String location; + + public EJBWebServiceGBean(EjbDeployment ejbDeploymentContext, + PortInfo portInfo, + Kernel kernel, + URL configurationBaseUrl, + SoapHandler soapHandler, + String securityRealmName, + String realmName, + String transportGuarantee, + String authMethod, + String[] virtualHosts) throws Exception { + if (ejbDeploymentContext == null || soapHandler == null || portInfo == null) { + return; + } + + this.location = portInfo.getLocation(); + + assert this.location != null : "null location received"; + + String beanClassName = ejbDeploymentContext.getBeanClass().getName(); + Context context = ejbDeploymentContext.getComponentContext(); + + ClassLoader classLoader = ejbDeploymentContext.getClassLoader(); + + //TODO: need to invoke the EJB container and forward the call to the EJB container. + + Axis2WebServiceContainer container = + new Axis2WebServiceContainer(portInfo, beanClassName, classLoader, context, configurationBaseUrl); + + if (soapHandler != null) { + soapHandler.addWebService(this.location, + virtualHosts, + container, + securityRealmName, + realmName, + transportGuarantee, + authMethod, + classLoader); + } + + } + + public void doStart() throws Exception { + } + + public void doStop() throws Exception { + if (this.soapHandler != null) { + this.soapHandler.removeWebService(this.location); + } + } + + public void doFail() { + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(EJBWebServiceGBean.class, EJBWebServiceGBean.class, NameFactory.WEB_SERVICE_LINK); + + infoFactory.addReference("EjbDeployment", EjbDeployment.class); + infoFactory.addAttribute("portInfo", PortInfo.class, true); + infoFactory.addAttribute("kernel", Kernel.class, false); + infoFactory.addAttribute("configurationBaseUrl", URL.class, true); + infoFactory.addAttribute("securityRealmName", String.class, true); + infoFactory.addAttribute("realmName", String.class, true); + infoFactory.addAttribute("transportGuarantee", String.class, true); + infoFactory.addAttribute("authMethod", String.class, true); + infoFactory.addAttribute("virtualHosts", String[].class, true); + infoFactory.addReference("WebServiceContainer", SoapHandler.class); + + infoFactory.setConstructor(new String[]{ + "EjbDeployment", + "portInfo", + "kernel", + "configurationBaseUrl", + "WebServiceContainer", + "securityRealmName", + "realmName", + "transportGuarantee", + "authMethod", + "virtualHosts" + }); + + + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } + +} Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java?view=diff&rev=511987&r1=511986&r2=511987 ============================================================================== --- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java (original) +++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java Mon Feb 26 12:18:33 2007 @@ -17,16 +17,12 @@ package org.apache.geronimo.axis2; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.util.HashMap; -import javax.wsdl.Definition; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; - +import org.apache.geronimo.jaxws.PortInfo; import org.apache.geronimo.webservices.WebServiceContainer.Request; public class Axis2WebServiceContainerTest extends Axis2AbstractTestCase { @@ -48,9 +44,7 @@ PortInfo portInfo = new PortInfo(); portInfo.setLocation("servlet"); - File file = new File(getTestFile("src/test/resources/"+wsdlFile)); - portInfo.setWsdlDefinition(readWSDL(file.toURL().toString())); - + try { Axis2Request req = new Axis2Request(504, "text/xml; charset=utf-8", @@ -70,7 +64,7 @@ out.flush(); } catch(Throwable ex){ - ex.printStackTrace(); + ex.printStackTrace(); throw new Exception(ex.toString()); }finally { if (in != null) { @@ -81,15 +75,6 @@ } } } - } - - private Definition readWSDL(String url) throws Exception{ - WSDLFactory factory = WSDLFactory.newInstance(); - WSDLReader reader = factory.newWSDLReader(); - reader.setFeature("javax.wsdl.importDocuments", true); - reader.setFeature("javax.wsdl.verbose", false); - Definition wsdlDefinition = reader.readWSDL(url); - return wsdlDefinition; } protected void setUp() throws Exception {