Search in sources :

Example 26 with WebServiceEndpoint

use of com.sun.enterprise.deployment.WebServiceEndpoint in project Payara by payara.

the class PipeHelper method authorize.

public void authorize(Packet request) throws Exception {
    // SecurityContext constructor should set initiator to
    // unathenticated if Subject is null or empty
    Subject s = (Subject) request.invocationProperties.get(PipeConstants.CLIENT_SUBJECT);
    if (s == null || (s.getPrincipals().isEmpty() && s.getPublicCredentials().isEmpty())) {
        SecurityContext.setUnauthenticatedContext();
    } else {
        SecurityContext sC = new SecurityContext(s);
        SecurityContext.setCurrent(sC);
    }
    if (isEjbEndpoint) {
        if (invManager == null) {
            throw new RuntimeException(localStrings.getLocalString("enterprise.webservice.noEjbInvocationManager", "Cannot validate request : invocation manager null for EJB WebService"));
        }
        ComponentInvocation inv = (ComponentInvocation) invManager.getCurrentInvocation();
        // consumed
        if (ejbDelegate != null) {
            ejbDelegate.setSOAPMessage(request.getMessage(), inv);
        }
        Exception ie;
        Method m = null;
        if (seiModel != null) {
            JavaMethod jm = request.getMessage().getMethod(seiModel);
            m = (jm != null) ? jm.getMethod() : null;
        } else {
            // WebServiceProvider
            WebServiceEndpoint endpoint = (WebServiceEndpoint) map.get(PipeConstants.SERVICE_ENDPOINT);
            EjbDescriptor ejbDescriptor = endpoint.getEjbComponentImpl();
            if (ejbDescriptor != null) {
                final String ejbImplClassName = ejbDescriptor.getEjbImplClassName();
                if (ejbImplClassName != null) {
                    try {
                        m = (Method) AppservAccessController.doPrivileged(new PrivilegedExceptionAction() {

                            @Override
                            public Object run() throws Exception {
                                ClassLoader loader = Thread.currentThread().getContextClassLoader();
                                Class clazz = Class.forName(ejbImplClassName, true, loader);
                                return clazz.getMethod("invoke", new Class[] { Object.class });
                            }
                        });
                    } catch (PrivilegedActionException pae) {
                        throw new RuntimeException(pae.getException());
                    }
                }
            }
        }
        if (m != null) {
            if (ejbDelegate != null) {
                try {
                    if (!ejbDelegate.authorize(inv, m)) {
                        throw new Exception(localStrings.getLocalString("enterprise.webservice.methodNotAuth", "Client not authorized for invocation of {0}", new Object[] { m }));
                    }
                } catch (UnmarshalException e) {
                    String errorMsg = localStrings.getLocalString("enterprise.webservice.errorUnMarshalMethod", "Error unmarshalling method for ejb {0}", new Object[] { ejbName() });
                    ie = new UnmarshalException(errorMsg);
                    ie.initCause(e);
                    throw ie;
                } catch (Exception e) {
                    ie = new Exception(localStrings.getLocalString("enterprise.webservice.methodNotAuth", "Client not authorized for invocation of {0}", new Object[] { m }));
                    ie.initCause(e);
                    throw ie;
                }
            }
        }
    }
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) PrivilegedActionException(java.security.PrivilegedActionException) JavaMethod(com.sun.xml.ws.api.model.JavaMethod) Method(java.lang.reflect.Method) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) Subject(javax.security.auth.Subject) PrivilegedActionException(java.security.PrivilegedActionException) UnmarshalException(javax.xml.bind.UnmarshalException) AuthException(javax.security.auth.message.AuthException) WebServiceException(javax.xml.ws.WebServiceException) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) UnmarshalException(javax.xml.bind.UnmarshalException) ClientSecurityContext(com.sun.enterprise.security.common.ClientSecurityContext) SecurityContext(com.sun.enterprise.security.SecurityContext) JavaMethod(com.sun.xml.ws.api.model.JavaMethod)

Example 27 with WebServiceEndpoint

use of com.sun.enterprise.deployment.WebServiceEndpoint in project Payara by payara.

the class DynamicWebServletRegistrationImpl method configureWebServices.

/*
     * Configures this web module with its web services, based on its
     * "hasWebServices" and "endpointAddresses" properties
     */
void configureWebServices(WebBundleDescriptor wbd) {
    if (wbd.hasWebServices()) {
        setHasWebServices(true);
        // creates the list of endpoint addresses
        String[] endpointAddresses;
        WebServicesDescriptor webService = wbd.getWebServices();
        Vector<String> endpointList = new Vector<>();
        for (WebServiceEndpoint wse : webService.getEndpoints()) {
            if (wbd.getContextRoot() != null) {
                endpointList.add(wbd.getContextRoot() + "/" + wse.getEndpointAddressUri());
            } else {
                endpointList.add(wse.getEndpointAddressUri());
            }
        }
        endpointAddresses = new String[endpointList.size()];
        endpointList.copyInto(endpointAddresses);
        setEndpointAddresses(endpointAddresses);
    } else {
        setHasWebServices(false);
    }
}
Also used : WebServicesDescriptor(com.sun.enterprise.deployment.WebServicesDescriptor) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) Vector(java.util.Vector)

Example 28 with WebServiceEndpoint

use of com.sun.enterprise.deployment.WebServiceEndpoint in project Payara by payara.

the class HandlerChainHandler method processHandlerChainAnnotation.

public HandlerProcessingResult processHandlerChainAnnotation(AnnotationInfo annInfo, AnnotatedElementHandler annCtx, AnnotatedElement annElem, Class declaringClass, boolean serviceSideChain) throws AnnotationProcessorException {
    HandlerChain hChain = null;
    boolean clientSideHandlerChain = false;
    if (serviceSideChain) {
        // Ignore @WebService annotation on an interface; process only those in an actual service impl class
        if (declaringClass.isInterface()) {
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
        }
        // The @HandlerChain can be in the impl class (typically in the java-wsdl case) or
        // can be in the SEI also. Check if there is handler chain in the impl class.
        // If so, the @HandlerChain in impl class gets precedence
        hChain = annElem.getAnnotation(HandlerChain.class);
        if (hChain == null) {
            WebService webService = (WebService) declaringClass.getAnnotation(WebService.class);
            if (webService != null) {
                if (webService.endpointInterface() != null && webService.endpointInterface().length() > 0) {
                    Class endpointIntf;
                    try {
                        endpointIntf = declaringClass.getClassLoader().loadClass(webService.endpointInterface());
                    } catch (java.lang.ClassNotFoundException cfne) {
                        throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.classnotfound", "class {0} referenced from annotation symbol cannot be loaded", new Object[] { webService.endpointInterface() }), annInfo);
                    }
                    if (endpointIntf.getAnnotation(HandlerChain.class) != null) {
                        hChain = (HandlerChain) endpointIntf.getAnnotation(HandlerChain.class);
                    }
                }
            }
        }
    } else {
        // this is a client side handler chain
        hChain = annElem.getAnnotation(HandlerChain.class);
        clientSideHandlerChain = true;
    }
    // At this point the hChain should be the annotation to use.
    if (hChain == null) {
        return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
    }
    // At this point the hChain should be the annotation to use.
    String handlerFile = hChain.file();
    HandlerChainContainer[] containers = null;
    if (annCtx instanceof HandlerContext) {
        containers = ((HandlerContext) annCtx).getHandlerChainContainers(serviceSideChain, declaringClass);
    }
    if (!clientSideHandlerChain && (containers == null || containers.length == 0)) {
        for (Annotation ann : annElem.getAnnotations()) {
            if (ann.annotationType().getPackage().getName().startsWith("javax.ejb")) {
                // let EJB handlers handle this processing
                return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.UNPROCESSED);
            }
        }
        // could not find my web service...
        throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.componentnotfound", "component referenced from annotation symbol cannot be found"), annInfo);
    }
    try {
        URL handlerFileURL = null;
        try {
            handlerFileURL = new URL(handlerFile);
        } catch (java.net.MalformedURLException e) {
        // swallowing purposely
        }
        InputStream handlerFileStream;
        if (handlerFileURL == null) {
            handlerFileStream = getHandlerFileStream(annInfo, null, handlerFile);
            if (handlerFileStream == null) {
                String relativePath = declaringClass.getPackage().getName().replaceAll("\\.", "/");
                handlerFileStream = getHandlerFileStream(annInfo, relativePath, handlerFile);
            }
            if (handlerFileStream == null) {
                // So check in the generated SEI's package
                if (annElem instanceof Class) {
                    String relativePath = ((Class) annElem).getPackage().getName().replaceAll("\\.", "/");
                    handlerFileStream = getHandlerFileStream(annInfo, relativePath, handlerFile);
                }
            }
        } else {
            handlerFileStream = handlerFileURL.openConnection().getInputStream();
        }
        if (handlerFileStream == null) {
            throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.handlerfilenotfound", "handler file {0} not found", new Object[] { handlerFile }), annInfo);
        }
        Document document;
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            factory.setExpandEntityReferences(false);
            factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            document = builder.parse(handlerFileStream);
        } catch (SAXParseException spe) {
            throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.parserexception", "{0} XML Parsing error : line  {1} ; Error = {2}", new Object[] { handlerFile, spe.getLineNumber(), spe.getMessage() }));
        } finally {
            if (handlerFileStream != null) {
                handlerFileStream.close();
            }
        }
        for (HandlerChainContainer container : containers) {
            boolean fromDD = true;
            if (!container.hasHandlerChain()) {
                fromDD = false;
                processHandlerFile(document, container);
            }
            // we now need to create the right context to push on the stack
            // and manually invoke the handlers annotation processing since
            // we know they are Jax-ws handlers.
            List<WebServiceHandlerChain> chains = container.getHandlerChain();
            ArrayList<Class> handlerClasses = new ArrayList<Class>();
            ClassLoader clo = annInfo.getProcessingContext().getProcessingInput().getClassLoader();
            for (WebServiceHandlerChain chain : chains) {
                for (WebServiceHandler handler : chain.getHandlers()) {
                    String className = handler.getHandlerClass();
                    try {
                        handlerClasses.add(clo.loadClass(className));
                    } catch (ClassNotFoundException e) {
                        if (fromDD) {
                            conLogger.log(Level.WARNING, LogUtils.DDHANDLER_NOT_FOUND, className);
                        } else {
                            conLogger.log(Level.WARNING, LogUtils.HANDLER_FILE_HANDLER_NOT_FOUND, new Object[] { className, handlerFile });
                        }
                    }
                }
            }
            // we have the list of handler classes, we can now
            // push the context and call back annotation processing.
            Descriptor jndiContainer = null;
            if (serviceSideChain) {
                WebServiceEndpoint endpoint = (WebServiceEndpoint) container;
                if (DOLUtils.warType().equals(endpoint.getBundleDescriptor().getModuleType())) {
                    jndiContainer = endpoint.getBundleDescriptor();
                } else {
                    jndiContainer = Descriptor.class.cast(endpoint.getEjbComponentImpl());
                }
            } else {
                ServiceReferenceDescriptor ref = (ServiceReferenceDescriptor) container;
                if (DOLUtils.ejbType().equals(ref.getBundleDescriptor().getModuleType())) {
                    EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) ref.getBundleDescriptor();
                    Iterator<? extends EjbDescriptor> ejbsIter = ejbBundle.getEjbs().iterator();
                    while (ejbsIter.hasNext()) {
                        EjbDescriptor ejb = ejbsIter.next();
                        try {
                            if (ejb.getServiceReferenceByName(ref.getName()) != null) {
                                // found the ejb; break out of the loop
                                jndiContainer = Descriptor.class.cast(ejb);
                                break;
                            }
                        } catch (IllegalArgumentException illex) {
                        // this ejb does not have a service-ref by this name;
                        // swallow this exception and  go to next
                        }
                    }
                } else {
                    jndiContainer = ref.getBundleDescriptor();
                }
            }
            ResourceContainerContextImpl newContext = new ResourceContainerContextImpl(jndiContainer);
            ProcessingContext ctx = annInfo.getProcessingContext();
            ctx.pushHandler(newContext);
            // process the classes
            annInfo.getProcessingContext().getProcessor().process(annInfo.getProcessingContext(), handlerClasses.toArray(new Class[handlerClasses.size()]));
            ctx.popHandler();
        }
    } catch (Throwable t) {
        throw new AnnotationProcessorException(t.getMessage(), annInfo);
    }
    return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) WebService(javax.jws.WebService) HandlerContext(com.sun.enterprise.deployment.annotation.context.HandlerContext) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document) URL(java.net.URL) HandlerChainContainer(com.sun.enterprise.deployment.types.HandlerChainContainer) WebServiceHandlerChain(com.sun.enterprise.deployment.WebServiceHandlerChain) HandlerChain(javax.jws.HandlerChain) SAXParseException(org.xml.sax.SAXParseException) EarClassLoader(org.glassfish.javaee.full.deployment.EarClassLoader) ResourceContainerContextImpl(com.sun.enterprise.deployment.annotation.context.ResourceContainerContextImpl) WebServiceHandlerChain(com.sun.enterprise.deployment.WebServiceHandlerChain) InputStream(java.io.InputStream) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor) Annotation(java.lang.annotation.Annotation) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) DocumentBuilder(javax.xml.parsers.DocumentBuilder) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) Descriptor(org.glassfish.deployment.common.Descriptor) WebServiceHandler(com.sun.enterprise.deployment.WebServiceHandler)

Example 29 with WebServiceEndpoint

use of com.sun.enterprise.deployment.WebServiceEndpoint in project Payara by payara.

the class WebServiceProviderHandler method processAnnotation.

@Override
public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException {
    AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
    AnnotatedElement annElem = annInfo.getAnnotatedElement();
    boolean ejbInWar = ignoreWebserviceAnnotations(annElem, annCtx);
    // and add webservices to that BundleDescriptor
    if (ejbInWar) {
        return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
    }
    // sanity check
    if (!(annElem instanceof Class)) {
        AnnotationProcessorException ape = new AnnotationProcessorException("@WebServiceProvider can only be specified on TYPE", annInfo);
        annInfo.getProcessingContext().getErrorHandler().error(ape);
        return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED);
    }
    if (isJaxwsRIDeployment(annInfo)) {
        // Looks like JAX-WS RI specific deployment, do not process Web Service annotations otherwise would end up as two web service endpoints
        conLogger.log(Level.INFO, LogUtils.DEPLOYMENT_DISABLED, new Object[] { annInfo.getProcessingContext().getArchive().getName(), "WEB-INF/sun-jaxws.xml" });
        return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
    }
    // WebServiceProvider MUST implement the provider interface, let's check this
    if (!javax.xml.ws.Provider.class.isAssignableFrom((Class) annElem)) {
        AnnotationProcessorException ape = new AnnotationProcessorException(annElem.toString() + "does not implement the javax.xml.ws.Provider interface", annInfo);
        annInfo.getProcessingContext().getErrorHandler().error(ape);
        return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED);
    }
    // let's get the main annotation of interest.
    javax.xml.ws.WebServiceProvider ann = (javax.xml.ws.WebServiceProvider) annInfo.getAnnotation();
    BundleDescriptor bundleDesc = null;
    try {
        // let's see the type of web service we are dealing with...
        if (ejbProvider != null && ejbProvider.getType("javax.ejb.Stateless") != null) {
            // this is an ejb !
            if (annCtx instanceof EjbContext) {
                EjbContext ctx = (EjbContext) annCtx;
                bundleDesc = ctx.getDescriptor().getEjbBundleDescriptor();
                bundleDesc.setSpecVersion("3.0");
            } else if (annCtx instanceof EjbsContext) {
                String name = getEjbName(annElem);
                for (EjbContext ejbCtx : ((EjbsContext) annCtx).getEjbContexts()) {
                    EjbDescriptor descriptor = ejbCtx.getDescriptor();
                    if (name.equals(descriptor.getName())) {
                        bundleDesc = descriptor.getEjbBundleDescriptor();
                        bundleDesc.setSpecVersion("3.0");
                        break;
                    }
                }
            }
        }
        if (bundleDesc == null) {
            // this has to be a servlet
            if (annCtx instanceof WebComponentContext) {
                bundleDesc = ((WebComponentContext) annCtx).getDescriptor().getWebBundleDescriptor();
            } else if (!(annCtx instanceof WebBundleContext)) {
                return getInvalidAnnotatedElementHandlerResult(annInfo.getProcessingContext().getHandler(), annInfo);
            }
            bundleDesc = ((WebBundleContext) annCtx).getDescriptor();
            bundleDesc.setSpecVersion("2.5");
        }
    } catch (Exception e) {
        throw new AnnotationProcessorException(wsLocalStrings.getLocalString("webservice.annotation.exception", "WS00023: Exception in processing @Webservice : {0}", e.getMessage()));
    }
    // For WSProvider, portComponentName is the fully qualified class name
    String portComponentName = ((Class) annElem).getName();
    // As per JSR181, the serviceName is either specified in the deployment descriptor
    // or in @WebSErvice annotation in impl class; if neither service name implclass+Service
    String svcName = ann.serviceName();
    if (svcName == null) {
        svcName = "";
    }
    // Store binding type specified in Impl class
    String userSpecifiedBinding = null;
    javax.xml.ws.BindingType bindingAnn = (javax.xml.ws.BindingType) ((Class) annElem).getAnnotation(javax.xml.ws.BindingType.class);
    if (bindingAnn != null) {
        userSpecifiedBinding = bindingAnn.value();
    }
    // In case user gives targetNameSpace in the Impl class, that has to be used as
    // the namespace for service, port; typically user will do this in cases where
    // port_types reside in a different namespace than that of server/port.
    // Store the targetNameSpace, if any, in the impl class for later use
    String targetNameSpace = ann.targetNamespace();
    if (targetNameSpace == null) {
        targetNameSpace = "";
    }
    String portName = ann.portName();
    if (portName == null) {
        portName = "";
    }
    // Check if the same endpoint is already defined in webservices.xml
    WebServicesDescriptor wsDesc = bundleDesc.getWebServices();
    WebServiceEndpoint endpoint = wsDesc.getEndpointByName(portComponentName);
    WebService newWS;
    if (endpoint == null) {
        // If so, add this endpoint to the existing service
        if (svcName.length() != 0) {
            newWS = wsDesc.getWebServiceByName(svcName);
        } else {
            newWS = wsDesc.getWebServiceByName(((Class) annElem).getSimpleName());
        }
        if (newWS == null) {
            newWS = new WebService();
            // service name from annotation
            if (svcName.length() != 0) {
                newWS.setName(svcName);
            } else {
                newWS.setName(((Class) annElem).getSimpleName());
            }
            wsDesc.addWebService(newWS);
        }
        endpoint = new WebServiceEndpoint();
        // port-component-name is fully qualified class name
        endpoint.setEndpointName(portComponentName);
        newWS.addEndpoint(endpoint);
        wsDesc.setSpecVersion(WebServicesDescriptorNode.SPEC_VERSION);
    } else {
        newWS = endpoint.getWebService();
    }
    // present overrides everything else
    if (endpoint.getWsdlService() != null) {
        if ((targetNameSpace.length() > 0) && (!endpoint.getWsdlService().getNamespaceURI().equals(targetNameSpace))) {
            throw new AnnotationProcessorException("Target Namespace inwsdl-service element does not match @WebService.targetNamespace", annInfo);
        }
        targetNameSpace = endpoint.getWsdlService().getNamespaceURI();
    }
    // Set binding id id @BindingType is specified by the user in the impl class
    if ((!endpoint.hasUserSpecifiedProtocolBinding()) && (userSpecifiedBinding != null) && (userSpecifiedBinding.length() != 0)) {
        endpoint.setProtocolBinding(userSpecifiedBinding);
    }
    // Use annotated values only if the deployment descriptor equivalent has not been specified
    if (newWS.getWsdlFileUri() == null) {
        // take wsdl location from annotation
        if (ann.wsdlLocation() != null && ann.wsdlLocation().length() != 0) {
            newWS.setWsdlFileUri(ann.wsdlLocation());
        }
    }
    annElem = annInfo.getAnnotatedElement();
    // we checked that the endpoint implements the provider interface above
    Class clz = (Class) annElem;
    Class serviceEndpointIntf = null;
    for (Class intf : clz.getInterfaces()) {
        if (javax.xml.ws.Provider.class.isAssignableFrom(intf)) {
            serviceEndpointIntf = intf;
            break;
        }
    }
    if (serviceEndpointIntf == null) {
        endpoint.setServiceEndpointInterface("javax.xml.ws.Provider");
    } else {
        endpoint.setServiceEndpointInterface(serviceEndpointIntf.getName());
    }
    if (DOLUtils.warType().equals(bundleDesc.getModuleType())) {
        if (endpoint.getServletImplClass() == null) {
            // Set servlet impl class here
            endpoint.setServletImplClass(((Class) annElem).getName());
        }
        // Servlet link name
        WebBundleDescriptor webBundle = (WebBundleDescriptor) bundleDesc;
        if (endpoint.getWebComponentLink() == null) {
            endpoint.setWebComponentLink(portComponentName);
        }
        if (endpoint.getWebComponentImpl() == null) {
            WebComponentDescriptor webComponent = (WebComponentDescriptor) webBundle.getWebComponentByCanonicalName(endpoint.getWebComponentLink());
            if (webComponent == null) {
                // GLASSFISH-3297
                WebComponentDescriptor[] wcs = webBundle.getWebComponentByImplName(((Class) annElem).getCanonicalName());
                if (wcs.length > 0) {
                    webComponent = wcs[0];
                }
            }
            // if servlet is not known, we should add it now
            if (webComponent == null) {
                webComponent = new WebComponentDescriptorImpl();
                webComponent.setServlet(true);
                webComponent.setWebComponentImplementation(((Class) annElem).getCanonicalName());
                webComponent.setName(endpoint.getEndpointName());
                webComponent.addUrlPattern("/" + newWS.getName());
                webBundle.addWebComponentDescriptor(webComponent);
            }
            endpoint.setWebComponentImpl(webComponent);
        }
    } else {
        String name = getEjbName(annElem);
        EjbDescriptor ejb = ((EjbBundleDescriptor) bundleDesc).getEjbByName(name);
        endpoint.setEjbComponentImpl(ejb);
        ejb.setWebServiceEndpointInterfaceName(endpoint.getServiceEndpointInterface());
        if (endpoint.getEjbLink() == null) {
            endpoint.setEjbLink(ejb.getName());
        }
    }
    if (endpoint.getWsdlPort() == null) {
        endpoint.setWsdlPort(new QName(targetNameSpace, portName, "ns1"));
    }
    if (endpoint.getWsdlService() == null) {
        endpoint.setWsdlService(new QName(targetNameSpace, svcName, "ns1"));
    }
    return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
Also used : WebService(com.sun.enterprise.deployment.WebService) AnnotatedElement(java.lang.reflect.AnnotatedElement) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) WebServicesDescriptor(com.sun.enterprise.deployment.WebServicesDescriptor) WebBundleContext(com.sun.enterprise.deployment.annotation.context.WebBundleContext) WebComponentDescriptorImpl(org.glassfish.web.deployment.descriptor.WebComponentDescriptorImpl) QName(javax.xml.namespace.QName) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) EjbsContext(com.sun.enterprise.deployment.annotation.context.EjbsContext) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebComponentDescriptor(com.sun.enterprise.deployment.WebComponentDescriptor) WebComponentContext(com.sun.enterprise.deployment.annotation.context.WebComponentContext) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) EjbContext(com.sun.enterprise.deployment.annotation.context.EjbContext)

Example 30 with WebServiceEndpoint

use of com.sun.enterprise.deployment.WebServiceEndpoint in project Payara by payara.

the class WebServicesDescriptorNode method addDescriptor.

/**
 * Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNode
 *
 * @param descriptor the new descriptor
 */
@Override
public void addDescriptor(Object descriptor) {
    WebServicesDescriptor webServicesDesc = bundleDescriptor.getWebServices();
    WebService webService = (WebService) descriptor;
    webServicesDesc.addWebService(webService);
    for (Iterator<WebServiceEndpoint> iter = webService.getEndpoints().iterator(); iter.hasNext(); ) {
        WebServiceEndpoint next = iter.next();
        if (!next.resolveComponentLink()) {
            logger.log(INFO, WS_COMP_LINK_NOT_VALID, new Object[] { next.getEndpointName(), next.getLinkName() });
        }
    }
}
Also used : WebServicesDescriptor(com.sun.enterprise.deployment.WebServicesDescriptor) WebService(com.sun.enterprise.deployment.WebService) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint)

Aggregations

WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)38 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)7 WebServicesDescriptor (com.sun.enterprise.deployment.WebServicesDescriptor)7 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)6 WebService (com.sun.enterprise.deployment.WebService)6 Iterator (java.util.Iterator)6 Collection (java.util.Collection)5 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)4 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)4 MessageSecurityBindingDescriptor (com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor)4 URL (java.net.URL)4 ArrayList (java.util.ArrayList)4 ServiceRefPortInfo (com.sun.enterprise.deployment.ServiceRefPortInfo)3 HandlerChainContainer (com.sun.enterprise.deployment.types.HandlerChainContainer)3 IOException (java.io.IOException)3 Application (com.sun.enterprise.deployment.Application)2 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)2 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)2 WebServiceHandler (com.sun.enterprise.deployment.WebServiceHandler)2 SecurityContext (com.sun.enterprise.security.SecurityContext)2