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;
}
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;
}
Aggregations