org.apache.juddi.v3.client.mapping
Class WSDL2UDDI

java.lang.Object
  extended by org.apache.juddi.v3.client.mapping.WSDL2UDDI

public class WSDL2UDDI
extends Object

This class implements the OASIS 'Using WSDL in a UDDI Registry, Version 2.0.2' technote. This class creates a detailed mapping of WSDL 1.1 artifacts to the UDDI V3 data model.

Author:
Kurt T Stam

Constructor Summary
WSDL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties)
          Required Properties are: businessName, for example: 'Apache' nodeName, for example: 'uddi.example.org_80' keyDomain, for example: juddi.apache.org Optional Properties are: lang: for example: 'nl'
 
Method Summary
protected  org.uddi.api_v3.BusinessService createBusinessService(QName serviceQName, javax.wsdl.Definition wsdlDefinition)
          Creates a UDDI Business Service.
 org.uddi.api_v3.BusinessServices createBusinessServices(javax.wsdl.Definition wsdlDefinition)
          Creates a business service based off of a WSDL definition
No changes are made to the UDDI endpoints using this method
Example Code:
static org.uddi.api_v3.FindTModel createFindBindingTModelForPortType(String portType, String namespace)
          Builds a finder to find the binding tModels for a portType.
static org.uddi.api_v3.FindTModel createFindPortTypeTModelForPortType(String portTypeName, String namespace)
          Builds a finder to find the portType tModels for a portType.
protected  org.uddi.api_v3.BindingTemplate createWSDLBinding(QName serviceQName, String portName, URL serviceUrl, javax.wsdl.Definition wsdlDefinition)
           
 Set<org.uddi.api_v3.TModel> createWSDLBindingTModels(String wsdlURL, Map<QName,javax.wsdl.Binding> bindings)
          2.4.2 wsdl:binding -> uddi:tModel
 Set<org.uddi.api_v3.TModel> createWSDLPortTypeTModels(String wsdlURL, Map<QName,javax.wsdl.PortType> portTypes)
          2.4.1 wsdl:portType -> uddi:tModel
 String getKeyDomainURI()
           
 String getLang()
           
protected static org.uddi.api_v3.KeyedReference newKeyedReference(String tModelKey, String keyName, String value)
           
 ServiceRegistrationResponse registerBusinessService(QName serviceQName, String portName, URL serviceUrl, javax.wsdl.Definition wsdlDefinition)
           
 org.uddi.api_v3.BusinessServices registerBusinessServices(javax.wsdl.Definition wsdlDefinition)
           
 void setKeyDomain(String keyDomainURI)
           
 void setLang(String lang)
           
 String unRegisterBusinessService(QName serviceName, String portName, URL serviceUrl)
           
 String[] unRegisterBusinessServices(javax.wsdl.Definition wsdlDefinition)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSDL2UDDI

public WSDL2UDDI(UDDIClerk clerk,
                 URLLocalizer urlLocalizer,
                 Properties properties)
          throws org.apache.commons.configuration.ConfigurationException
Required Properties are: businessName, for example: 'Apache' nodeName, for example: 'uddi.example.org_80' keyDomain, for example: juddi.apache.org Optional Properties are: lang: for example: 'nl'

Parameters:
clerk - - can be null if register/unregister methods are not used.
urlLocalizer - - A reference to an custom
properties -
Throws:
org.apache.commons.configuration.ConfigurationException
Method Detail

registerBusinessServices

public org.uddi.api_v3.BusinessServices registerBusinessServices(javax.wsdl.Definition wsdlDefinition)
                                                          throws RemoteException,
                                                                 org.apache.commons.configuration.ConfigurationException,
                                                                 TransportException,
                                                                 javax.wsdl.WSDLException
Throws:
RemoteException
org.apache.commons.configuration.ConfigurationException
TransportException
javax.wsdl.WSDLException

registerBusinessService

public ServiceRegistrationResponse registerBusinessService(QName serviceQName,
                                                           String portName,
                                                           URL serviceUrl,
                                                           javax.wsdl.Definition wsdlDefinition)
                                                    throws RemoteException,
                                                           org.apache.commons.configuration.ConfigurationException,
                                                           TransportException,
                                                           javax.wsdl.WSDLException
Throws:
RemoteException
org.apache.commons.configuration.ConfigurationException
TransportException
javax.wsdl.WSDLException

unRegisterBusinessServices

public String[] unRegisterBusinessServices(javax.wsdl.Definition wsdlDefinition)
                                    throws RemoteException,
                                           org.apache.commons.configuration.ConfigurationException,
                                           TransportException,
                                           MalformedURLException
Throws:
RemoteException
org.apache.commons.configuration.ConfigurationException
TransportException
MalformedURLException

unRegisterBusinessService

public String unRegisterBusinessService(QName serviceName,
                                        String portName,
                                        URL serviceUrl)
                                 throws RemoteException,
                                        org.apache.commons.configuration.ConfigurationException,
                                        TransportException
Throws:
RemoteException
org.apache.commons.configuration.ConfigurationException
TransportException

getKeyDomainURI

public String getKeyDomainURI()

setKeyDomain

public void setKeyDomain(String keyDomainURI)

getLang

public String getLang()

setLang

public void setLang(String lang)

createWSDLBindingTModels

public Set<org.uddi.api_v3.TModel> createWSDLBindingTModels(String wsdlURL,
                                                            Map<QName,javax.wsdl.Binding> bindings)
                                                     throws javax.wsdl.WSDLException

2.4.2 wsdl:binding -> uddi:tModel

A wsdl:binding MUST be modeled as a uddi:tModel. The minimum information that must be captured about a binding is its entity type, its local name, its namespace, the location of the WSDL document that defines the binding, the portType that it implements, its protocol, and, optionally, the transport information. Capturing the entity type enables users to search for tModels that represent binding artifacts. Capturing the local name, namespace, and WSDL location enables users to locate the definition of the specified binding artifact. The link to the portType enables users to search for bindings that implement a particular portType.

A wsdl:binding corresponds to a WSDL service interface definition as defined by the mapping in the Version 1 Best Practice. To maintain compatibility with the previous mapping, the binding must also be characterized as type "wsdlSpec".

The wsdl:binding information is captured as follows:

The uddi:name element of the tModel MUST be the value of the name attribute of the wsdl:binding.

The tModel MUST contain a categoryBag, and the categoryBag MUST contain at least the following keyedReference elements:

  1. A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
  2. A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue of the tModelKey that models the wsdl:portType to which the wsdl:binding relates.
  3. A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of "wsdlSpec" for backward compatibility[1].
  4. One or two keyedReferences as required to capture the protocol and optionally the transport information refer to the next section.

If the wsdl:binding has a targetNamespace then the categoryBag MUST also contain an additional keyedReference with a tModelKey of the XML Namespace category system and a keyValue of the target namespace of the wsdl:definitions element that contains the wsdl:binding. If the targetNamespace is absent from the binding, a categoryBag MUST NOT contain a keyedReference to the XML Namespace category system.

The tModel MUST contain an overviewDoc with an overviewURL containing the location of the WSDL document that describes the wsdl:binding.

2.4.2.1 wsdl:binding Extensions

Information about the protocol and transport, if applicable, specified in an extension to the wsdl:binding is used to categorize the binding tModel as described in the following sections. This information is specified using two of the category systems defined in this Technical Note:

  1. Protocol Categorization
  2. Transport Categorization

The valid values for the Protocol Categorization category system are tModelKeys of tModels that are categorized as protocol tModels. Similarly, the valid values for the Transport Categorization category system are tModelKeys of tModels that are categorized as transport tModels.

The reason for having these two categorization schemes that take tModel keys as values is to allow other standard or proprietary protocols and transports to be defined and used in the same way as the standard SOAP and HTTP protocols and transport.

2.4.2.1.1 soap:binding

If the wsdl:binding contains a soap:binding extensibility element from the http://schemas.xmlsoap.org/wsdl/soap/ namespace then the categoryBag MUST include a keyedReference with a tModelKey of the Protocol Categorization category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

If the value of the transport attribute of the soap:binding element is http://schemas.xmlsoap.org/soap/http then the categoryBag MUST include a keyedReference with a tModelKey of the Transport Categorization category system and a keyValue of the tModelKey of the HTTP Transport tModel.

If the value of the transport attribute is anything else, then the bindingTemplate MUST include an additional keyedReference with a tModelKey of the Transport Categorization category system and a keyValue of the tModelKey of an appropriate transport tModel.

2.4.2.1.2 http:binding

If the wsdl:binding contains an http:binding extensibility element from the http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST include a keyedReference with a tModelKey of the Protocol Categorization category system and a keyValue of the tModelKey of the HTTP Protocol tModel.

Note that this is a different tModel from the HTTP Transport tModel, and in this case there is no separate transport tModel, and therefore no keyedReference in the categoryBag from the Transport Categorization category system.

2.4.2.1.3 Other wsdl:binding Extensions

Other wsdl:binding extensibility elements are handled in a similar fashion. It is assumed that vendors who provide other bindings will provide the appropriate protocol and transport tModels.

Example Code
 URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
 String domain = url.getHost();
 ReadWSDL rw = new ReadWSDL();
 Definition wsdlDefinition = rw.readWSDL(url);
 properties.put("keyDomain", domain);
 properties.put("businessName", domain);
 properties.put("serverName", url.getHost());
 properties.put("serverPort", url.getPort());
 wsdlURL = wsdlDefinition.getDocumentBaseURI();
 WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 Map allBindings = wsdlDefinition.getAllBindings();
 Set createWSDLBindingTModels = wsdl2UDDI.createWSDLBindingTModels(url.toString(), allBindings);
 

Parameters:
wsdlURL -
binding - Map
Returns:
set of WSDL Binding tModels
Throws:
javax.wsdl.WSDLException

createWSDLPortTypeTModels

public Set<org.uddi.api_v3.TModel> createWSDLPortTypeTModels(String wsdlURL,
                                                             Map<QName,javax.wsdl.PortType> portTypes)
                                                      throws javax.wsdl.WSDLException

2.4.1 wsdl:portType -> uddi:tModel

A wsdl:portType MUST be modeled as a uddi:tModel.

The minimum information that must be captured about a portType is its entity type, its local name, its namespace, and the location of the WSDL document that defines the portType. Capturing the entity type enables users to search for tModels that represent portType artifacts. Capturing the local name, namespace, and WSDL location enables users to locate the definition of the specified portType artifact.

The wsdl:portType information is captured as follows:

The uddi:name element of the tModel MUST be the value of the name attribute of the wsdl:portType.

The tModel MUST contain a categoryBag, and the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "portType".

If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an additional keyedReference with a tModelKey of the XML Namespace category system and a keyValue of the target namespace of the wsdl:definitions element that contains the wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag MUST NOT contain a keyedReference to the XML Namespace category system.

The tModel MUST contain an overviewDoc with an overviewURL containing the location of the WSDL document that describes the wsdl:portType.

Example Code
 URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
 String domain = url.getHost();
 ReadWSDL rw = new ReadWSDL();
 Definition wsdlDefinition = rw.readWSDL(url);
 properties.put("keyDomain", domain);
 properties.put("businessName", domain);
 properties.put("serverName", url.getHost());
 properties.put("serverPort", url.getPort());
 wsdlURL = wsdlDefinition.getDocumentBaseURI();
 WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 Map portTypes = (Map) wsdlDefinition.getAllPortTypes();
 Set portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
 

Parameters:
wsdlURL - This is used to set the Overview URL
portType - Map
Returns:
set of WSDL PortType tModels
Throws:
javax.wsdl.WSDLException

newKeyedReference

protected static org.uddi.api_v3.KeyedReference newKeyedReference(String tModelKey,
                                                                  String keyName,
                                                                  String value)

createFindBindingTModelForPortType

public static org.uddi.api_v3.FindTModel createFindBindingTModelForPortType(String portType,
                                                                            String namespace)
Builds a finder to find the binding tModels for a portType.

Parameters:
processName -
Returns:

createFindPortTypeTModelForPortType

public static org.uddi.api_v3.FindTModel createFindPortTypeTModelForPortType(String portTypeName,
                                                                             String namespace)
Builds a finder to find the portType tModels for a portType.

Parameters:
processName -
Returns:

createBusinessServices

public org.uddi.api_v3.BusinessServices createBusinessServices(javax.wsdl.Definition wsdlDefinition)
Creates a business service based off of a WSDL definition
No changes are made to the UDDI endpoints using this method
Example Code:
 URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
 String domain = url.getHost();
 ReadWSDL rw = new ReadWSDL();
 Definition wsdlDefinition = rw.readWSDL(url);
 properties.put("keyDomain", domain);
 properties.put("businessName", domain);
 properties.put("serverName", url.getHost());
 properties.put("serverPort", url.getPort());
 wsdlURL = wsdlDefinition.getDocumentBaseURI();
 WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);
 

Parameters:
wsdlDefinition - must not be null
Returns:
a business service
Throws:
IllegalArgumentException - if the wsdlDefinition is null

createBusinessService

protected org.uddi.api_v3.BusinessService createBusinessService(QName serviceQName,
                                                                javax.wsdl.Definition wsdlDefinition)
Creates a UDDI Business Service.

Parameters:
serviceName -
wsldDefinition -
Returns:

createWSDLBinding

protected org.uddi.api_v3.BindingTemplate createWSDLBinding(QName serviceQName,
                                                            String portName,
                                                            URL serviceUrl,
                                                            javax.wsdl.Definition wsdlDefinition)


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.