javax.wsdl.Import类的使用及代码示例

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

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

Import介绍

[英]This interface represents an import, and may contain a reference to the imported definition.
[中]此接口表示导入,并且可能包含对导入定义的引用。

代码示例

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

Definition importedDef = importDef.getDefinition();
  ret = importedDef.getService(name);
  ret = importedDef.getMessage(name);
  ret = importedDef.getBinding(name);

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

throws WSDLException
Import importDef = def.createImport();
  importDef.setNamespaceURI(namespaceURI);
  importDef.setLocationURI(locationURI);
    contextURI = def.getDocumentBaseURI();
    Definition importedDef = null;
    InputStream inputStream = null;
        importedDef.setExtensionRegistry(extReg);
     importDef.setDefinition(importedDef);
  importDef.setDocumentationElement(tempEl);
  importDef.addExtensibilityElement(
   parseExtensibilityElement(Import.class, tempEl, def));

代码示例来源:origin: org.eclipse/org.eclipse.wst.wsi

public void visit(Import im, Object parent, WSDLTraversalContext ctx)
{
 importFound = true;
 if (im.getDefinition() != null && im.getLocationURI() != null)
  processWSDL(im.getDefinition().getDocumentBaseURI());
}

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

importDef.getNamespaceURI(),
            pw);
DOMUtils.printAttribute(Constants.ATTR_LOCATION,
            importDef.getLocationURI(),
            pw);
printDocumentation(importDef.getDocumentationElement(), def, pw);
List extElements = importDef.getExtensibilityElements();

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

OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);
Collection<List<?>> imports = CastUtils.cast((Collection<?>)def.getImports().values());
for (List<?> lst : imports) {
  List<Import> impLst = CastUtils.cast(lst);
  for (Import imp : impLst) {
    String start = imp.getLocationURI();
    String decodedStart;
        if (done.put(decodedStart, imp.getDefinition()) == null) {
          if (imp.getDefinition() != null && imp.getDefinition().getDocumentBaseURI() != null) {
            done.put(imp.getDefinition().getDocumentBaseURI(), imp.getDefinition());
          updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start, null);
      if (done.put(decodedStart, imp.getDefinition()) == null) {
        done.put(resolvedSchemaLocation, imp.getDefinition());
        if (imp.getDefinition() != null && imp.getDefinition().getDocumentBaseURI() != null) {
          done.put(imp.getDefinition().getDocumentBaseURI(), imp.getDefinition());
        updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start,
            resolvedSchemaLocation);
if (types != null) {
  for (ExtensibilityElement el
    : CastUtils.cast(types.getExtensibilityElements(), ExtensibilityElement.class)) {
    if (el instanceof Schema) {
      updateSchemaImports(bus, (Schema)el, docBase, doneSchemas, base, parentResolvedLocation);

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

description.setProperty(WSDL_DEFINITION, def);
  description.setName(def.getQName());
  description.setBaseURI(def.getDocumentBaseURI());
  copyExtensors(description, def.getExtensibilityElements());
  copyExtensionAttributes(description, def);
  Collection<List<Import>> values = CastUtils.cast(def.getImports().values());
  for (List<Import> imports : values) {
    for (Import imp : imports) {
      if (!done.contains(imp.getDefinition())) {
        done.add(imp.getDefinition());
        copyExtensors(description, imp.getExtensibilityElements());
        copyExtensionAttributes(description, imp);
        copyExtensors(description, imp.getDefinition().getExtensibilityElements());
        copyExtensionAttributes(description, imp.getDefinition());
for (Port port : cast(serv.getPorts().values(), Port.class)) {
  if (endpointName != null
    && !endpointName.getLocalPart().equals(port.getName())) {

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

private void parseImports(Definition def, List<Definition> defList) {
  List<Import> importList = new ArrayList<>();
  Collection<List<Import>> ilist = cast(def.getImports().values());
  for (List<Import> list : ilist) {
    importList.addAll(list);
  }
  for (Import impt : importList) {
    if (!defList.contains(impt.getDefinition())) {
      defList.add(impt.getDefinition());
      parseImports(impt.getDefinition(), defList);
    }
  }
}

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

@SuppressWarnings("unchecked")
public QName getServiceQName(Definition def) {
  List<Definition> defs = new ArrayList<>();
  defs.add(def);
  Iterator<?> ite1 = def.getImports().values().iterator();
  while (ite1.hasNext()) {
    List<javax.wsdl.Import> defList = CastUtils.cast((List<?>)ite1.next());
    for (javax.wsdl.Import importDef : defList) {
      defs.add(importDef.getDefinition());
    }
  }
  String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME);
  for (Definition definition : defs) {
    if (serviceName != null) {
      for (Iterator<QName> ite = definition.getServices().keySet().iterator(); ite.hasNext();) {
        QName qn = ite.next();
        if (qn.getLocalPart().equalsIgnoreCase(serviceName.toLowerCase())) {
          return qn;
        }
      }
    }
  }
  Message msg = new Message("SERVICE_NOT_FOUND", LOG, new Object[] {serviceName});
  throw new ToolException(msg);
}

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

private javax.wsdl.Message findMessage(QName qn, Definition def, List<Definition> done) {
  javax.wsdl.Message msg = def.getMessage(qn);
  if (msg == null) {
    if (done.contains(def)) {
      return null;
    }
    done.add(def);
    Collection<List<Import>> ilist = CastUtils.cast(def.getImports().values());
    for (List<Import> list : ilist) {
      for (Import i : list) {
        if (qn.getNamespaceURI().equals(i.getDefinition().getTargetNamespace())) {
          return i.getDefinition().getMessage(qn);
        }
      }
    }
    for (List<Import> list : ilist) {
      for (Import i : list) {
        msg = findMessage(qn, i.getDefinition(), done);
        if (msg != null) {
          return msg;
        }
      }
    }
  }
  return msg;
}

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

Map baseURIwsdlNameMap) throws Exception {
Map imports = definition.getImports();
if (imports != null && (imports.size() > 0)) {
  Vector importsVector = null;
    for (Iterator importsIter = importsVector.iterator(); importsIter.hasNext();) {
      wsdlImport = (Import)importsIter.next();
      wsdlLocation = wsdlImport.getDefinition().getDocumentBaseURI();
        Definition innerDefinition = wsdlImport.getDefinition();
        writeWSDL(innerDefinition, wsdlName, changedMap, baseURIwsdlNameMap);
      wsdlImport.setLocationURI((String)baseURIwsdlNameMap.get(wsdlLocation));
if (definition.getServices().size() > 1){
  List removedServices = new ArrayList();
  List servicesList = new ArrayList();

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

public static EprMetaData getBindingForTypeId(String repId, Definition wsdlDef) {
  LOG.log(Level.FINE, "RepositoryId " + repId
      + ", wsdl namespace " + wsdlDef.getTargetNamespace());
  EprMetaData ret = new EprMetaData();
  Collection<Binding> bindings = CastUtils.cast(wsdlDef.getBindings().values());
  for (Binding b : bindings) {
    List<?> extElements = b.getExtensibilityElements();
    Iterator<?> importLists = wsdlDef.getImports().values().iterator();
    while (importLists.hasNext()) {
      List<?> imports = (List<?>) importLists.next();
      for (java.lang.Object imp : imports) {
        if (imp instanceof Import) {
          Definition importDef = ((Import)imp).getDefinition();
          LOG.log(Level.INFO, "Following import " + importDef.getDocumentBaseURI());
          ret = getBindingForTypeId(repId, importDef);

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

((Map<String, List<javax.wsdl.Import>>)definition.getImports()).entrySet()) {
if (!entry.getKey().equals(definition.getTargetNamespace())) {
  WSDLDefinition resolved = null;
  for (javax.wsdl.Import imp : entry.getValue()) {
    if (imp.getDefinition() == null)
      throw new IllegalArgumentException("Required attribute 'location' is missing.");
      wsdlDefinition.setLocation(new URI(imp.getDefinition().getDocumentBaseURI()));
      wsdlDefinition.setURI(new URI(imp.getLocationURI()));
      resolved = resolveImports(WSDLDefinition.class, wsdlDefinition, context);
      if (!resolved.isUnresolved()) {
        if (resolved.getImportedDefinitions().isEmpty()) {
          if (resolved.getDefinition().getTargetNamespace().equals(imp.getDefinition().getTargetNamespace())) {
            imp.setLocationURI(resolved.getURI().toString());
            if (def.getDefinition().getTargetNamespace().equals(imp.getDefinition().getTargetNamespace())) {
              wsdlDef.getImportedDefinitions().add(def);
              imp.setLocationURI(def.getURI().toString());
              break;

代码示例来源:origin: org.codehaus.xfire/xfire-core

protected void processImports(Definition parent)
  Collection imports = parent.getImports().values();
  for (Iterator iterator = imports.iterator(); iterator.hasNext();)
      Definition iDef = i.getDefinition();
      if (!definitionPaths.contains(i.getLocationURI())) 
        log.info("Adding wsdl definition " + i.getLocationURI() +
             " with baseURI of " + parent.getDocumentBaseURI());
        definitionPaths.add(i.getLocationURI());
          String baseURI = parent.getDocumentBaseURI();
          String resolvedLocation;
          if (baseURI == null)
            resolvedLocation = new URI(i.getLocationURI()).toString();
          else
            resolvedLocation = new URI(parent.getDocumentBaseURI()).resolve(i.getLocationURI()).toString();
          types.put(resolvedLocation, iDef.getTypes());
          throw new XFireRuntimeException("Couldn't resolve location " + i.getLocationURI(), e);

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

facade.setQName(new QName(ns, "$aggregated$"));
facade.setTargetNamespace(ns);
    javax.wsdl.Import imp = facade.createImport();
    imp.setNamespaceURI(d.getNamespace());
    imp.setDefinition(d.getDefinition());
    imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
    facade.addImport(imp);

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

Iterator iter = wsdlDefinition.getImports().values().iterator();
Vector values;
Import wsdlImport;
visitedWSDLs.add(wsdlDefinition.getDocumentBaseURI());
for (; iter.hasNext();) {
  values = (Vector)iter.next();
    wsdlImport = (Import)value;
    Definition innerDefinition = wsdlImport.getDefinition();
    if (!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) {
    wsdlImport.setLocationURI((String)processedWSDLMap.get(
        innerDefinition.getDocumentBaseURI()));

代码示例来源: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: 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.apache.ode/ode-jbi

private void addNamespaces(Definition flat, Definition def) {
  for (Iterator itImport = def.getImports().values().iterator(); itImport.hasNext();) {
    List defImports = (List) itImport.next();
    for (Iterator iter = defImports.iterator(); iter.hasNext();) {
      Import defImport = (Import) iter.next();
      addNamespaces(flat, defImport.getDefinition());
    }
  }
  for (Iterator itNs = def.getNamespaces().keySet().iterator(); itNs.hasNext();) {
    String key = (String) itNs.next();
    String val = def.getNamespace(key);
    flat.addNamespace(key, val);
  }
}

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

Definition definition = model.getDefinition();
if (definition != null) {
  for (Object imports : definition.getImports().values()) {
    List importList = (List)imports;
    for (Object i : importList) {
      Import imp = (Import)i;
      if (imp.getDefinition() != null) {
        continue;
      if (imp.getLocationURI() == null) {
        proxy.setNamespace(imp.getNamespaceURI());
        WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy, context);
        if (resolved != null && !resolved.isUnresolved()) {
          imp.setDefinition(resolved.getDefinition());
          if (!model.getImportedDefinitions().contains(resolved)) {
            model.getImportedDefinitions().add(resolved);
        String location = imp.getLocationURI();
        if (location.indexOf(' ') != -1) {
          location = location.replace(" ", "%20");
          try {
            resolved = read(null, uri, uri.toURL(), context);
            imp.setDefinition(resolved.getDefinition());
            if (!model.getImportedDefinitions().contains(resolved)) {
              model.getImportedDefinitions().add(resolved);
            URI baseURI = URI.create(model.getDefinition().getDocumentBaseURI());

代码示例来源:origin: org.jboss.ws.native/jbossws-native-core

private static void replaceWSDL11PortAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
{
 Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
 String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
 // search for matching portElement and replace the address URI
 if (modifyPortAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices()))
 {
   return;
 }
 // recursively process imports if none can be found
 if (!wsdlOneOneDefinition.getImports().isEmpty())
 {
   Iterator<?> imports = wsdlOneOneDefinition.getImports().values().iterator();
   while (imports.hasNext())
   {
    List<?> l = (List<?>)imports.next();
    Iterator<?> importsByNS = l.iterator();
    while (importsByNS.hasNext())
    {
      Import anImport = (Import)importsByNS.next();
      if (modifyPortAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices()))
      {
       return;
      }
    }
   }
 }
 
 throw MESSAGES.cannotFindPortInWsdl2(portQName);
}

相关文章