Package org.apache.geronimo.jaxws

Examples of org.apache.geronimo.jaxws.PortInfo


        Map portInfoMap = (Map) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = (PortInfo) portInfoMap.get(ejbName);
        if (portInfo == null) {
            // not ours
            return false;
        }
      
        String beanClassName = (String)targetGBean.getAttribute("ejbClass");
        // verify that the class is loadable and is a JAX-WS web service
        Class beanClass = loadClass(beanClassName, classLoader);
        if (!JAXWSUtils.isWebService(beanClass)) {
            return false;
        }
       
        String location = portInfo.getLocation();
        if (location == null) {                  
            throw new DeploymentException("Endpoint URI for EJB WebService is missing");
        }

        LOG.info("Configuring EJB JAX-WS Web Service: " + ejbName + " at " + location);
View Full Code Here


                ServletMappingType servletMapping = webApp.addNewServletMapping();
                servletMapping.addNewServletName().setStringValue(service.getName());
                servletMapping.addNewUrlPattern().setStringValue(location);

                // map service
                PortInfo portInfo = new PortInfo();
                portInfo.setLocation(contextRoot + location);
                map.put(service.getName(), portInfo);
            }
        } else {
            // web.xml present, examine servlet classes and check for web
            // services
            for (ServletType servletType : servletTypes) {
                String servletName = servletType.getServletName().getStringValue().trim();
                if (servletType.isSetServletClass()) {
                    String servletClassName = servletType.getServletClass().getStringValue().trim();
                    try {
                        Class servletClass = classLoader.loadClass(servletClassName);
                        if (JAXWSUtils.isWebService(servletClass)) {
                            LOG.debug("Found POJO Web Service: " + servletName);
                            PortInfo portInfo = new PortInfo();
                            map.put(servletName, portInfo);
                        }
                    } catch (Exception e) {
                        throw new DeploymentException("Failed to load servlet class "
                                                      + servletClassName, e);
                    }
                }
            }

            // update web service locations
            for (Map.Entry entry : map.entrySet()) {
                String servletName = (String) entry.getKey();
                PortInfo portInfo = (PortInfo) entry.getValue();

                String location = (String) correctedPortLocations.get(servletName);
                if (location != null) {
                    portInfo.setLocation(location);
                }
            }
        }
    }
View Full Code Here

            // full web.xml, just examine all servlet entries for web services
           
            ServletType[] servletTypes = webApp.getServletArray();
            for (ServletType servletType : servletTypes) {
                String servletName = servletType.getServletName().getStringValue().trim();
                PortInfo portInfo = getPortInfo(servletType, classLoader, portLocations);
                if (portInfo != null) {
                    LOG.debug("Found POJO Web Service: " + servletName);
                    map.put(servletName, portInfo);
                }
            }
           
        } else {
            // partial web.xml, discover all web service classes
           
            Map<String, List<String>> classServletMap = createClassServetMap(webApp);
            List<Class> services = WARWebServiceFinder.discoverWebServices(module.getModuleFile(), false, classLoader);
            String contextRoot = ((WebModule) module).getContextRoot();
            for (Class service : services) {
                // skip interfaces and such
                if (!JAXWSUtils.isWebService(service)) {
                    continue;
                }

                LOG.debug("Discovered POJO Web Service class: " + service.getName());
               
                List<String> mappedServlets = classServletMap.get(service.getName());
                if (mappedServlets == null) {
                    // no <servlet/> entry, add one
                   
                    LOG.debug("POJO Web Service class " + service.getName() + " is not mapped to any servlet");
                   
                    ServletType servlet = webApp.addNewServlet();
                    servlet.addNewServletName().setStringValue(service.getName());
                    servlet.addNewServletClass().setStringValue(service.getName());
                   
                    String location = (String)portLocations.get(service.getName());
                    if (location == null) {
                        // add new <servlet-mapping/> element
                        location = "/" + JAXWSUtils.getServiceName(service);
                        ServletMappingType servletMapping = webApp.addNewServletMapping();
                        servletMapping.addNewServletName().setStringValue(service.getName());
                        servletMapping.addNewUrlPattern().setStringValue(location);
                    } else {
                        // weird, there was no servlet entry for this class but
                        // servlet-mapping exists
                        LOG.warn("Found <servlet-mapping> but corresponding <servlet> was not defined");
                    }

                    // map service
                    PortInfo portInfo = new PortInfo();
                    portInfo.setLocation(contextRoot + location);
                    map.put(service.getName(), portInfo);
                } else {
                    // found at least one mapped <servlet/> entry
                    for (String servlet : mappedServlets) {
                        LOG.debug("POJO Web Service class " + service.getName() + " is mapped to " + servlet + " servlet");
                        PortInfo portInfo = createPortInfo(servlet, portLocations);
                        map.put(servlet, portInfo);
                    }
                }               
            }
           
            // double check servlets in case we missed something
            ServletType[] servletTypes = webApp.getServletArray();
            for (ServletType servletType : servletTypes) {
                String servletName = servletType.getServletName().getStringValue().trim();
                if (map.get(servletName) == null) {
                    PortInfo portInfo = getPortInfo(servletType, classLoader, portLocations);
                    if (portInfo != null) {
                        LOG.debug("Found POJO Web Service: " + servletName);
                        map.put(servletName, portInfo);
                    }
                }
View Full Code Here

    }
       
    private PortInfo getPortInfo(ServletType servletType,
                                 ClassLoader classLoader,
                                 Map portLocations) throws DeploymentException {
        PortInfo portInfo = null;
        if (servletType.isSetServletClass()) {
            String servletClassName = servletType.getServletClass().getStringValue().trim();
            try {
                Class servletClass = classLoader.loadClass(servletClassName);
                if (JAXWSUtils.isWebService(servletClass)) {     
View Full Code Here

        }
        return portInfo;
    }
   
    private PortInfo createPortInfo(String servlet, Map portLocations) {
        PortInfo portInfo = new PortInfo();           
        String location = (String)portLocations.get(servlet);
        if (location != null) {
            portInfo.setLocation(location);
        }       
        return portInfo;
    }
View Full Code Here

        Map portInfoMap = (Map) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = (PortInfo) portInfoMap.get(servletName);
        if (portInfo == null) {
            // not ours
            return false;
        }

        // verify that the class is loadable and is a JAX-WS web service
        ClassLoader classLoader = context.getClassLoader();
        Class servletClass = loadClass(servletClassName, classLoader);
        if (!JAXWSUtils.isWebService(servletClass)) {
            return false;
        }
       
        Map componentContext = null;
        Holder moduleHolder = null;
        try {
            GBeanData moduleGBean = context.getGBeanInstance(context.getModuleName());
            componentContext = (Map)moduleGBean.getAttribute("componentContext");
            moduleHolder = (Holder)moduleGBean.getAttribute("holder");
        } catch (GBeanNotFoundException e) {
            LOG.warn("ModuleGBean not found. JNDI resource injection will not work.");
        }

        AnnotationHolder serviceHolder =
            (AnnotationHolder)sharedContext.get(WebServiceContextAnnotationHelper.class.getName());
        if (serviceHolder == null) {
            serviceHolder = new AnnotationHolder(moduleHolder);           
            sharedContext.put(WebServiceContextAnnotationHelper.class.getName(), serviceHolder);
        }
        WebServiceContextAnnotationHelper.addWebServiceContextInjections(serviceHolder, servletClass);
       
        String location = portInfo.getLocation();
        LOG.info("Configuring JAX-WS Web Service: " + servletName + " at " + location);

        AbstractName containerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(), getContainerFactoryGBeanInfo().getName(), NameFactory.GERONIMO_SERVICE);
        GBeanData containerFactoryData = new GBeanData(containerFactoryName, getContainerFactoryGBeanInfo());
        containerFactoryData.setAttribute("portInfo", portInfo);
View Full Code Here

        Map portInfoMap = (Map) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = (PortInfo) portInfoMap.get(ejbName);
        if (portInfo == null) {
            // not ours
            return false;
        }
      
        String beanClassName = (String)targetGBean.getAttribute("ejbClass");
        // verify that the class is loadable and is a JAX-WS web service
        Class beanClass = loadClass(beanClassName, classLoader);
        if (!JAXWSUtils.isWebService(beanClass)) {
            return false;
        }
       
        String location = portInfo.getLocation();
        if (location == null) {                  
            throw new DeploymentException("Endpoint URI for EJB WebService is missing");
        }

        LOG.info("Configuring EJB JAX-WS Web Service: " + ejbName + " at " + location);
View Full Code Here

                ServletMappingType servletMapping = webApp.addNewServletMapping();
                servletMapping.addNewServletName().setStringValue(service.getName());
                servletMapping.addNewUrlPattern().setStringValue(location);

                // map service
                PortInfo portInfo = new PortInfo();
                portInfo.setLocation(contextRoot + location);
                map.put(service.getName(), portInfo);
            }
        } else {
            // web.xml present, examine servlet classes and check for web
            // services
            for (ServletType servletType : servletTypes) {
                String servletName = servletType.getServletName().getStringValue().trim();
                if (servletType.isSetServletClass()) {
                    String servletClassName = servletType.getServletClass().getStringValue().trim();
                    try {
                        Class servletClass = classLoader.loadClass(servletClassName);
                        if (JAXWSUtils.isWebService(servletClass)) {
                            LOG.debug("Found POJO Web Service: " + servletName);
                            PortInfo portInfo = new PortInfo();
                            map.put(servletName, portInfo);
                        }
                    } catch (Exception e) {
                        throw new DeploymentException("Failed to load servlet class "
                                                      + servletClassName, e);
                    }
                }
            }

            // update web service locations
            for (Map.Entry entry : map.entrySet()) {
                String servletName = (String) entry.getKey();
                PortInfo portInfo = (PortInfo) entry.getValue();

                String location = (String) correctedPortLocations.get(servletName);
                if (location != null) {
                    portInfo.setLocation(location);
                }
            }
        }
    }
View Full Code Here

    }
   
    public void testGetWSDL() throws Exception {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();

        PortInfo portInfo = new PortInfo();
        portInfo.setLocation("/axis2/HelloWorld");
        portInfo.setServiceEndpointInterfaceName("org.apache.geronimo.axis2.testdata.simple.HelloWorld");

        Axis2Request req = new Axis2Request(504,
                "text/xml; charset=utf-8",
                null,
                Request.GET,
View Full Code Here

         
            System.out.println(envelope.toString());
           
            request = new ByteArrayInputStream(envelope.toString().getBytes("UTF-8"));
         
            PortInfo portInfo = new PortInfo();
            portInfo.setLocation("/axis2/" + serviceName);
           
            File wsdlFile = new File(RESOURCE_PATH + wsdl);
            portInfo.setWsdlFile(wsdlFile.toURL().toString());

            try {
                Axis2Request req = new Axis2Request(504,
                        "text/xml; charset=utf-8",
                        request,
View Full Code Here

TOP

Related Classes of org.apache.geronimo.jaxws.PortInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.