本文整理了Java中org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
类的一些代码示例,展示了WSDLDefinition
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WSDLDefinition
类的具体详情如下:
包路径:org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
类名称:WSDLDefinition
[英]Represents a WSDL definition. WSDLDefinition
[中]表示WSDL定义。WSDLDefinition
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace(wsdlInterface.getName().getNamespaceURI());
WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context);
if (!resolved.isUnresolved()) {
wsdlDefinition.setDefinition(resolved.getDefinition());
wsdlDefinition.setLocation(resolved.getLocation());
wsdlDefinition.setURI(resolved.getURI());
wsdlDefinition.getImportedDefinitions().addAll(resolved.getImportedDefinitions());
wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
wsdlDefinition.setUnresolved(false);
WSDLObject<PortType> portType = wsdlDefinition.getWSDLObject(PortType.class, wsdlInterface.getName());
if (portType != null) {
wsdlDefinition.setDefinition(portType.getDefinition());
wsdlInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver, monitor);
wsdlInterface.setWsdlDefinition(wsdlDefinition);
Monitor.warning(monitor, WSDLInterfaceProcessor.class.getName(),
"interface-wsdlxml-validation-messages", "WsdlInterfaceDoesNotMatch",
wsdlDefinition.getNamespace(), wsdlInterface.getName().toString() );
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public void addModel(Object resolved, ProcessorContext context) {
WSDLDefinition definition = (WSDLDefinition)resolved;
for (XSDefinition d : definition.getXmlSchemas()) {
if (contribution != null) {
contribution.getModelResolver().addModel(d, context);
}
}
List<WSDLDefinition> list = map.get(definition.getNamespace());
if (list == null) {
list = new ArrayList<WSDLDefinition>();
map.put(definition.getNamespace(), list);
}
list.add(definition);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen
private static WSDLDefinition findDefinition(WSDLDefinition wsdlDef, QName name, Class type) {
if (wsdlDef == null || name == null) {
return wsdlDef;
}
if (wsdlDef.getURI() != null) { // not a facade
Definition def = wsdlDef.getDefinition();
Map types = type == PortType.class ? def.getPortTypes() : def.getBindings();
if (types.get(name) != null) {
return wsdlDef;
}
}
for (WSDLDefinition impDef : wsdlDef.getImportedDefinitions()) {
WSDLDefinition d = findDefinition(impDef, name, type);
if (d != null) {
return d;
}
}
return null;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* Resolve a reference to a WSDL, given by a namespace and a location
* @param wsdlLocation - a string containing the WSDL location
* @param wsdlNamespace - a string containing the WSDL namespace
* @param resolver - a model resolver
* @param context
* @return - a WSDLDefinition object for the referenced WSDL, or null if the WSDL cannot be resolved
*/
private WSDLDefinition resolveWSDLDefinition( String wsdlLocation, String wsdlNamespace, ModelResolver resolver, ProcessorContext context ) {
// Resolve the WSDL definition
WSDLDefinition proxy = wsdlFactory.createWSDLDefinition();
proxy.setUnresolved(true);
proxy.setNamespace(wsdlNamespace);
if (wsdlLocation != null) {
proxy.setLocation(URI.create(wsdlLocation));
}
WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy, context);
if (resolved != null && !resolved.isUnresolved()) {
return resolved;
} else {
error(context.getMonitor(), "CannotResolveWSDLReference", resolver, wsdlLocation, wsdlNamespace);
return null;
} // end if
} // end resolveWSDLDefinition
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
Monitor monitor = context.getMonitor();
WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace(model.getNamespace());
wsdlDefinition.setNameOfBindingToResolve(model.getBindingName());
wsdlDefinition.setNameOfServiceToResolve(model.getServiceName());
wsdlDefinition.getWsdliLocations().putAll(model.getWsdliLocations());
if (resolved != null && !resolved.isUnresolved()) {
wsdlDefinition.setDefinition(resolved.getDefinition());
wsdlDefinition.setLocation(resolved.getLocation());
wsdlDefinition.setURI(resolved.getURI());
wsdlDefinition.getImportedDefinitions().addAll(resolved.getImportedDefinitions());
wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
wsdlDefinition.setUnresolved(false);
model.setUserSpecifiedWSDLDefinition(wsdlDefinition);
if (model.getBindingName() != null) {
WSDLObject<Binding> binding = wsdlDefinition.getWSDLObject(Binding.class, model.getBindingName());
if (binding != null) {
wsdlDefinition.setDefinition(binding.getDefinition());
model.setBinding(binding.getElement());
} else {
WSDLObject<Service> service = wsdlDefinition.getWSDLObject(Service.class, model.getServiceName());
if (service != null) {
wsdlDefinition.setDefinition(service.getDefinition());
model.setService(service.getElement());
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
if (wsdlDef.getDefinition() != null) {
return;
String loc = wsdlDef.getWsdliLocations().get(wsdlDef.getNamespace());
if (loc != null) {
artifactURL = new URL(loc);
} else {
if (wsdlDef.getLocation() == null) {
return;
artifactURL = wsdlDef.getLocation().toURL();
wsdlImports.putAll(wsdlDef.getWsdliLocations());
WSDLLocatorImpl locator = new WSDLLocatorImpl(context, artifactURL, is, wsdlImports);
Definition definition = reader.readWSDL(locator);
wsdlDef.setDefinition(definition);
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace(entry.getKey());
WSDLDefinition resolved = null;
for (javax.wsdl.Import imp : entry.getValue()) {
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())) {
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
if (unresolved.getDefinition() == null && unresolved.getLocation() != null) {
try {
map.put(unresolved.getNamespace(), list);
resolved = aggregate(list, context);
if (unresolved.getNamespace().equals(resolved.getDefinition().getTargetNamespace())) {
resolved.setNamespace(resolved.getDefinition().getTargetNamespace());
resolved.setUnresolved(false);
resolved.setURI(unresolved.getURI());
return modelClass.cast(resolved);
if (artifact.getModel() instanceof WSDLDefinitionImpl) {
String namespace = ((WSDLDefinitionImpl)artifact.getModel()).getNamespace();
if (unresolved.getNamespace().equals(namespace)) {
WSDLDefinition wsdlDefinition = (WSDLDefinition)artifact.getModel();
if (wsdlDefinition.getDefinition() == null) {
loadDefinition(wsdlDefinition, context);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
public void resolve(WSDLDefinition model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
if (model == null) return;
Monitor monitor = context.getMonitor();
Definition definition = model.getDefinition();
if (definition != null) {
for (Object imports : definition.getImports().values()) {
proxy.setUnresolved(true);
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);
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());
URI locationURI = baseURI.resolve(location);
WSDLDefinition resolved;
try {
resolved = read(null, locationURI, locationURI.toURL(), context);
imp.setDefinition(resolved.getDefinition());
if (!model.getImportedDefinitions().contains(resolved)) {
model.getImportedDefinitions().add(resolved);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace("nonamespace");
wsdlDefinition.getWsdliLocations().put("nonamespace", wsdlInterfaceContract.getLocation());
wsdlDefinition.setLocation(new URI(wsdlInterfaceContract.getLocation()));
} else {
WSDLDefinition artifactWSDLDefinition = artifact.getModel();
wsdlDefinition = wsdlFactory.createWSDLDefinition();
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace(artifactWSDLDefinition.getNamespace());
wsdlDefinition.getWsdliLocations().put(artifactWSDLDefinition.getNamespace(),
artifact.getLocation());
wsdlDefinition.setLocation(new URI(artifact.getLocation()));
break;
wsdlDefinition.setUnresolved(true);
wsdlDefinition = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context);
PortType portType = (PortType)wsdlDefinition.getDefinition().getAllPortTypes().values().iterator().next();
try {
WSDLInterface newWSDLInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver, monitor);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
wsdlDefinition.setDefinition(readDefinition);
wsdlDefinition.setLocation(new URI(xmlString.getBaseURI()));
((Map<String, List<javax.wsdl.Import>>)wsdlDefinition.getDefinition().getImports()).entrySet()) {
for (javax.wsdl.Import imp : entry.getValue()) {
String wsdlName = imp.getDefinition().getDocumentBaseURI();
WSDLInfo wsdlInfo = (WSDLInfo)xmlMap.get(getFilenameWithoutPath(wsdlName));
wsdlDefinition.getImportedDefinitions().add(wsdlInfo.getWsdlDefintion());
Types types = wsdlDefinition.getDefinition().getTypes();
if ( types != null){
xsDefinition.setSchema(schema);
xsDefinition.setLocation(URI.create(xmlString.getBaseURI() + "#" + index));
wsdlDefinition.getXmlSchemas().add(xsDefinition);
index++;
WSDLDefinition topWSDLDefinition = topWSDL.getWsdlDefintion();
PortType portType = (PortType)topWSDLDefinition.getDefinition().getAllPortTypes().values().iterator().next();
WSDLInterface readWSDLInterface = wsdlFactory.createWSDLInterface(portType, topWSDLDefinition, extensibleResolver, null);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setLocation(doc.toURI());
Attribute[] attrs = helper.readAttributes(doc, attr1, attr2);
wsdlDefinition.setNamespace(attr1.getValues().get(0));
wsdlDefinition.setUnresolved(false);
wsdlDefinition.setDefinition(null);
wsdlDefinition.getXmlSchemas().add(xsd);
xsd.setUnresolved(false);
xsd.setSchema(null);
wsdlDefinition.getXmlSchemas().add(xsd);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
String ns = definitions.get(0).getNamespace();
facade.setQName(new QName(ns, "$aggregated$"));
facade.setTargetNamespace(ns);
if (d.getDefinition() != null) {
javax.wsdl.Import imp = facade.createImport();
imp.setNamespaceURI(d.getNamespace());
imp.setDefinition(d.getDefinition());
imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
facade.addImport(imp);
aggregated.getImportedDefinitions().add(d);
List<ExtensibilityElement> extElements = (List<ExtensibilityElement>) d.getDefinition().getExtensibilityElements();
for( ExtensibilityElement extElement : extElements ) {
facade.addExtensibilityElement(extElement);
aggregated.setDefinition(facade);
definitions.clear();
definitions.add(aggregated);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-wsdl
String namespace = ((WSDLDefinition)unresolved).getNamespace();
if (namespace == null) {
return modelClass.cast(unresolved);
if (((WSDLDefinition)unresolved).getWsdliLocations().containsKey(namespace)) {
try {
loadDefinition(((WSDLDefinition)unresolved), context);
} catch (ContributionReadException e) {
context.getMonitor().error(context.getMonitor(), this, "interface-wsdlxml-validation-messages", "wsdliLocationException", e, ((WSDLDefinition)unresolved).getNamespace());
namespaceImport.getModelResolver().resolveModel(WSDLDefinition.class,
(WSDLDefinition)unresolved, context);
if (!resolved.isUnresolved()) {
return modelClass.cast(resolved);
import_.getModelResolver().resolveModel(WSDLDefinition.class,
(WSDLDefinition)unresolved, context);
if (!resolved.isUnresolved()) {
return modelClass.cast(resolved);
if (resolved != null && !resolved.isUnresolved()) {
if (inputWSDL.getNameOfPortTypeToResolve() != null){
if (outputWSDL.getWSDLObject(PortType.class, inputWSDL.getNameOfPortTypeToResolve()) == null){
return modelClass.cast(unresolved);
if (inputWSDL.getNameOfBindingToResolve() != null){
if (outputWSDL.getWSDLObject(Binding.class, inputWSDL.getNameOfBindingToResolve()) == null){
return modelClass.cast(unresolved);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
return ((WSDLInterface)interfaze).getWsdlDefinition().getDefinition();
binding.setUndefined(false);
definition.addBinding(binding);
wsdlDefinition.setBinding(binding);
wsdlDefinition.getXmlSchemas().add(xsDef);
if (wsdlDefinition.getXmlSchemaElement(wrapperName) != null) {
wrappers.remove(wrapperName);
xsDef = wsdlDefinition.getSchema(targetNS);
if (xsDef != null) {
schemaDoc = xsDef.getDocument();
index++;
wrapperXSDs.put(targetNS, xsDef);
wsdlDefinition.getXmlSchemas().add(xsDef);
for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
xsDef.setSchema(null);
xsDef.setSchemaCollection(null);
for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-bpel
wsdlDefinitions.add(theWSDL.getDefinition());
for (WSDLDefinition importedWSDL: theWSDL.getImportedDefinitions()) {
wsdlDefinitions.add(importedWSDL.getDefinition());
thePortTypes.add( portType );
WSDLObject<PortType> wsdlPortType = theWSDL.getWSDLObject(PortType.class, portType.getQName());
WSDLInterface wsdlInterface;
if (wsdlPortType != null) {
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
Definition definition = wsdlDefinition.getDefinition();
WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
String baseURI = null;
if (wsdlDefinition.getLocation() != null) {
baseURI = wsdlDefinition.getLocation().toString();
} else {
baseURI = "generated.wsdl";
outStream.write(separator);
writer.writeWSDL(definition, outStream);
for (WSDLDefinition importedWSDLDefintion : wsdlDefinition.getImportedDefinitions()){
outStream.write(separator);
baseURI = importedWSDLDefintion.getLocation().toString();
outStream.write(baseURI.getBytes());
outStream.write(separator);
writer.writeWSDL(importedWSDLDefintion.getDefinition(), outStream);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws
protected void setIsDocumentStyle() {
if (binding == null) {
if (userSpecifiedWSDLDefinition != null && userSpecifiedWSDLDefinition.getDefinition() != null) {
Message firstMessage =
(Message)userSpecifiedWSDLDefinition.getDefinition().getMessages().values().iterator().next();
Part firstPart = (Part)firstMessage.getParts().values().iterator().next();
if (firstPart.getTypeName() != null) {
isDocumentStyle = false;
return;
}
}
// default to document style
isDocumentStyle = true;
return;
} else {
for (Object ext : binding.getExtensibilityElements()) {
if (ext instanceof SOAPBinding) {
isDocumentStyle = !"rpc".equals(((SOAPBinding)ext).getStyle());
return;
}
}
isDocumentStyle = true;
return;
}
}
代码示例来源: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-interface-wsdl
if ( d.getDefinition() == definition ) {
XmlSchemaElement element = d.getXmlSchemaElement(name);
if ( element != null )
return element;
XmlSchemaElement element = d.getXmlSchemaElement(name);
if ( element != null )
return element;
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
return null;
Definition def = wsdlDefinition.getDefinition();
if (wsdlDefinition.getBinding() == null) {
if (wsdlDefinition != null && wsdlDefinition.getDefinition() != null){
Message firstMessage = (Message)wsdlDefinition.getDefinition().getMessages().values().iterator().next();
Part firstPart = (Part)firstMessage.getParts().values().iterator().next();
if (firstPart.getTypeName() != null){
内容来源于网络,如有侵权,请联系作者删除!