Menu

extensions

redmitry

Working with WSDL 2.0 extensions.

tinyWSDL provides two ways to work with WSDL extensions.
First, it is possible to access to all "unknown" attributes and elements directly:

public String getExtensionAttribute(QName name);
public String setExtensionAttribute(QName name, String value);    
public List<Element> getExtensionElements(QName name);
public void addExtensionElement(QName name, Element extElement);
public void removeExtensionElement(Element extElement);


These methods are implemented in all WSDL 2.0 Components.
Note that no parsing is performed and extensions are represented as DOM Element objects.

QName attribute = new QName("http://unknown", "param");
description.setExtensionAttribute(attribute, "123");


Usually extensions are defined in their own namespaces.
Even more flexibility may be achieved using tinyWSDL extension mechanism:

WSDLComponentExtensions extensions = description.getComponentExtensions(URI.create("http://unknown"));
Map<QName, String> attributes = extensions.getExtensionAttributes();


For convenience tinyWSDL implements all WSDL 2.0 Adjuncts extensions, so there is no need to use DOM model.

SOAPEndpointExtensions extensions = (SOAPEndpointExtensions)endpoint.getComponentExtensions(WSDLPredefinedExtension.SOAP.URI);
extensions.setHttpAuthenticationRealm("user");
extensions.setHttpAuthenticationScheme(HTTPAuthenticationScheme.BASIC);

Here WSDLPredefinedExtension enumeration contains namespaces for WSDL 2.0 standard extensions.


Semantic Annotations for WSDL and XML Schema (SAWSDL) is also implemented as an extension.

SAWSDLInterfaceMessageReferenceExtensions ext = (SAWSDLInterfaceMessageReferenceExtensions)input.getComponentExtensions(WSDLPredefinedExtension.SAWSDL.URI);
ext.addModelReference(URI.create("http://example.com/#ref"));

Note that in case when tinyXMLSchema is used it is also possible to annotate the referenced xs:element in the XML Schema.

SAWSDLElementDeclarationExtensions elementExt = ext.getSAWSDLElementDeclarationExtensions();
elementExt.addModelReference(URI.create("http://example.com/#ref"));

Related

Wiki: Home
Wiki: schema

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.