Search in sources :

Example 1 with NoMetadataModelInfo

use of com.sun.xml.rpc.spi.tools.NoMetadataModelInfo in project Payara by payara.

the class JaxRpcRICodegen method createNoMetadataModelInfo.

private NoMetadataModelInfo createNoMetadataModelInfo(WebService webService, JaxrpcMappingDescriptor mappingDesc) throws Exception {
    NoMetadataModelInfo modelInfo = rpcFactory.createNoMetadataModelInfo();
    URL wsdlFileUrl = webService.getWsdlFileUrl();
    Collection endpoints = webService.getEndpoints();
    if (endpoints.size() != 1) {
        throw new Exception("Deployment code generation error for webservice " + webService.getName() + ". " + " jaxrpc-mapping-file is required if web service has " + "multiple endpoints");
    }
    WebServiceEndpoint endpoint = (WebServiceEndpoint) endpoints.iterator().next();
    modelInfo.setLocation(wsdlFileUrl.toExternalForm());
    modelInfo.setInterfaceName(endpoint.getServiceEndpointInterface());
    modelInfo.setPortName(endpoint.getWsdlPort());
    addNamespaceMappingRegistry(modelInfo, mappingDesc);
    return modelInfo;
}
Also used : Collection(java.util.Collection) NoMetadataModelInfo(com.sun.xml.rpc.spi.tools.NoMetadataModelInfo) URL(java.net.URL) IOException(java.io.IOException)

Example 2 with NoMetadataModelInfo

use of com.sun.xml.rpc.spi.tools.NoMetadataModelInfo in project Payara by payara.

the class JaxRpcRICodegen method createNoMetadataModelInfo.

private NoMetadataModelInfo createNoMetadataModelInfo(ServiceReferenceDescriptor serviceRef, JaxrpcMappingDescriptor mappingDesc) throws Exception {
    NoMetadataModelInfo modelInfo = rpcFactory.createNoMetadataModelInfo();
    URL wsdlFile = serviceRef.hasWsdlOverride() ? serviceRef.getWsdlOverride() : serviceRef.getWsdlFileUrl();
    modelInfo.setLocation(wsdlFile.toExternalForm());
    // Service endpoint interface is required.  Parse generated
    // service interface for it since we can't count on SEI
    // having been listed in standard deployment information.
    WsUtil wsUtil = new WsUtil();
    String serviceInterfaceName = serviceRef.getServiceInterface();
    ClassLoader cl = context.getModuleMetaData(Application.class).getClassLoader();
    if (cl instanceof ASURLClassLoader) {
        String modClassPath = ASClassLoaderUtil.getModuleClassPath(habitat, context);
        List<URL> moduleList = ASClassLoaderUtil.getURLsFromClasspath(modClassPath, File.pathSeparator, null);
        for (Iterator<URL> itr = moduleList.iterator(); itr.hasNext(); ) {
            ((ASURLClassLoader) cl).appendURL(itr.next());
        }
    }
    Class serviceInterface = cl.loadClass(serviceInterfaceName);
    Collection seis = wsUtil.getSEIsFromGeneratedService(serviceInterface);
    if (seis.size() == 0) {
        throw new Exception("Invalid Generated Service Interface " + serviceInterfaceName + " . ");
    } else if (seis.size() > 1) {
        throw new Exception("Deployment error : If no " + "jaxrpc-mapping file is provided, " + "Generated Service Interface must have" + " only 1 Service Endpoint Interface");
    }
    String serviceEndpointInterface = (String) seis.iterator().next();
    modelInfo.setInterfaceName(serviceEndpointInterface);
    addNamespaceMappingRegistry(modelInfo, mappingDesc);
    return modelInfo;
}
Also used : ASURLClassLoader(com.sun.enterprise.loader.ASURLClassLoader) ASURLClassLoader(com.sun.enterprise.loader.ASURLClassLoader) Collection(java.util.Collection) NoMetadataModelInfo(com.sun.xml.rpc.spi.tools.NoMetadataModelInfo) WsUtil(org.glassfish.webservices.WsUtil) URL(java.net.URL) IOException(java.io.IOException)

Aggregations

NoMetadataModelInfo (com.sun.xml.rpc.spi.tools.NoMetadataModelInfo)2 IOException (java.io.IOException)2 URL (java.net.URL)2 Collection (java.util.Collection)2 ASURLClassLoader (com.sun.enterprise.loader.ASURLClassLoader)1 WsUtil (org.glassfish.webservices.WsUtil)1