private void initializePorts() { try { Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlURL); javax.wsdl.Service serv = def.getService(serviceName); if (serv == null) {
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class); try { Definition def = wsdlManager.getDefinition(wsdlDocumentLocation); interfaceName = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding() .getPortType().getQName();
.getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class); if (def == null) { def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation);
private boolean isEmptywsdl(String wsdlUrl) { Definition definition; try { definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl); } catch (WSDLException e) { LOG.log(Level.WARNING, "Failed to parse WSDL", e); return true; } if (definition.getPortTypes().isEmpty() && definition.getImports().isEmpty()) { return true; } return false; } }
private boolean isEmptywsdl(String wsdlUrl) { Definition definition; try { definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl); } catch (WSDLException e) { LOG.log(Level.WARNING, "Failed to parse WSDL", e); return true; } if (definition.getPortTypes().isEmpty() && definition.getImports().isEmpty()) { return true; } return false; } }
public QName getServiceName() { if (serviceName == null && serviceNameString != null) { serviceName = QName.valueOf(resolvePropertyPlaceholders(serviceNameString)); } //if not specify the service name and if the wsdlUrl is available, //parse the wsdl to see if only one service in it, if so set the only service //from wsdl to avoid ambiguity if (serviceName == null && getWsdlURL() != null) { // use wsdl manager to parse wsdl or get cached // definition try { Definition definition = getBus().getExtension(WSDLManager.class) .getDefinition(getWsdlURL()); if (definition.getServices().size() == 1) { serviceName = (QName) definition.getServices().keySet() .iterator().next(); } } catch (WSDLException e) { throw new RuntimeException(e); } } return serviceName; }
@SuppressWarnings("unchecked") protected void parseWSDL(String wsdlURL) { try { WSDLManager mgr = bus.getExtension(WSDLManager.class); registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry()); wsdlDefinition = mgr.getDefinition(wsdlURL); parseImports(wsdlDefinition); if (wsdlDefinition.getServices().isEmpty()) { for (Definition def : importedDefinitions) { Set<QName> services = def.getServices().keySet(); for (QName sName : services) { if (!wsdlDefinition.getServices().keySet().contains(sName)) { wsdlDefinition.getServices().put(sName, def.getService(sName)); } } } } } catch (Exception we) { Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL, we.getMessage()); throw new WSDLRuntimeException(msg, we); } }
@SuppressWarnings("unchecked") protected void parseWSDL(String wsdlURL) { try { WSDLManager mgr = bus.getExtension(WSDLManager.class); registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry()); wsdlDefinition = mgr.getDefinition(wsdlURL); parseImports(wsdlDefinition); if (wsdlDefinition.getServices().isEmpty()) { for (Definition def : importedDefinitions) { Set<QName> services = def.getServices().keySet(); for (QName sName : services) { if (!wsdlDefinition.getServices().keySet().contains(sName)) { wsdlDefinition.getServices().put(sName, def.getService(sName)); } } } } } catch (Exception we) { Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL, we.getMessage()); throw new WSDLRuntimeException(msg, we); } }
@SuppressWarnings("unchecked") protected void parseWSDL(String wsdlURL) { try { WSDLManager mgr = bus.getExtension(WSDLManager.class); registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry()); wsdlDefinition = mgr.getDefinition(wsdlURL); parseImports(wsdlDefinition); if (wsdlDefinition.getServices().isEmpty()) { for (Definition def : importedDefinitions) { Set<QName> services = def.getServices().keySet(); for (QName sName : services) { if (!wsdlDefinition.getServices().keySet().contains(sName)) { wsdlDefinition.getServices().put(sName, def.getService(sName)); } } } } } catch (Exception we) { Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL, we.getMessage()); throw new WSDLRuntimeException(msg, we); } }
@SuppressWarnings("unchecked") protected void parseWSDL(String wsdlURL) { try { WSDLManager mgr = bus.getExtension(WSDLManager.class); registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry()); wsdlDefinition = mgr.getDefinition(wsdlURL); parseImports(wsdlDefinition); if (wsdlDefinition.getServices().isEmpty()) { for (Definition def : importedDefinitions) { Set<QName> services = def.getServices().keySet(); for (QName sName : services) { if (!wsdlDefinition.getServices().keySet().contains(sName)) { wsdlDefinition.getServices().put(sName, def.getService(sName)); } } } } } catch (Exception we) { Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL, we.getMessage()); throw new WSDLRuntimeException(msg, we); } }
public WSDLServiceFactory(Bus b, String url) { setBus(b); wsdlUrl = url; try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } }
public WSDLServiceFactory(Bus b, URL url) { setBus(b); wsdlUrl = url; try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } } public WSDLServiceFactory(Bus b, String url) {
public WSDLServiceFactory(Bus b, String url) { setBus(b); try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } }
public WSDLServiceFactory(Bus b, String url, QName sn) { setBus(b); try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } serviceName = sn; }
public WSDLServiceFactory(Bus b, String url, QName sn) { setBus(b); try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } serviceName = sn; }
public WSDLServiceFactory(Bus b, String url) { setBus(b); try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } }
public WSDLServiceFactory(Bus b, String url, QName sn) { setBus(b); wsdlUrl = url; try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } serviceName = sn; }
private static String findNamespaceHack(EndpointReferenceType ref, Bus bus) { //probably a broken version of Xalan, we'll have to //try a hack to figure out the namespace as xalan //dropped the namespace declaration so there isn't //a way to map the namespace prefix to the real namespace. //This is fixed in xalan 2.7.1, but older versions may //be used if (bus == null) { return ""; } String wsdlLocation = getWSDLLocation(ref); if (StringUtils.isEmpty(wsdlLocation)) { return ""; } if (bus != null) { WSDLManager manager = bus.getExtension(WSDLManager.class); if (manager != null) { try { Definition def = manager.getDefinition(wsdlLocation); return def.getTargetNamespace(); } catch (WSDLException e) { //ignore } } } return ""; }
public WSDLServiceFactory(Bus b, URL url) { setBus(b); wsdlUrl = url; try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } } public WSDLServiceFactory(Bus b, String url) {
public void parseWSDL(String wsdlUrl) { try { Bus bus = BusFactory.getThreadDefaultBus(); WSDLManager mgr = bus.getExtension(WSDLManager.class); wsdlDefinition = mgr.getDefinition(wsdlUrl); WSDLServiceBuilder builder = new WSDLServiceBuilder(bus); builder.buildMockServices(wsdlDefinition); schemas = mgr.getSchemasForDefinition(wsdlDefinition); //remove this as we're going to be modifying it mgr.removeDefinition(wsdlDefinition); } catch (WSDLException we) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message( "FAIL_TO_CREATE_WSDL_DEFINITION", LOG); throw new ToolException(msg, we); } }