@Override
  public VelocityContext getContext() {
    VelocityContext context = super.getContext();
    if (api.getTransports().contains(",")) {
      List<String> transports =
          new ArrayList<String>(Arrays.asList(api.getTransports().split(",")));
      if (transports.contains(Constants.TRANSPORT_HTTP)
          && transports.contains(Constants.TRANSPORT_HTTPS)) {
        context.put("transport", "");
      }
    } else {
      context.put("transport", api.getTransports());
    }

    return context;
  }
  private void setServiceDefinitionForWSDL2(org.apache.woden.wsdl20.Description definition, API api)
      throws APIManagementException {
    org.apache.woden.wsdl20.Service[] serviceMap = definition.getServices();
    URL addressURI;
    try {
      for (org.apache.woden.wsdl20.Service svc : serviceMap) {
        Endpoint[] portMap = svc.getEndpoints();
        for (Endpoint endpoint : portMap) {
          EndpointElement element = endpoint.toElement();

          addressURI = endpoint.getAddress().toURL();
          if (addressURI == null) {
            break;
          } else {
            String endpointTransport =
                determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
            setAddressUrl(
                element,
                new URI(
                    APIUtil.getGatewayendpoint(endpointTransport)
                        + api.getContext()
                        + "/"
                        + api.getId().getVersion()));
          }
        }
      }

    } catch (Exception e) {
      log.error("Error occured while getting the wsdl address location", e);
      throw new APIManagementException(e);
    }
  }
  /**
   * Clear the actual service Endpoint and use Gateway Endpoint instead of the actual Endpoint.
   *
   * @param definition - {@link Definition} - WSDL4j wsdl definition
   * @throws APIManagementException
   */
  private void setServiceDefinition(Definition definition, API api) throws APIManagementException {

    Map serviceMap = definition.getAllServices();
    Iterator serviceItr = serviceMap.entrySet().iterator();
    URL addressURI;
    try {
      while (serviceItr.hasNext()) {
        Map.Entry svcEntry = (Map.Entry) serviceItr.next();
        Service svc = (Service) svcEntry.getValue();
        Map portMap = svc.getPorts();
        Iterator portItr = portMap.entrySet().iterator();
        while (portItr.hasNext()) {
          Map.Entry portEntry = (Map.Entry) portItr.next();
          Port port = (Port) portEntry.getValue();

          List<ExtensibilityElement> extensibilityElementList = port.getExtensibilityElements();
          for (int i = 0; i < extensibilityElementList.size(); i++) {

            ExtensibilityElement extensibilityElement =
                (ExtensibilityElement) port.getExtensibilityElements().get(i);

            addressURI = new URL(getAddressUrl(extensibilityElement));
            if (addressURI == null) {
              break;
            } else {
              String endpointTransport =
                  determineURLTransport(addressURI.getProtocol(), api.getTransports());
              setAddressUrl(extensibilityElement, endpointTransport, api);
            }
          }
        }
      }
    } catch (Exception e) {
      log.error("Error occured while getting the wsdl address location", e);
      throw new APIManagementException(e);
    }
  }