javax.wsdl.Import.setLocationURI()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(256)

本文整理了Java中javax.wsdl.Import.setLocationURI()方法的一些代码示例,展示了Import.setLocationURI()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Import.setLocationURI()方法的具体详情如下:
包路径:javax.wsdl.Import
类名称:Import
方法名:setLocationURI

Import.setLocationURI介绍

[英]Set the location URI of this import.
[中]设置此导入的位置URI。

代码示例

代码示例来源:origin: wsdl4j/wsdl4j

importDef.setLocationURI(locationURI);

代码示例来源:origin: axis/axis

/**
 * Create and add an import
 * 
 * @param def <code>Definition</code>
 * @param tns target namespace
 * @param loc target location
 */
protected void writeImport(Definition def, String tns, String loc) {
  Import imp = def.createImport();
  imp.setNamespaceURI(tns);
  if ((loc != null) && !loc.equals("")) {
    imp.setLocationURI(loc);
  }
  def.addImport(imp);
}

代码示例来源:origin: org.apache.axis/axis

/**
 * Create and add an import
 * 
 * @param def <code>Definition</code>
 * @param tns target namespace
 * @param loc target location
 */
protected void writeImport(Definition def, String tns, String loc) {
  Import imp = def.createImport();
  imp.setNamespaceURI(tns);
  if ((loc != null) && !loc.equals("")) {
    imp.setLocationURI(loc);
  }
  def.addImport(imp);
}

代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis

/**
 * Create and add an import
 * 
 * @param def <code>Definition</code>
 * @param tns target namespace
 * @param loc target location
 */
protected void writeImport(Definition def, String tns, String loc) {
  Import imp = def.createImport();
  imp.setNamespaceURI(tns);
  if ((loc != null) && !loc.equals("")) {
    imp.setLocationURI(loc);
  }
  def.addImport(imp);
}

代码示例来源:origin: org.ow2.orchestra/orchestra-axis

private File createWsdlFile(final Definition wsdlDefinition, final File wsdlDir) {
 try {
  final Map<String, List<Import>> imports = wsdlDefinition.getImports();
  if (!imports.isEmpty()) {
   for (final List<Import> l : imports.values()) {
    for (final Import impor : l) {
     final Definition importedDefinition = impor.getDefinition();
     final File importFile = this.createWsdlFile(importedDefinition, wsdlDir);
     impor.setLocationURI(importFile.getName());
    }
   }
  }
  final File wsdlFile = File.createTempFile("generated", ".wsdl", wsdlDir);
  final FileOutputStream fos = new FileOutputStream(wsdlFile);
  try {
   WsdlUtil.writeWsdl(wsdlDefinition, fos);
  } finally {
   fos.close();
  }
  return wsdlFile;
 } catch (final IOException e) {
  throw new OrchestraRuntimeException(e);
 }
}

代码示例来源:origin: apache/cxf

public void addWSDLDefinitionImport(Definition rootDefn, Definition defn, String prefix, File file) {
  if (rootDefn.getImports().get(defn.getTargetNamespace()) == null && !".wsdl".equals(file.getName())) {
    // Only import if not already done to prevent multiple imports of the same file
    // in the WSDL. Also watch out for empty fileNames, which by this point in the
    // code would show up as ".wsdl".
    Import importDefn = rootDefn.createImport();
    if (!ignoreImports) {
      importDefn.setLocationURI(file.toURI().toString());
    }
    importDefn.setNamespaceURI(defn.getTargetNamespace());
    rootDefn.addImport(importDefn);
  }
  if (!rootDefn.getNamespaces().values().contains(defn.getTargetNamespace())) {
    rootDefn.addNamespace(prefix, defn.getTargetNamespace());
  }
  if (!importedDefns.containsKey(file)) {
    importedDefns.put(file, defn);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private void updateWSDLocations() {
  for (WSDLInfo wsdlInfo : wsdls.values()) {
    Definition definition = wsdlInfo.getWSDLDefinition();
    ArrayList<String> wsdlDependancies = wsdlInfo.getWSDLDependencies();
    Vector[] importVector = (Vector[])definition.getImports().values().toArray(new Vector[definition.getImports().values().size()]);
    int count = 0;
    for (String wsdlDependancy : wsdlDependancies) {
      Vector values = importVector[count];
      WSDLInfo dependantWSDLInfo = wsdls.get(wsdlDependancy);
      dependantWSDLInfo.getProposedRegistryURL();
      for (Object value : values) {
        Import importedWSDL = (Import) value;
        String relativeSchemaPath =  WSDLUtil.computeRelativePathWithVersion(wsdlInfo.getProposedRegistryURL(),
            dependantWSDLInfo.getProposedRegistryURL(), registry);
        importedWSDL.setLocationURI(relativeSchemaPath);
      }
      count++;
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

private void updateWSDLocations() {
  for (WSDLInfo wsdlInfo : wsdls.values()) {
    Definition definition = wsdlInfo.getWSDLDefinition();
    ArrayList<String> wsdlDependencies = wsdlInfo.getWSDLDependencies();
    Vector[] importVector = (Vector[])definition.getImports().values().toArray(new Vector[definition.getImports().values().size()]);
    int count = 0;
    for (String wsdlDependancy : wsdlDependencies) {
      Vector values = importVector[count];
      WSDLInfo dependantWSDLInfo = wsdls.get(wsdlDependancy);
      dependantWSDLInfo.getProposedRegistryURL();
      for (Object value : values) {
        Import importedWSDL = (Import) value;
        String relativeSchemaPath =  WSDLUtil.computeRelativePathWithVersion(wsdlInfo.getProposedRegistryURL(),
            dependantWSDLInfo.getProposedRegistryURL(), registry);
        importedWSDL.setLocationURI(relativeSchemaPath);
      }
      count++;
    }
  }
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

originalImprotString = wsdlImport.getLocationURI();
if (originalImprotString.indexOf("://") == -1 && originalImprotString.indexOf("?wsdl=") == -1){
  wsdlImport.setLocationURI(this.getServiceEPR() + "?wsdl=" + originalImprotString);

代码示例来源:origin: reficio/soap-ws

wsdlImport.setLocationURI((String) baseURIwsdlNameMap.get(wsdlLocation));

代码示例来源:origin: apache/axis2-java

originalImprotString = wsdlImport.getLocationURI();
if (originalImprotString.indexOf("://") == -1 && originalImprotString.indexOf("?wsdl=") == -1){
  wsdlImport.setLocationURI(this.getServiceEPR() + "?wsdl=" + originalImprotString);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen

private static boolean addImport(QName name,
                 Class type,
                 WSDLDefinition wsdlDef,
                 Definition newDef,
                 List<WSDLDefinition> imports) {
  String namespace = name.getNamespaceURI();
  if (newDef.getImports(namespace) == null) {
    WSDLDefinition impDef = findDefinition(wsdlDef, name, type);
    if (impDef != null) {
      Import imp = newDef.createImport();
      imp.setNamespaceURI(namespace);
      imp.setLocationURI(impDef.getURI().toString());
      imp.setDefinition(impDef.getDefinition());
      newDef.addNamespace("ns" + imports.size(), namespace);
      newDef.addImport(imp);
      imports.add(impDef);
      return true;
    } else {
      // import was not added because element not found
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

private static boolean addImport(QName name,
                 Class type,
                 WSDLDefinition wsdlDef,
                 Definition newDef,
                 List<WSDLDefinition> imports) {
  String namespace = name.getNamespaceURI();
  if (newDef.getImports(namespace) == null) {
    WSDLDefinition impDef = findDefinition(wsdlDef, name, type);
    if (impDef != null) {
      Import imp = newDef.createImport();
      imp.setNamespaceURI(namespace);
      imp.setLocationURI(impDef.getURI().toString());
      imp.setDefinition(impDef.getDefinition());
      newDef.addNamespace("ns" + imports.size(), namespace);
      newDef.addImport(imp);
      imports.add(impDef);
      return true;
    } else {
      // import was not added because element not found
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.apache.servicemix/servicemix-common

public static Definition createImportDef(Definition definition, String targetNamespace, String importUri)
  throws Exception {
  // Create definition
  Definition def = WSDLFactory.newInstance().newDefinition();
  def.setTargetNamespace(targetNamespace);
  // Add namespaces
  Map<?, ?> namespaces = definition.getNamespaces();
  for (Iterator<?> iter = namespaces.keySet().iterator(); iter.hasNext();) {
    String prefix = (String) iter.next();
    String uri = definition.getNamespace(prefix);
    def.addNamespace(prefix, uri);
  }
  def.addNamespace("tns", targetNamespace);
  def.addNamespace("tnspt", definition.getTargetNamespace());
  // Create import
  Import imp = def.createImport();
  imp.setNamespaceURI(definition.getTargetNamespace());
  imp.setLocationURI(importUri);
  imp.setDefinition(definition);
  def.addImport(imp);
  return def;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

imp.setNamespaceURI(d.getNamespace());
imp.setDefinition(d.getDefinition());
imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
facade.addImport(imp);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl

imp.setNamespaceURI(d.getNamespace());
imp.setDefinition(d.getDefinition());
imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
facade.addImport(imp);

代码示例来源:origin: org.wso2.wsdl.validator/wsdl-validator

importDef.setLocationURI(location);

代码示例来源:origin: org.apache.cxf/cxf-rt-core

wsdlImport.setDefinition(portTypeDef);
wsdlImport.setNamespaceURI(tns);
wsdlImport.setLocationURI(service.getInterface().getName().getLocalPart() + ".wsdl");
definition.addImport(wsdlImport);
addNamespace(getPrefix(tns), tns, definition);

代码示例来源:origin: apache/cxf

wsdlImport.setDefinition(portTypeDef);
wsdlImport.setNamespaceURI(tns);
wsdlImport.setLocationURI(service.getInterface().getName().getLocalPart() + ".wsdl");
definition.addImport(wsdlImport);
addNamespace(getPrefix(tns), tns, definition);

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

wsdlImport.setDefinition(portTypeDef);
wsdlImport.setNamespaceURI(tns);
wsdlImport.setLocationURI(service.getInterface().getName().getLocalPart() + ".wsdl");
definition.addImport(wsdlImport);
addNamespace(getPrefix(tns), tns, definition);

相关文章