コード例 #1
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  @SuppressWarnings("unchecked")
  private BindingTuple findBinding(WsdlContext newContext) throws Exception {
    BindingTuple tuple = new BindingTuple();
    tuple.context = newContext;

    // start by finding the old binding in the new definition
    Definition definition = newContext.getDefinition();
    Map serviceMap = definition.getAllServices();
    Iterator<String> i = serviceMap.keySet().iterator();
    while (i.hasNext()) {
      tuple.service = (Service) serviceMap.get(i.next());
      Map portMap = tuple.service.getPorts();

      Iterator i2 = portMap.keySet().iterator();
      while (i2.hasNext()) {
        tuple.port = (Port) portMap.get(i2.next());
        if (tuple.port.getBinding().getQName().equals(getBindingName())) {
          tuple.binding = tuple.port.getBinding();
        }
      }

      if (tuple.binding != null) break;
      tuple.service = null;
    }

    if (tuple.service == null && tuple.binding == null) {
      tuple.binding = definition.getBinding(getBindingName());
    }

    // missing matching binding, prompt for new one to use instead (will
    // happen if binding has been renamed)
    if (tuple.binding == null) {
      Map bindings = definition.getAllBindings();

      Object retval =
          UISupport.prompt(
              "Missing matching binding ["
                  + getBindingName()
                  + "] in definition, select new\nbinding to map to",
              "Map Binding",
              bindings.keySet().toArray());

      if (retval == null) return null;

      tuple.binding = (Binding) bindings.get(retval);
    }

    return tuple;
  }
コード例 #2
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  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>";
    }
  }
コード例 #3
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  private void updateWsaPolicy(String url, WsdlContext newContext) throws Exception {

    Definition definition = newContext.getDefinition();
    policyFlag = false;
    processPolicy(PolicyUtils.getAttachedPolicy(getBinding(), definition));
    Map<?, ?> serviceMap = definition.getAllServices();
    if (serviceMap.isEmpty()) log.info("Missing services in [" + url + "], check for bindings");
    else {
      Iterator<?> i = serviceMap.values().iterator();
      while (i.hasNext()) {
        Service service = (Service) i.next();
        Map<?, ?> portMap = service.getPorts();
        Iterator<?> i2 = portMap.values().iterator();
        while (i2.hasNext()) {
          Port port = (Port) i2.next();
          processPolicy(PolicyUtils.getAttachedPolicy(port, definition));
        }
      }
    }
  }