protected String getWsdlUrl(StringToStringMap values, T modelItem) { String wsdl = values.get(WSDL); boolean useCached = values.getBoolean(CACHED_WSDL); if (modelItem instanceof AbstractInterface) { AbstractInterface<?> iface = (AbstractInterface<?>) modelItem; boolean hasDefinition = StringUtils.hasContent(iface.getDefinition()); if (wsdl == null && !useCached && hasDefinition) { return PathUtils.expandPath(iface.getDefinition(), iface); } if (!hasDefinition || (useCached && iface.getDefinitionContext().isCached())) { try { File tempFile = File.createTempFile("tempdir", null); String path = tempFile.getAbsolutePath(); tempFile.delete(); wsdl = iface.getDefinitionContext().export(path); // CachedWsdlLoader loader = (CachedWsdlLoader) // iface.createWsdlLoader(); // wsdl = loader.saveDefinition(path); } catch (Exception e) { SoapUI.logError(e); } } } return wsdl; }
@Override public void release() { super.release(); for (WsdlOperation operation : operations) operation.release(); if (wsdlContext != null) wsdlContext.release(); }
@SuppressWarnings("unchecked") @Override public void resolve(ResolveContext<?> context) { super.resolve(context); String definition = definitionProperty.expandUrl(); if (!isCached() && definition.startsWith("file:")) { try { File file = new File(definition.substring(5)); if (!file.exists()) { if (context.hasThisModelItem(this, "Missing WSDL file", definition)) return; context.addPathToResolve( this, "Missing WSDL file", definition, new ResolveContext.FileResolver( "Select WSDL File", "wsdl", "WSDL Files (*.wsdl)", file.getParent()) { @Override public boolean apply(File newFile) { try { setDefinition(newFile.toURI().toURL().toString()); return true; } catch (Exception e) { log.error("Invalid URL for new Definition", e); return false; } } }); } else { if (context.hasThisModelItem(this, "Missing WSDL file", definition)) context.getPath(this, "Missing WSDL file", definition).setSolved(true); } } catch (Exception e) { e.printStackTrace(); } } }
@Override public void addExternalDependencies(List<ExternalDependency> dependencies) { super.addExternalDependencies(dependencies); dependencies.add(new PathPropertyExternalDependency(definitionProperty)); }