Пример #1
0
  public void walk() {
    begin(serviceInfo);
    begin(serviceInfo.getInterface());

    for (OperationInfo o : serviceInfo.getInterface().getOperations()) {
      begin(o);

      visitOperation(o);

      end(o);
    }

    end(serviceInfo.getInterface());
    for (EndpointInfo endpointInfo : serviceInfo.getEndpoints()) {
      begin(endpointInfo);
      end(endpointInfo);
    }
    for (BindingInfo bindingInfo : serviceInfo.getBindings()) {
      begin(bindingInfo);
      end(bindingInfo);
    }
    end(serviceInfo);
  }
  public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) {
    SoapBindingConfiguration config;
    if (conf instanceof SoapBindingConfiguration) {
      config = (SoapBindingConfiguration) conf;
    } else {
      config = new SoapBindingConfiguration();
    }
    if (WSDLConstants.NS_SOAP12.equals(bindingid)
        || WSDLConstants.NS_SOAP12_HTTP_BINDING.equals(bindingid)) {
      config.setVersion(Soap12.getInstance());
      config.setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    SoapBindingInfo info = new SoapBindingInfo(si, bindingid, config.getVersion());

    info.setName(config.getBindingName(si));
    info.setStyle(config.getStyle());

    info.setTransportURI(config.getTransportURI());

    if (config.isMtomEnabled()) {
      info.setProperty(Message.MTOM_ENABLED, Boolean.TRUE);
    }

    for (OperationInfo op : si.getInterface().getOperations()) {
      SoapOperationInfo sop = new SoapOperationInfo();
      sop.setAction(config.getSoapAction(op));
      sop.setStyle(config.getStyle(op));

      BindingOperationInfo bop =
          info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());

      bop.addExtensor(sop);

      info.addOperation(bop);

      BindingMessageInfo bInput = bop.getInput();
      if (bInput != null) {
        MessageInfo input = null;
        BindingMessageInfo unwrappedMsg = bInput;
        if (bop.isUnwrappedCapable()) {
          input = bop.getOperationInfo().getUnwrappedOperation().getInput();
          unwrappedMsg = bop.getUnwrappedOperation().getInput();
        } else {
          input = bop.getOperationInfo().getInput();
        }
        setupHeaders(bop, bInput, unwrappedMsg, input, config);
      }

      BindingMessageInfo bOutput = bop.getOutput();
      if (bOutput != null) {
        MessageInfo output = null;
        BindingMessageInfo unwrappedMsg = bOutput;
        if (bop.isUnwrappedCapable()) {
          output = bop.getOperationInfo().getUnwrappedOperation().getOutput();
          unwrappedMsg = bop.getUnwrappedOperation().getOutput();
        } else {
          output = bop.getOperationInfo().getOutput();
        }
        setupHeaders(bop, bOutput, unwrappedMsg, output, config);
      }
    }

    try {
      createSoapBinding(info);
    } catch (WSDLException e) {
      e.printStackTrace();
    }

    return info;
  }