Examples of PortInfo


Examples of org.apache.geronimo.jaxws.PortInfo

                    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

Examples of org.apache.geronimo.jaxws.PortInfo

   
    //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

Examples of org.apache.geronimo.jaxws.PortInfo

    }

    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

Examples of org.apache.geronimo.jaxws.PortInfo

            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

Examples of org.apache.geronimo.jaxws.PortInfo

            // 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

Examples of org.apache.geronimo.jaxws.PortInfo

            }
        }
    }

    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

Examples of org.apache.geronimo.jaxws.PortInfo

        }
        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

Examples of org.apache.geronimo.jaxws.PortInfo

                            serviceLink = beanType.getEjbLink();
                        } else if (beanType.getServletLink() != null) {
                            serviceLink = beanType.getServletLink();
                        }

                        PortInfo portInfo = serviceLinkPortInfoMap.get(serviceLink);
                        if (portInfo == null) {
                            portInfo = new PortInfo();
                            portInfo.setServiceLink(serviceLink);
                            serviceLinkPortInfoMap.put(serviceLink, portInfo);
                        }

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

                        if (port.getPortComponentName() != null) {
                            portInfo.setPortName(port.getPortComponentName());
                        }

                        if (port.getProtocolBinding() != null) {
                            portInfo.setProtocolBinding(port.getProtocolBinding());
                        }

                        portInfo.setServiceName(serviceName);

                        if (wsdlFile != null) {
                            portInfo.setWsdlFile(wsdlFile);
                        }

                        if (port.getHandlerChains() != null) {
                            portInfo.setHandlerChainsInfo(handlerChainsInfoBuilder.build(port.getHandlerChains()));
                        }

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

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

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

                        Addressing addressing = port.getAddressing();
                        if (addressing != null) {
                            AddressingFeatureInfo addressingFeatureInfo = portInfo.getAddressingFeatureInfo();
                            if (addressingFeatureInfo == null) {
                                addressingFeatureInfo = new AddressingFeatureInfo();
                                portInfo.setAddressingFeatureInfo(addressingFeatureInfo);
                            }
                            if (addressing.getEnabled() != null) {
                                addressingFeatureInfo.setEnabled(addressing.getEnabled());
                            }
                            if (addressing.getRequired() != null) {
                                addressingFeatureInfo.setRequired(addressing.getRequired());
                            }
                            if (addressing.getResponses() != null) {
                                addressingFeatureInfo.setResponses(AddressingFeature.Responses.valueOf(addressing.getResponses().name()));
                            }
                        }

                        if (port.getEnableMtom() != null || port.getMtomThreshold() != null) {
                            MTOMFeatureInfo mtomFeatureInfo = portInfo.getMtomFeatureInfo();
                            if (mtomFeatureInfo == null) {
                                mtomFeatureInfo = new MTOMFeatureInfo();
                                portInfo.setMtomFeatureInfo(mtomFeatureInfo);
                            }
                            if (port.getEnableMtom() != null) {
                                mtomFeatureInfo.setEnabled(port.getEnableMtom());
                            }
                            if (port.getMtomThreshold() != null) {
                                mtomFeatureInfo.setThreshold(port.getMtomThreshold());
                            }
                        }

                        if (port.getRespectBinding() != null && port.getRespectBinding().getEnabled() != null) {
                            RespectBindingFeatureInfo respectBindingFeatureInfo = portInfo.getRespectBindingFeatureInfo();
                            if (respectBindingFeatureInfo == null) {
                                respectBindingFeatureInfo = new RespectBindingFeatureInfo();
                                portInfo.setRespectBindingFeatureInfo(respectBindingFeatureInfo);
                            }
                            respectBindingFeatureInfo.setEnabled(port.getRespectBinding().getEnabled());
                        }
                    }
                }
View Full Code Here

Examples of org.apache.geronimo.jaxws.PortInfo

        Map<String, PortInfo> portInfoMap = (Map<String, PortInfo>) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        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
        Bundle bundle = context.getDeploymentBundle();
        Class<?> servletClass = loadClass(servletClassName, bundle);
        if (!JAXWSUtils.isWebService(servletClass)) {
            return false;
        }

        Map<String, PortInfo> servletNamePortInfoMap = null;
        AbstractName jaxwsWebApplicationContextName = context.getNaming().createChildName(module.getModuleName(), "JAXWSWebApplicationContext", "JAXWSWebApplicationContext");
        try {
            servletNamePortInfoMap = (Map<String, PortInfo>)(context.getGBeanInstance(jaxwsWebApplicationContextName).getAttribute("servletNamePortInfoMap"));
        } catch (GBeanNotFoundException e) {
            GBeanData jaxwsWebApplicationContextGBeanData = new GBeanData(jaxwsWebApplicationContextName, JAXWSWebApplicationContext.class);
            try {
                context.addGBean(jaxwsWebApplicationContextGBeanData);
            } catch (GBeanAlreadyExistsException e1) {
            }
            servletNamePortInfoMap = new HashMap<String, PortInfo>();
            jaxwsWebApplicationContextGBeanData.setAttribute("servletNamePortInfoMap", servletNamePortInfoMap);
        }
        targetGBean.addDependency(jaxwsWebApplicationContextName);
        servletNamePortInfoMap.put(servletName, portInfo);

        Map componentContext = null;
        Holder moduleHolder = null;
        try {
            //TODO Now we share the same DeploymentContext in the ear package, which means all the gbeans are saved in the one EARContext
            //Might need to update while we have real EAR support
            moduleHolder = (Holder) module.getSharedContext().get(NamingBuilder.INJECTION_KEY);
            GBeanData contextSourceGBean = context.getGBeanInstance(context.getNaming().createChildName(module.getModuleName(), "ContextSource", "ContextSource"));
            componentContext = (Map) contextSourceGBean.getAttribute("componentContext");
        } 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(), GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
        GBeanData containerFactoryData = new GBeanData(containerFactoryName, getContainerFactoryGBeanInfo());
        containerFactoryData.setAttribute("portInfo", portInfo);
View Full Code Here

Examples of org.apache.geronimo.jaxws.PortInfo

        Map<String, PortInfo> portInfoMap = (Map<String, PortInfo>) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        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, bundle);
        if (!JAXWSUtils.isWebService(beanClass)) {
            return false;
        }

        String location = portInfo.getLocation();
        if (location == null) {
            throw new DeploymentException("Endpoint URI for EJB WebService is missing");
        }

        Map<String, PortInfo> ejbNamePortInfoMap = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.