public class WADL2UDDI extends Object
Application app = WADL2UDDI.parseWadl(new File("A path to your file.wadl")); Listurls = WADL2UDDI.getBaseAddresses(app); URL url = urls.get(0); String domain = url.getHost(); TModel keygen = UDDIClerk.createKeyGenator("uddi:" + domain + ":keygenerator", domain, "en"); //save the keygen SaveTModel stm = new SaveTModel(); stm.setAuthInfo(rootAuthToken.getAuthInfo()); stm.getTModel().add(keygen); properties.put("keyDomain", domain); properties.put("businessName", domain); properties.put("serverName", url.getHost()); properties.put("serverPort", url.getPort()); WADL2UDDI wadl2UDDI = new WADL2UDDI(null, new URLLocalizerDefaultImpl(), properties); BusinessService businessServices = wadl2UDDI.createBusinessService(new QName("MyWasdl.namespace", "Servicename"), app); Set portTypeTModels = wadl2UDDI.createWADLPortTypeTModels(wsdlURL, app); //Since the service depends on the tModel, we have to save the tModels first SaveTModel tms = new SaveTModel(); TModel[] tmodels = portTypeTModels.toArray(new TModel[0]); for (int i = 0; i < tmodels.length; i++) { System.out.println(tmodelPrinter.print(tmodels[i])); tms.getTModel().add(tmodels[i]); } //important, you'll need to save your new tModels, or else saving the business/service may fail publish.saveTModel(stm); //finaly, we're ready to save all of the services defined in the WSDL //again, we're creating a new business, if you have one already, look it up using the Inquiry getBusinessDetails PrintUDDI servicePrinter = new PrintUDDI (); System.out.println(servicePrinter.print(businessServices)); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(rootAuthToken.getAuthInfo()); BusinessEntity be = new BusinessEntity(); be.setBusinessKey(businessServices.getBusinessKey()); be.getName().add(new Name()); //TODO, use some relevant here be.getName().get(0).setValue(domain); be.getName().get(0).setLang("en"); be.setBusinessServices(new BusinessServices()); be.getBusinessServices().getBusinessService().add(businessServices); sb.getBusinessEntity().add(be); PrintUDDI sbp = new PrintUDDI (); System.out.println("Request " + sbp.print(sb)); publish.saveBusiness(sb); //and we're done //Be sure to report any problems to the jUDDI JIRA bug tracker at //https://issues.apache.org/jira/browse/JUDDI
Constructor and Description |
---|
WADL2UDDI(UDDIClerk clerk,
URLLocalizer urlLocalizer,
Properties properties) |
Modifier and Type | Method and Description |
---|---|
BusinessService |
createBusinessService(QName serviceQName,
Application wadlDefinition)
Creates a UDDI Business Service.
|
protected BindingTemplate |
createWADLBinding(QName serviceQName,
String portName,
URL serviceUrl,
Resources res) |
Set<TModel> |
createWADLPortTypeTModels(String wadlURL,
Application app) |
Set<TModel> |
createWADLTModels(String wadlURL,
Application app) |
static List<URL> |
getBaseAddresses(Application app) |
String |
getKeyDomainURI() |
String |
getLang() |
protected static KeyedReference |
newKeyedReference(String tModelKey,
String keyName,
String value) |
static Application |
parseWadl(File file) |
static Application |
parseWadl(InputStream stream)
parses a wadl from stream
|
static Application |
parseWadl(URL file)
parses a wadl from a URL or file
|
static Application |
parseWadl(URL weburl,
String username,
String password,
boolean ignoreSSLErrors)
Parses a web accessible WADL file
|
void |
setKeyDomain(String keyDomainURI) |
void |
setLang(String lang) |
public static final String PACKAGE
public WADL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties) throws org.apache.commons.configuration.ConfigurationException
org.apache.commons.configuration.ConfigurationException
public Set<TModel> createWADLTModels(String wadlURL, Application app) throws Exception
Exception
public Set<TModel> createWADLPortTypeTModels(String wadlURL, Application app) throws Exception
Exception
public String getKeyDomainURI()
public void setKeyDomain(String keyDomainURI)
public String getLang()
public void setLang(String lang)
public BusinessService createBusinessService(QName serviceQName, Application wadlDefinition) throws MalformedURLException
serviceQName
- This must be specified to identify the namespace of
the service, which is used to set the service uddi keywadlDefinition
- MalformedURLException
public static List<URL> getBaseAddresses(Application app)
protected static KeyedReference newKeyedReference(String tModelKey, String keyName, String value)
protected BindingTemplate createWADLBinding(QName serviceQName, String portName, URL serviceUrl, Resources res)
public static Application parseWadl(InputStream stream)
stream
- public static Application parseWadl(URL file)
file
- public static Application parseWadl(URL weburl, String username, String password, boolean ignoreSSLErrors)
weburl
- username
- password
- ignoreSSLErrors
- if true, SSL errors are ignoredApplication app = WADL2UDDI.parseWadl(new URL("http://server/wsdl.wsdl"), "username", "password", clerkManager.getClientConfig().isX_To_Wsdl_Ignore_SSL_Errors() );
public static Application parseWadl(File file) throws FileNotFoundException, IOException
FileNotFoundException
IOException
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.