Search in sources :

Example 31 with WebServiceEndpoint

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

the class WebServiceNode method addDescriptor.

/**
 * Adds  a new DOL descriptor instance to the descriptor
 * instance associated with this XMLNode
 *
 * @param descriptor the new descriptor
 */
public void addDescriptor(Object descriptor) {
    WebServiceEndpoint endpoint = (WebServiceEndpoint) descriptor;
    WebService webService = (WebService) getDescriptor();
    webService.addEndpoint(endpoint);
}
Also used : WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) WebService(com.sun.enterprise.deployment.WebService)

Example 32 with WebServiceEndpoint

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

the class WebServiceNode method writeDescriptor.

/**
 * write the method descriptor class to a query-method DOM tree and
 * return it
 *
 * @param parent node in the DOM tree
 * @param nodeName name for the root element of this xml fragment
 * @param descriptor the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, WebService descriptor) {
    Node topNode = super.writeDescriptor(parent, nodeName, descriptor);
    writeDisplayableComponentInfo(topNode, descriptor);
    appendTextChild(topNode, WebServicesTagNames.WEB_SERVICE_DESCRIPTION_NAME, descriptor.getName());
    appendTextChild(topNode, WebServicesTagNames.WSDL_FILE, descriptor.getWsdlFileUri());
    appendTextChild(topNode, WebServicesTagNames.JAXRPC_MAPPING_FILE, descriptor.getMappingFileUri());
    WebServiceEndpointNode endpointNode = new WebServiceEndpointNode();
    for (WebServiceEndpoint next : descriptor.getEndpoints()) {
        endpointNode.writeDescriptor(topNode, WebServicesTagNames.PORT_COMPONENT, next);
    }
    return topNode;
}
Also used : WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) Node(org.w3c.dom.Node) DisplayableComponentNode(com.sun.enterprise.deployment.node.DisplayableComponentNode)

Example 33 with WebServiceEndpoint

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

the class JaxRpcRICodegen method accept.

/**
 * visits a web service definition
 *
 * @param webService
 */
@Override
public void accept(WebService webService) {
    if (processServiceReferences) {
        return;
    }
    if (!webServiceInContext(webService)) {
        return;
    }
    super.accept(webService);
    try {
        if ((new WsUtil()).isJAXWSbasedService(webService)) {
            WsUtil wsUtil = new WsUtil();
            Collection<WebServiceEndpoint> endpoints = webService.getEndpoints();
            for (WebServiceEndpoint ep : endpoints) {
                if (ep.implementedByWebComponent()) {
                    wsUtil.updateServletEndpointRuntime(ep);
                } else {
                    wsUtil.validateEjbEndpoint(ep);
                }
            }
        // wsImport(webService, files);
        } else {
            jaxrpcWebService(webService, files);
        }
    } catch (Exception e) {
        RuntimeException ge = new RuntimeException(e.getMessage());
        ge.initCause(e);
        throw ge;
    }
}
Also used : WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) WsUtil(org.glassfish.webservices.WsUtil) IOException(java.io.IOException)

Example 34 with WebServiceEndpoint

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

the class JaxRpcRICodegen method accept.

/**
 * Visits a webs service reference
 */
@Override
public void accept(ServiceReferenceDescriptor serviceRef) {
    if (!processServiceReferences) {
        return;
    }
    boolean codegenRequired = false;
    URL wsdlOverride = null;
    boolean wsdlOverriden = false;
    boolean jaxwsClient = false;
    super.accept(serviceRef);
    try {
        ClassLoader clr = serviceRef.getBundleDescriptor().getClassLoader();
        if (serviceRef.getServiceInterface() != null) {
            Class serviceInterface = clr.loadClass(serviceRef.getServiceInterface());
            if (javax.xml.ws.Service.class.isAssignableFrom(serviceInterface)) {
                jaxwsClient = true;
            }
        }
        // already set.
        for (Iterator ports = serviceRef.getPortsInfo().iterator(); ports.hasNext(); ) {
            ServiceRefPortInfo portInfo = (ServiceRefPortInfo) ports.next();
            if (portInfo.isLinkedToPortComponent()) {
                WebServiceEndpoint linkedPortComponent = portInfo.getPortComponentLink();
                if (linkedPortComponent == null) {
                    throw new Exception(localStrings.getLocalString("enterprise.webservice.componentlinkunresolved", "The port-component-link {0} cannot be resolved", new Object[] { portInfo.getPortComponentLinkName() }));
                }
                WsUtil wsUtil = new WsUtil();
                WebServerInfo wsi = wsUtil.getWebServerInfoForDAS();
                URL rootURL = wsi.getWebServerRootURL(linkedPortComponent.isSecure());
                URL actualAddress = linkedPortComponent.composeEndpointAddress(rootURL);
                if (jaxwsClient) {
                    portInfo.addStubProperty(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, actualAddress.toExternalForm());
                } else {
                    portInfo.addStubProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, actualAddress.toExternalForm());
                }
                if (serviceRef.getBundleDescriptor().getModuleType().equals(DOLUtils.carType())) {
                    wsdlOverride = serviceRef.getWsdlOverride();
                    if (wsdlOverride != null) {
                        wsdlOverriden = true;
                        serviceRef.setWsdlOverride(linkedPortComponent.getWebService().getWsdlFileUrl());
                    }
                }
            }
        }
        // If this is a post JAXRPC-1.1 based web service, then no need for code gen etc etc
        if (jaxwsClient) {
            return;
        }
        if (serviceRef.hasGeneratedServiceInterface()) {
            if (serviceRef.hasWsdlFile() && serviceRef.hasMappingFile()) {
                codegenRequired = true;
            } else {
                throw new Exception("Deployment error for service-ref " + serviceRef.getName() + ".\nService references with generated service " + "interface must include WSDL and mapping information.");
            }
        } else {
            if (serviceRef.hasWsdlFile()) {
                if (serviceRef.hasMappingFile()) {
                    codegenRequired = true;
                } else {
                    throw new Exception("Deployment error for service-ref " + serviceRef.getName() + ".\nService references with wsdl must also have " + "mapping information.");
                }
            }
        }
        if (codegenRequired) {
            ModelInfo modelInfo = createModelInfo(serviceRef);
            /*
                 * If clients exist, force regeneration so that the ClientArtifactsManager is populated. Issue
                 * 10612.
                 */
            String[] args = createJaxrpcCompileArgs(false, hasWebServiceClients);
            CompileTool wscompile = rpcFactory.createCompileTool(System.out, "wscompile");
            wscompileForAccept = wscompile;
            WsCompile delegate = new WsCompile(wscompile, serviceRef);
            delegate.setModelInfo(modelInfo);
            wscompile.setDelegate(delegate);
            jaxrpc(args, delegate, serviceRef, files);
            if (hasWebServiceClients) {
                addArtifactsForAppClient();
            }
        }
        if (wsdlOverriden) {
            serviceRef.setWsdlOverride(wsdlOverride);
        }
    } catch (IllegalStateException e) {
        // do nothing
        logger.info("Attempting to add artifacts for appClient after artifacts were generated" + " " + e.getMessage());
    } catch (Exception e) {
        RuntimeException re = new RuntimeException(e.getMessage());
        re.initCause(e);
        throw re;
    }
}
Also used : CompileTool(com.sun.xml.rpc.spi.tools.CompileTool) ModelFileModelInfo(com.sun.xml.rpc.spi.tools.ModelFileModelInfo) J2EEModelInfo(com.sun.xml.rpc.spi.tools.J2EEModelInfo) ModelInfo(com.sun.xml.rpc.spi.tools.ModelInfo) NoMetadataModelInfo(com.sun.xml.rpc.spi.tools.NoMetadataModelInfo) WebServerInfo(org.glassfish.web.deployment.util.WebServerInfo) WsUtil(org.glassfish.webservices.WsUtil) ServiceRefPortInfo(com.sun.enterprise.deployment.ServiceRefPortInfo) URL(java.net.URL) IOException(java.io.IOException) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint) Iterator(java.util.Iterator) ASURLClassLoader(com.sun.enterprise.loader.ASURLClassLoader) WsCompile(org.glassfish.webservices.WsCompile)

Example 35 with WebServiceEndpoint

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

the class WebServicesDeploymentMBean method deploy.

public synchronized void deploy(WebServicesDescriptor wsDesc, WebServiceDeploymentNotifier notifier) {
    for (WebService svc : wsDesc.getWebServices()) {
        for (WebServiceEndpoint endpoint : svc.getEndpoints()) {
            deploy(endpoint);
            notifier.notifyDeployed(endpoint);
        }
    }
}
Also used : 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