public void xr_bindingTemplate() { Console.Out.WriteLine("serialization bindingTemplate"); bindingTemplate r = new bindingTemplate(); XmlSerializer xr = new XmlSerializer(typeof(bindingTemplate)); StringWriter sw = new StringWriter(); xr.Serialize(sw, r); System.Console.Out.WriteLine(sw.ToString()); }
private bindingTemplate NewBindingTempalte() { bindingTemplate bt = new bindingTemplate(); bt.bindingKey = "asd"; bt.categoryBag = new categoryBag(); bt.categoryBag.Items = new object[] { new keyedReference("key", "name", "val") }; bt.description = new description[] { new description("hi", "en") }; bt.Item = new accessPoint("http://localhost", "wsdl"); bt.serviceKey = "svc"; bt.tModelInstanceDetails = new tModelInstanceInfo[] { new tModelInstanceInfo() }; return(bt); }
/** * Copies the TemplateBinding from one UDDI to another UDDI. */ public void xRegisterServiceBinding() { try { bindingTemplate bindingTemplate = fromClerk.getServiceBindingDetail(entityKey, fromClerk.getUDDINode().getApiNode()); log.info("xregister binding " + bindingTemplate.bindingKey + " + from " + fromClerk.getName() + " to " + toClerk.getName()); toClerk.register(bindingTemplate, toClerk.getUDDINode().getApiNode()); } catch (Exception e) { log.error("Could not " + toString() + ". " + e.Message, e); } }
public UddiBinding(bindingTemplate template, List <tModel> tModels) { if (template == null) { throw new ArgumentNullException("template"); } if (tModels == null) { throw new ArgumentNullException("tModels"); } this.template = template; Converter <tModel, UddiTModel> converter = delegate(tModel tmodel) { return(new UddiTModel(tmodel)); }; this.tModels = tModels.ConvertAll <UddiTModel>(converter); }
/** * adds the typical REST tmodel references, but only if they aren't already present * @param bt * @return */ public static bindingTemplate addRESTtModels(bindingTemplate bt) { List <tModelInstanceInfo> data = new List <tModelInstanceInfo>(); if (bt.tModelInstanceDetails != null) { data.AddRange(bt.tModelInstanceDetails); } accessPoint ap = null; if (bt.Item is accessPoint) { ap = (accessPoint)bt.Item; } tModelInstanceInfo tModelInstanceInfo; if (!Exists(data, UDDIConstants.PROTOCOL_REST)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_REST); data.Add(tModelInstanceInfo); } if (ap != null && ap.Value != null && ap.Value.StartsWith("http:")) { if (!Exists(data, UDDIConstants.TRANSPORT_HTTP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_HTTP); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("https:")) { if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3); data.Add(tModelInstanceInfo); } } bt.tModelInstanceDetails = data.ToArray(); return(bt); }
protected bindingTemplate createWADLBinding(QName serviceQName, String portName, Uri serviceUrl, resources res) { bindingTemplate bindingTemplate = new bindingTemplate(); // Set BusinessService Key bindingTemplate.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart())); List <tModelInstanceInfo> items = new List <tModelInstanceInfo>(); if (serviceUrl != null) { // Set AccessPoint accessPoint accessPoint = new accessPoint(); accessPoint.useType = (AccessPointType.endPoint.ToString()); accessPoint.Value = ((serviceUrl.ToString())); bindingTemplate.Item = (accessPoint); // Set Binding Key String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, serviceUrl); bindingTemplate.bindingKey = (bindingKey); bindingTemplate.description = Common2UDDI.mapdescription(getDescription(res.doc), lang).ToArray(); // reference wsdl:binding tModel tModelInstanceInfo tModelInstanceInfoBinding = new tModelInstanceInfo(); tModelInstanceInfoBinding.tModelKey = (keyDomainURI + "binding"); instanceDetails id = new instanceDetails(); id.instanceParms = portName; tModelInstanceInfoBinding.instanceDetails = (id); tModelInstanceInfoBinding.description = Common2UDDI.mapdescription("The binding that this endpoint implements. " + bindingTemplate.description[0].Value + " The instanceParms specifies the port local name.", lang).ToArray(); items.Add(tModelInstanceInfoBinding); tModelInstanceInfo tModelInstanceInfoPortType = new tModelInstanceInfo(); tModelInstanceInfoPortType.tModelKey = (keyDomainURI + "rest"); tModelInstanceInfoPortType.description = Common2UDDI.mapdescription("The wadl:Resource:base implements.", lang).ToArray(); items.Add(tModelInstanceInfoPortType); } bindingTemplate.tModelInstanceDetails = items.ToArray(); return(bindingTemplate); }
public static bindingTemplate MapBindingTemplate(uddi.apiv2.bindingTemplate bindingTemplate) { if (bindingTemplate == null) { return(null); } bindingTemplate r = new bindingTemplate(); r.bindingKey = bindingTemplate.bindingKey; r.description = MapDescription(bindingTemplate.description); r.serviceKey = bindingTemplate.serviceKey; if (bindingTemplate.Item is org.uddi.apiv2.accessPoint) { org.uddi.apiv2.accessPoint old = new uddi.apiv2.accessPoint(); accessPoint a = new accessPoint(); a.Value = old.Value; a.useType = old.URLType.ToString(); r.Item = a; } r.tModelInstanceDetails = MapTmodelInstanceDetail(bindingTemplate.tModelInstanceDetails); return(r); }
/** * This will setup new a business, service, and binding template that's * versioned per the article linked above */ private void Setup() { businessEntity be = new businessEntity(); keygen = clerk.register(UDDIClerk.createKeyGenator(domain_prefix + "keygenerator", "my domain", lang)).tModel[0]; be.businessKey = (domain_prefix + "zerocoolbiz"); be.name = new name[] { new name("ZeroCool Business", lang) }; businessService bs = new businessService(); bs.name = new name[] { new name("ZeroCool Service", lang) }; bs.businessKey = (domain_prefix + "zerocoolbiz"); bs.serviceKey = (domain_prefix + "zerocoolsvc"); //version 1 bindingTemplate bt1 = new bindingTemplate(); String version = "1.0.0.0"; bt1.bindingKey = (domain_prefix + "binding10"); bt1.Item = (new accessPoint("http://localhost", "wsdl")); bt1.tModelInstanceDetails = new tModelInstanceInfo[] { UDDIClerk.createServiceInterfaceVersion(version, lang) }; //version 2 bindingTemplate bt2 = new bindingTemplate(); bt2.bindingKey = (domain_prefix + "binding12"); String version2 = "1.2.0.0"; bt2.Item = (new accessPoint("http://localhost", "wsdl")); bt2.tModelInstanceDetails = new tModelInstanceInfo[] { UDDIClerk.createServiceInterfaceVersion(version2, lang) }; bs.bindingTemplates = new bindingTemplate[] { bt1, bt2 }; be.businessServices = new businessService[] { bs }; clerk.register(be); }
/** * Creates a UDDI Business Service. * * @param serviceQName This must be specified to identify the namespace of * the service, which is used to set the service uddi key * @param waldDefinition * @return */ public businessService createBusinessService(QName serviceQName, application wadlDefinition) { log.debug("Constructing Service UDDI Information for " + serviceQName); businessService service = new businessService(); // BusinessKey service.businessKey = (businessKey); // ServiceKey service.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart())); // Description String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION); // Override with the service description from the WSDL if present bool lengthwarn = false; List <description> ds = new List <description>(); if (wadlDefinition.doc != null) { for (int i = 0; i < wadlDefinition.doc.Length; i++) { String locallang = lang; description description = new description(); if (wadlDefinition.doc[i].lang != null) { locallang = (wadlDefinition.doc[i].lang); } if (locallang.Length > UDDIConstants.MAX_xml_lang_length) { lengthwarn = true; locallang = (locallang.Substring(0, UDDIConstants.MAX_xml_lang_length - 1)); } StringBuilder sb = new StringBuilder(); sb.Append(wadlDefinition.doc[i].title).Append(" "); sb.Append(ContentToString(wadlDefinition.doc[i].Any)); ds.AddRange(Common2UDDI.mapdescription(sb.ToString(), locallang)); } } else { ds.AddRange(Common2UDDI.mapdescription(serviceDescription, lang)); } service.description = ds.ToArray(); // Service name name sName = new name(); sName.lang = (lang); if (wadlDefinition.doc != null && wadlDefinition.doc.Length > 0) { sName.Value = (wadlDefinition.doc[0].title); } if (sName.Value == null) { sName.Value = (serviceQName.getLocalPart()); } service.name = new name[] { sName }; categoryBag cb = new categoryBag(); List <keyedReference> krs = new List <keyedReference>(); String ns = serviceQName.getNamespaceURI(); if (ns != null && ns != "") { keyedReference namespaceReference = new keyedReference( "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns); krs.Add(namespaceReference); } keyedReference serviceReference = new keyedReference( "uddi:uddi.org:wadl:types", "uddi-org:wadl:types", "service"); krs.Add(serviceReference); keyedReference localNameReference = new keyedReference( "uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart()); krs.Add(localNameReference); cb.Items = krs.ToArray(); service.categoryBag = (cb); if (wadlDefinition.resources != null) { for (int i = 0; i < wadlDefinition.resources.Length; i++) { bindingTemplate bindingTemplate = createWADLBinding(serviceQName, getDocTitle(wadlDefinition.resources[i].doc), new Uri(wadlDefinition.resources[i].@base), wadlDefinition.resources[i]); service.bindingTemplates = new bindingTemplate[] { bindingTemplate }; } } if (lengthwarn) { log.warn("Some object descriptions are longer than the maximum allowed by UDDI and have been truncated."); } return(service); }
/** * adds the typical SOAP tmodel references, but only if they aren't already present * @param bt * @return */ public static bindingTemplate addSOAPtModels(bindingTemplate bt) { bool found = false; List <object> cbags = new List <object>(); if (bt.categoryBag != null) { cbags.AddRange(bt.categoryBag.Items); } for (int i = 0; i < cbags.Count; i++) { if (cbags[i] is keyedReference) { keyedReference kr = (keyedReference)cbags[i]; if (kr.tModelKey != null && kr.tModelKey.Equals("uddi:uddi.org:categorization:types", StringComparison.CurrentCultureIgnoreCase)) { if (kr.keyName != null && kr.keyName.Equals("uddi-org:types:wsdl", StringComparison.CurrentCultureIgnoreCase)) { found = true; } } } } if (!found) { cbags.Add(new keyedReference("uddi:uddi.org:categorization:types", "uddi-org:types:wsdl", "wsdlDeployment")); } if (cbags.Count > 0) { if (bt.categoryBag == null) { bt.categoryBag = new categoryBag(); } bt.categoryBag.Items = cbags.ToArray(); } List <tModelInstanceInfo> data = new List <tModelInstanceInfo>(); if (bt.tModelInstanceDetails != null) { data.AddRange(bt.tModelInstanceDetails); } accessPoint ap = null; if (bt.Item is accessPoint) { ap = (accessPoint)bt.Item; } tModelInstanceInfo tModelInstanceInfo; if (!Exists(data, UDDIConstants.PROTOCOL_SOAP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SOAP); data.Add(tModelInstanceInfo); } if (ap != null && ap.Value != null && ap.Value.StartsWith("http:")) { if (!Exists(data, UDDIConstants.TRANSPORT_HTTP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_HTTP); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("jms:")) { if (!Exists(data, UDDIConstants.TRANSPORT_JMS)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_JMS); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("rmi:")) { if (!Exists(data, UDDIConstants.TRANSPORT_RMI)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_RMI); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("udp:")) { if (!Exists(data, UDDIConstants.TRANSPORT_UDP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_UDP); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("amqp:")) { if (!Exists(data, UDDIConstants.TRANSPORT_AMQP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_AMQP); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("mailto:")) { if (!Exists(data, UDDIConstants.TRANSPORT_EMAIL)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_EMAIL); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("ftp:")) { if (!Exists(data, UDDIConstants.TRANSPORT_FTP)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_FTP); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("https:")) { if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("ftps:")) { if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3); data.Add(tModelInstanceInfo); } } if (ap != null && ap.Value != null && ap.Value.StartsWith("jndi:")) { if (!Exists(data, UDDIConstants.TRANSPORT_JNDI_RMI)) { tModelInstanceInfo = new tModelInstanceInfo(); tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_JNDI_RMI); data.Add(tModelInstanceInfo); } } bt.tModelInstanceDetails = data.ToArray(); return(bt); }
public static void Run(string[] args) { UDDIClient clerkManager = null; Transport transport = null; UDDIClerk clerk = null; try { clerkManager = new UDDIClient("uddi.xml"); transport = clerkManager.getTransport("default_non_root"); UDDI_Security_SoapBinding security = transport.getUDDISecurityService(); UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService(); UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService(); clerk = clerkManager.getClerk("default_non_root"); //this part just confirms that the keydomain exists for our new service and binding template String keydomain = null; if (clerkManager.getClientConfig().getConfiguration() != null && clerkManager.getClientConfig().getConfiguration().client != null && clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks != null && clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks.keyDomain != null) { keydomain = clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks.keyDomain; } else { keydomain = "uddi:org.apache.demos"; } tModel createKeyGenator = UDDIClerk.createKeyGenator(keydomain + ":keygenerator", "Test domain", "en"); clerk.register(createKeyGenator); //we'll also create a business and a service here so that we can hook in our callback endpoint businessEntity be = new businessEntity(); be.businessKey = keydomain + ":coolbizexample"; be.name = new name[] { new name("Coolbiz Inc", "en") }; be.businessServices = new businessService[] { new businessService() }; be.businessServices[0].businessKey = keydomain + ":coolbizexample"; be.businessServices[0].serviceKey = keydomain + ":coolbizexample-service"; be.businessServices[0].name = new name[] { new name("Coolbiz Service", "en") }; clerk.register(be); bindingTemplate start = SubscriptionCallbackListener.start(clerkManager, "default_non_root"); Console.WriteLine("Started and waiting for inbound traffic"); //bkeep alive DateTime stop = DateTime.Now.Add(new TimeSpan(0, 0, 10)); while (DateTime.Now < stop) { Thread.Sleep(1000); } Console.WriteLine("Stopping"); SubscriptionCallbackListener.stop(clerkManager, "default_non_root", start.bindingKey); //get rid of it once we're done clerk.unRegisterBusiness(keydomain + ":coolbizexample"); clerk.unRegisterTModel(createKeyGenator.tModelKey); } catch (Exception ex) { while (ex != null) { System.Console.WriteLine("Error! " + ex.Message); ex = ex.InnerException; } } finally { if (transport != null && transport is IDisposable) { ((IDisposable)transport).Dispose(); } if (clerk != null) { clerk.Dispose(); } } }
/** * Registers a UDDI binding template that represents the subscription * callback endpoint * * @param client * @param cfg_node_name * @param bt - Binding Template * @param behavior * @return * @throws ServiceAlreadyStartedException * @throws SecurityException * @throws ConfigurationException * @throws TransportException * @throws DispositionReportFaultMessage * @throws RemoteException * @throws UnexpectedException * @throws RegistrationAbortedException * @throws UnableToSignException */ public static bindingTemplate registerBinding(UDDIClient client, String cfg_node_name, bindingTemplate bt, SignatureBehavior behavior) { log.info("Attempting to register binding " + bt.bindingKey); UDDIClerk clerk = client.getClerk(cfg_node_name); Transport tp = client.getTransport(cfg_node_name); UDDI_Inquiry_SoapBinding uddiInquiryService = tp.getUDDIInquiryService(); UDDI_Publication_SoapBinding uddiPublishService = tp.getUDDIPublishService(); String token = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl()); switch (behavior) { case SignatureBehavior.AbortIfSigned: if (CheckExistingBindingForSignature(bt.bindingKey, uddiInquiryService, token, behavior)) { throw new RegistrationAbortedException("Aborting, Either the item exists and is signed"); } if (CheckServiceAndParentForSignature(bt.serviceKey, uddiInquiryService, token)) { throw new RegistrationAbortedException("Aborting, Either the service or busness is signed"); } break; case SignatureBehavior.DoNothing: break; case SignatureBehavior.SignAlways: try { DigSigUtil ds = new DigSigUtil(client.getClientConfig().getDigitalSignatureConfiguration()); bt = (bindingTemplate)ds.signUddiEntity(bt); } catch (Exception ex) { log.error("Unable to sign", ex); throw new UnableToSignException("Unable to sign", ex); } break; case SignatureBehavior.SignOnlyIfParentIsntSigned: if (!CheckServiceAndParentForSignature(bt.serviceKey, uddiInquiryService, token)) { try { DigSigUtil ds = new DigSigUtil(client.getClientConfig().getDigitalSignatureConfiguration()); bt = (bindingTemplate)ds.signUddiEntity(bt); } catch (Exception ex) { log.error("Unable to sign", ex); throw new UnableToSignException("Unable to sign", ex); } } break; } save_binding sb = new save_binding(); sb.authInfo = (token); sb.bindingTemplate = new bindingTemplate[] { bt }; bindingDetail saveBinding = uddiPublishService.save_binding(sb); log.info("Binding registered successfully"); if (saveBinding.bindingTemplate == null || saveBinding.bindingTemplate.Length > 1) { throw new UnexpectedResponseException("The number of binding templates returned was unexpected, count=" + (saveBinding.bindingTemplate == null ? "none" : saveBinding.bindingTemplate.Length.ToString())); } return(saveBinding.bindingTemplate[0]); }
public static bindingTemplate start(UDDIClient client, String cfg_node_name, String endpoint, String keydomain, bool autoregister, String serviceKey, SignatureBehavior behavior) { if (instance == null) { instance = new SubscriptionCallbackListener(); } if (ep != null && ep.State == CommunicationState.Opened) { throw new ServiceAlreadyStartedException(); } Uri url = null; try { url = new Uri(endpoint); } catch (Exception ex) { log.warn("Callback endpoint couldn't be parsed, generating a random one: " + ex.Message); url = new Uri("http://" + GetHostname() + ":" + GetRandomPort(4000) + "/" + Guid.NewGuid().ToString()); } endpoint = url.ToString(); //if (endpoint == null || endpoint.equals("")) { // endpoint = "http://" + GetHostname() + ":" + GetRandomPort(url.getPort()) + "/" + UUID.randomUUID().toString(); int attempts = 5; if (ep == null) { while ((ep == null || ep.State != CommunicationState.Opened) && attempts > 0) { try { if (endpoint.Contains("localhost")) { endpoint = endpoint.Replace("localhost", GetHostname()); } ep = new ServiceHost(instance, new Uri[] { new Uri(endpoint) }); //ep = Endpoint.publish(endpoint, instance); ep.Open(); callback = endpoint; } catch (Exception be) { log.info("trouble starting callback at " + endpoint + ", trying again with a random port: " + be.Message); log.debug(be); attempts--; //if (be instanceof java.net.BindException) { url = new Uri("http://" + url.Host + ":" + GetRandomPort(url.Port) + "/" + url.PathAndQuery); endpoint = url.ToString(); } } } if (ep == null || ep.State != CommunicationState.Opened) { log.warn("Unable to start callback endpoint, aborting"); throw new SecurityException("unable to start endpoint, view previous errors for reason"); } log.info("Endpoint started at " + callback); bindingTemplate bt = new bindingTemplate(); bt.Item = (new accessPoint(callback, "endPoint")); tModelInstanceInfo instanceInfo = new tModelInstanceInfo(); instanceInfo.tModelKey = ("uddi:uddi.org:transport:http"); bt.tModelInstanceDetails = new tModelInstanceInfo[] { instanceInfo }; bt.serviceKey = (serviceKey); if (keydomain.EndsWith(":")) { bt.bindingKey = (keydomain + GetHostname() + "_Subscription_Callback"); } else { bt.bindingKey = (keydomain + ":" + GetHostname() + "_Subscription_Callback"); } if (autoregister) { bt = registerBinding(client, cfg_node_name, bt, behavior); } return(bt); }
public businessService readServiceAnnotations(String classWithAnnotations, Properties properties) { Type t = Type.GetType(classWithAnnotations, false, true); if (t != null) { businessService service = new businessService(); object[] attrib = t.GetCustomAttributes(typeof(UDDIService), true); object[] ws = t.GetCustomAttributes(typeof(System.Web.Services.WebServiceBindingAttribute), true); WebServiceBindingAttribute webServiceAnnotation = null; if (ws != null && ws.Length > 0) { webServiceAnnotation = ((WebServiceBindingAttribute[])ws)[0]; } if (attrib != null && attrib.Length > 0) { UDDIService[] bits = attrib as UDDIService[]; UDDIService uddiService = bits[0]; name n = new name(); n.lang = uddiService.lang; service.businessKey = (TokenResolver.replaceTokens(uddiService.businessKey, properties)); service.serviceKey = (TokenResolver.replaceTokens(uddiService.serviceKey, properties)); if (!"".Equals(uddiService.serviceName, StringComparison.CurrentCultureIgnoreCase)) { n.Value = (TokenResolver.replaceTokens(uddiService.serviceName, properties)); } else if (webServiceAnnotation != null && !"".Equals(webServiceAnnotation.Name)) { n.Value = (webServiceAnnotation.Name); } else { n.Value = (classWithAnnotations); } service.name = new name[] { n }; description d = new description(); d.lang = (uddiService.lang); d.Value = (TokenResolver.replaceTokens(uddiService.description, properties)); service.description = new description[] { d }; //categoryBag on the service if (!"".Equals(uddiService.categoryBag)) { categoryBag categoryBag = parseCategoryBag(uddiService.categoryBag); service.categoryBag = (categoryBag); } //bindingTemplate on service bindingTemplate bindingTemplate = parseServiceBinding(classWithAnnotations, uddiService.lang, webServiceAnnotation, properties); if (bindingTemplate != null) { bindingTemplate.serviceKey = (service.serviceKey); if (service.bindingTemplates == null) { service.bindingTemplates = new bindingTemplate[] { bindingTemplate }; } else { List <bindingTemplate> l = new List <bindingTemplate>(); l.AddRange(service.bindingTemplates); l.Add(bindingTemplate); service.bindingTemplates = l.ToArray(); } } return(service); } else { log.error("Missing UDDIService annotation in class " + classWithAnnotations); } } log.error("Unable to load type " + classWithAnnotations); return(null); }
private bindingTemplate parseServiceBinding(string classWithAnnotations, string lang, WebServiceBindingAttribute webServiceAnnotation, Properties properties) { bindingTemplate bindingTemplate = null; Type t = Type.GetType(classWithAnnotations, false, false); UDDIServiceBinding uddiServiceBinding = null; object[] attrib = t.GetCustomAttributes(typeof(UDDIServiceBinding), true); if (attrib != null && attrib.Length > 0) { uddiServiceBinding = attrib[0] as UDDIServiceBinding; } //= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class); //binding if (uddiServiceBinding != null) { bindingTemplate = new bindingTemplate(); bindingTemplate.bindingKey = (TokenResolver.replaceTokens(uddiServiceBinding.bindingKey, properties)); String bindingLang = (lang); if (uddiServiceBinding.lang != null) { bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang, properties); } description bindingDescription = new description(); bindingDescription.lang = (bindingLang); bindingDescription.Value = (TokenResolver.replaceTokens(uddiServiceBinding.description, properties)); bindingTemplate.description = new description[] { (bindingDescription) }; accessPoint accessPoint = new accessPoint(); accessPoint.useType = (AccessPointType.wsdlDeployment.ToString()); if (!"".Equals(uddiServiceBinding.accessPointType)) { accessPoint.useType = (uddiServiceBinding.accessPointType); } if (!"".Equals(uddiServiceBinding.accessPoint)) { String endPoint = uddiServiceBinding.accessPoint; endPoint = TokenResolver.replaceTokens(endPoint, properties); log.debug("AccessPoint EndPoint=" + endPoint); accessPoint.Value = (endPoint); } else if (webServiceAnnotation != null && webServiceAnnotation.Location != null) { accessPoint.Value = (webServiceAnnotation.Location); } bindingTemplate.Item = (accessPoint); //tModelKeys on the binding if (!"".Equals(uddiServiceBinding.tModelKeys)) { String[] tModelKeys = uddiServiceBinding.tModelKeys.Split(','); foreach (String tModelKey in tModelKeys) { tModelInstanceInfo instanceInfo = new tModelInstanceInfo(); instanceInfo.tModelKey = (tModelKey); if (bindingTemplate.tModelInstanceDetails == null) { bindingTemplate.tModelInstanceDetails = (new tModelInstanceInfo[] { instanceInfo }); } List <tModelInstanceInfo> l = new List <tModelInstanceInfo>(); l.AddRange(bindingTemplate.tModelInstanceDetails); l.Add(instanceInfo); bindingTemplate.tModelInstanceDetails = l.ToArray(); } } //categoryBag on the binding if (!"".Equals(uddiServiceBinding.categoryBag)) { categoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag); bindingTemplate.categoryBag = (categoryBag); } } else { log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations); } return(bindingTemplate); }