Package org.apache.geronimo.jaxws

Examples of org.apache.geronimo.jaxws.PortInfo


            }           
            try {
                Class ejbClass = classLoader.loadClass(bean.ejbClass);
                if (JAXWSUtils.isWebService(ejbClass)) {
                    LOG.debug("Found EJB Web Service: " + bean.ejbName);
                    PortInfo portInfo = new PortInfo();
                    String location = (String) correctedPortLocations.get(bean.ejbName);
                    if (location == null) {
                        // set default location, i.e. /@WebService.serviceName/@WebService.name
                        location = "/" + JAXWSUtils.getServiceName(ejbClass) + "/" + JAXWSUtils.getName(ejbClass);
                    }
                    portInfo.setLocation(location);
                    map.put(bean.ejbName, portInfo);
                }
            } catch (Exception e) {
                throw new DeploymentException("Failed to load ejb class "
                                              + bean.ejbName, e);
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;
        }
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 location = portInfo.getLocation();
        if (location == null) {                  
            throw new DeploymentException("Endpoint URI for EJB WebService is missing");
        }

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

                    String serviceName = desc.getWebserviceDescriptionName().getStringValue();

                    for (PortComponentType port : desc.getPortComponentArray()) {

                        PortInfo portInfo = new PortInfo();
                        String serviceLink = null;
                        ServiceImplBeanType beanType = port.getServiceImplBean();
                        if (beanType.getEjbLink() != null) {
                            serviceLink = beanType.getEjbLink().getStringValue();
                        } else if (beanType.getServletLink().getStringValue() != null) {
                            serviceLink = beanType.getServletLink().getStringValue();
                        }
                        portInfo.setServiceLink(serviceLink);

                        if (port.getServiceEndpointInterface() != null) {
                            String sei = port.getServiceEndpointInterface().getStringValue();
                            portInfo.setServiceEndpointInterfaceName(sei);
                        }

                        String portName = port.getPortComponentName().getStringValue();
                        portInfo.setPortName(portName);

                        portInfo.setProtocolBinding(port.getProtocolBinding());
                        portInfo.setServiceName(serviceName);
                        portInfo.setWsdlFile(wsdlFile);

                        if (port.getEnableMtom() != null) {
                            portInfo.setEnableMTOM(port.getEnableMtom().getBooleanValue());
                        }

                        //TODO: There can be a better method than this :)
                        if(port.getHandlerChains() != null){
                            StringBuffer chains = new StringBuffer("<handler-chains xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
                            chains.append(port.getHandlerChains().xmlText());
                            chains.append("</handler-chains>");
                            portInfo.setHandlersAsXML(chains.toString());
                        }

                        if (port.getWsdlPort() != null) {
                            portInfo.setWsdlPort(port.getWsdlPort().getQNameValue());
                        }

                        if (port.getWsdlService() != null) {
                            portInfo.setWsdlService(port.getWsdlService().getQNameValue());
                        }

                        String location = (String) correctedPortLocations.get(serviceLink);
                        portInfo.setLocation(location);

                        if (map == null) {
                            map = new HashMap<String, PortInfo>();
                        }
View Full Code Here

   
    //change the URL
    Map sharedContext = ((WebModule) module).getSharedContext();
        String contextRoot = ((WebModule) module).getContextRoot();
        Map portInfoMap = (Map) sharedContext.get(getKey());
        PortInfo portInfo;
       
        if(portInfoMap != null && portInfoMap.get(servletName) != null){
          portInfo = (PortInfo) portInfoMap.get(servletName);
        processURLPattern(contextRoot, portInfo);
       
            try {
                //hookup the wsgen tool here
                //check to see if we need to generate a wsdl file first
                Class clazz = context.getClassLoader().loadClass(seiClassName);
                if ((portInfo.getWsdlFile() == null || portInfo.getWsdlFile().equals(""))
                    && !JAXWSUtils.containsWsdlLocation(clazz, context.getClassLoader())) {
                    //let's use the wsgen tool to create a wsdl file
                    //todo: pass the correct bindingtype, use the default binding for now
                    String fileName = generateWsdl(module, seiClassName, SOAPBinding.SOAP11HTTP_BINDING, context, portInfo);
                    //set the wsdlFile property on portInfo.
                    portInfo.setWsdlFile(fileName);
                }
            } catch (ClassNotFoundException ex) {
                log.warn("cannot load class " + seiClassName);
            }
        }
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.toURI().toURL().toString());

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

            // full web.xml, just examine all servlet entries for web services

            List<Servlet> servletTypes = webApp.getServlet();
            for (Servlet servletType : servletTypes) {
                String servletName = servletType.getServletName().trim();
                PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
                if (portInfo != null) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Found POJO Web Service: {}", servletName);
                    }
                    servletNamePortInfoMap.put(servletName, portInfo);
                }
            }

        } else {
            // partial web.xml, discover all web service classes

            Map<String, List<String>> classServletMap = createClassServetMap(webApp);
            List<Class<?>> services = discoverWebServices(module);
            String contextRoot = (module).getContextRoot();
            for (Class<?> service : services) {
                // skip interfaces and such
                if (!JAXWSUtils.isWebService(service)) {
                    continue;
                }

                if (ignoredEJBWebServiceClassNames.contains(service.getName())) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Web service " + service.getClass().getName() + "  is ignored as it is also an EJB, it will exposed as an EJB Web Service ");
                    }
                    continue;
                }

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Discovered POJO Web Service class: {}", service.getName());
                }
                List<String> mappedServlets = classServletMap.get(service.getName());
                if (mappedServlets == null) {
                    // no <servlet/> entry, add one
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("POJO Web Service class {} is not mapped to any servlet", service.getName());
                    }
                    Servlet servlet = new Servlet();
                    servlet.setServletName(service.getName());
                    servlet.setServletClass(service.getName());
                    webApp.getServlet().add(servlet);

                    String location = portLocations.get(service.getName());
                    if (location == null) {
                        // add new <servlet-mapping/> element
                        location = "/" + JAXWSUtils.getServiceName(service);
                        ServletMapping servletMapping = new ServletMapping();
                        servletMapping.setServletName(service.getName());
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    } 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", location, service.getName());
                    }

                    // map service
                    PortInfo portInfo = new PortInfo();
                    portInfo.setLocation(contextRoot + location);
                    portInfo.setHandlerChainsInfo(annotationHandlerChainFinder.buildHandlerChainFromClass(service));
                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(service));
                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(service));
                    servletNamePortInfoMap.put(service.getName(), portInfo);
                } else {
                    // found at least one mapped <servlet/> entry
                    for (String servlet : mappedServlets) {
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("POJO Web Service class {} is mapped to {} servlet", service.getName(), servlet);
                        }
                        PortInfo portInfo = createPortInfo(servlet, portLocations);
                        portInfo.setWsdlService(JAXWSUtils.getServiceQName(service));
                        portInfo.setWsdlPort(JAXWSUtils.getPortQName(service));
                        servletNamePortInfoMap.put(servlet, portInfo);
                    }
                }
            }

            // double check servlets in case we missed something
            List<Servlet> servletTypes = webApp.getServlet();
            for (Servlet servletType : servletTypes) {
                String servletName = servletType.getServletName().trim();
                if (servletNamePortInfoMap.get(servletName) == null) {
                    PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
                    if (portInfo != null) {
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("Found POJO Web Service: {}", servletName);
                        }
                        servletNamePortInfoMap.put(servletName, portInfo);
View Full Code Here

            }
        }
    }

    private PortInfo getPortInfo(Servlet servletType, Bundle bundle, Map<String, String> portLocations) throws DeploymentException {
        PortInfo portInfo = null;
        if (servletType.getServletClass() != null) {
            String servletClassName = servletType.getServletClass().trim();
            try {
                Class<?> servletClass = bundle.loadClass(servletClassName);
                if (JAXWSUtils.isWebService(servletClass)) {
                    String servletName = servletType.getServletName().trim();
                    portInfo = createPortInfo(servletName, portLocations);
                    portInfo.setHandlerChainsInfo(annotationHandlerChainFinder.buildHandlerChainFromClass(servletClass));
                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(servletClass));
                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(servletClass));
                }
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("Failed to load servlet class " + servletClassName, e);
            }
        }
View Full Code Here

        }
        return portInfo;
    }

    private PortInfo createPortInfo(String servlet, Map<String, String> portLocations) {
        PortInfo portInfo = new PortInfo();
        String location = portLocations.get(servlet);
        if (location != null) {
            portInfo.setLocation(location);
        }
        return portInfo;
    }
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.