public void transferEndpoints(Port port) { if (port != null) { String endpoint = WsdlUtils.getSoapEndpoint(port); if (endpoint != null) { StringList list = new StringList(getEndpoints()); // expand properties.. for (int c = 0; c < list.size(); c++) list.set(c, PropertyExpander.expandProperties(this, list.get(c))); if (!list.contains(endpoint)) { if (UISupport.confirm( "Update existing requests with new endpoint\n[" + endpoint + "]", "Update Definition")) { for (int c = 0; c < getOperationCount(); c++) { Operation operation = getOperationAt(c); for (int ix = 0; ix < operation.getRequestCount(); ix++) { operation.getRequestAt(ix).setEndpoint(endpoint); } } } addEndpoint(endpoint); } } } }
public DefinitionCacheConfig cacheDefinition(WsdlLoader loader) throws Throwable { log.debug("Caching definition for [" + loader.getBaseURI() + "]"); if (getConfig().isSetDefinitionCache()) getConfig().unsetDefinitionCache(); DefinitionCacheConfig definitionCache = null; try { definitionCache = getConfig().addNewDefinitionCache(); definitionCache.set(WsdlUtils.cacheWsdl(loader)); } catch (Throwable e) { getConfig().unsetDefinitionCache(); throw e; } return definitionCache; }
public String getStyle() { if (wsdlContext == null || !wsdlContext.isLoaded()) return "<not loaded>"; try { Binding binding = wsdlContext.getDefinition().getBinding(getBindingName()); if (binding == null) return "<missing binding>"; if (WsdlUtils.isRpc(binding)) { return STYLE_RPC; } else { return STYLE_DOCUMENT; } } catch (Exception e) { SoapUI.logError(e); return "<error>"; } }
@SuppressWarnings("unchecked") public void transferOperations(Binding binding, boolean createRequests) { // prepare for transfer of operations/requests List<BindingOperation> newOperations = new ArrayList<BindingOperation>(binding.getBindingOperations()); Map<String, WsdlOperation> oldOperations = new HashMap<String, WsdlOperation>(); for (int c = 0; c < operations.size(); c++) oldOperations.put(operations.get(c).getBindingOperationName(), operations.get(c)); // clear existing from both collections for (int c = 0; c < newOperations.size(); c++) { BindingOperation newOperation = newOperations.get(c); String bindingOperationName = newOperation.getName(); if (oldOperations.containsKey(bindingOperationName)) { log.info("Synchronizing existing operation [" + bindingOperationName + "]"); WsdlOperation wsdlOperation = oldOperations.get(bindingOperationName); WsdlUtils.getAnonymous(wsdlOperation); wsdlOperation.initFromBindingOperation(newOperation); fireOperationUpdated(wsdlOperation); oldOperations.remove(bindingOperationName); newOperations.remove(c); c--; } } // remove leftover operations Iterator<String> i = oldOperations.keySet().iterator(); while (i.hasNext()) { String name = i.next(); if (newOperations.size() > 0) { List<String> list = new ArrayList<String>(); list.add("none - delete operation"); for (int c = 0; c < newOperations.size(); c++) list.add(newOperations.get(c).getName()); String retval = (String) UISupport.prompt( "Binding operation [" + name + "] not found in new interface, select new\nbinding operation to map to", "Map Operation", list.toArray(), "none/cancel - delete operation"); int ix = retval == null ? -1 : list.indexOf(retval) - 1; // delete operation? if (ix < 0) { deleteOperation(name); } // change operation? else { BindingOperation newOperation = newOperations.get(ix); WsdlOperation wsdlOperation = oldOperations.get(name); wsdlOperation.initFromBindingOperation(newOperation); fireOperationUpdated(wsdlOperation); newOperations.remove(ix); } oldOperations.remove(name); } else { deleteOperation(name); oldOperations.remove(name); } i = oldOperations.keySet().iterator(); } // add leftover new operations if (newOperations.size() > 0) { for (int c = 0; c < newOperations.size(); c++) { BindingOperation newOperation = newOperations.get(c); WsdlOperation wsdlOperation = addNewOperation(newOperation); if (createRequests) { WsdlRequest request = wsdlOperation.addNewRequest("Request 1"); try { request.setRequestContent(wsdlOperation.createRequest(true)); } catch (Exception e) { SoapUI.logError(e); } } } } }
public BindingOperation findBindingOperation( Definition definition, String bindingOperationName, String inputName, String outputName) { Binding binding = definition.getBinding(getBindingName()); return WsdlUtils.findBindingOperation(binding, bindingOperationName, inputName, outputName); }