/** * Register a service. * * Note, if registration fails, no exception is thrown * * @param service the element returned by the server, it may be modified from the original * @param node * @return the potentially modified service by the UDDI server */ public org.uddi.apiv3.businessService register(org.uddi.apiv3.businessService service, org.apache.juddi.apiv3.node node) { org.uddi.apiv3.businessService businessService = null; log.info("Registering service " + service.name[0].Value + " with key " + service.serviceKey); try { String authToken = getAuthToken(node.securityUrl); save_service saveService = new save_service(); saveService.authInfo = (authToken); saveService.businessService = new businessService[1]; saveService.businessService[0] = (service); org.uddi.apiv3.serviceDetail serviceDetail = null; using (UDDI_Publication_SoapBinding pub = getUDDINode().getTransport().getUDDIPublishService(node.publishUrl)) { serviceDetail = pub.save_service(saveService); } businessService = serviceDetail.businessService[0]; log.debug("Registering service " + service.name[0].Value + " completed."); } catch (Exception e) { log.error("Unable to register service " + service.name[0].Value + " ." + e.Message, e); } return businessService; }
/// <remarks/> public void save_serviceAsync(save_service save_service1, object userState) { if ((this.save_serviceOperationCompleted == null)) { this.save_serviceOperationCompleted = new System.Threading.SendOrPostCallback(this.Onsave_serviceOperationCompleted); } this.InvokeAsync("save_service", new object[] { save_service1}, this.save_serviceOperationCompleted, userState); }
/// <remarks/> public void save_serviceAsync(save_service save_service1) { this.save_serviceAsync(save_service1, null); }
/// <remarks/> public System.IAsyncResult Beginsave_service(save_service save_service1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("save_service", new object[] { save_service1}, callback, asyncState); }
internal static void Run(string[] args) { UDDIClient clerkManager = null; Transport transport = null; UDDIClerk clerk = null; try { clerkManager = new UDDIClient("uddi.xml"); transport = clerkManager.getTransport("uddiv2"); UDDI_Security_SoapBinding security = transport.getUDDISecurityService(); UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService(); UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService(); clerk = clerkManager.getClerk("uddiv2"); save_business sb = new save_business(); get_authToken rq=new get_authToken(); rq.cred = "username"; rq.userID="username"; String token=security.get_authToken(rq).authInfo; System.Console.WriteLine("Got an auth token..."); sb.authInfo = token; sb.businessEntity = new businessEntity[1]; sb.businessEntity[0] = new businessEntity(); sb.businessEntity[0].name = new name[] { new name("test business from .net via uddi2 translation", "en") }; sb.businessEntity[0].description = new description[] { new description("a description", "en") }; businessDetail detail= publish.save_business(sb); System.Console.WriteLine("business saved"); PrintUDDI<businessDetail> p = new PrintUDDI<businessDetail>(); Console.Out.WriteLine(p.print(detail)); save_service ss = new save_service(); ss.authInfo = token; ss.businessService = new businessService[1]; ss.businessService[0] = new businessService(); ss.businessService[0].name = new name[] { new name("hello world", "en") }; ss.businessService[0].businessKey = detail.businessEntity[0].businessKey; serviceDetail sd = publish.save_service(ss); System.Console.WriteLine("service saved"); PrintUDDI<serviceDetail> p1 = new PrintUDDI<serviceDetail>(); Console.Out.WriteLine(p1.print(sd)); save_binding sbd = new save_binding(); sbd.authInfo = token; sbd.bindingTemplate = new bindingTemplate[1]; sbd.bindingTemplate[0] = new bindingTemplate(); sbd.bindingTemplate[0].Item = new accessPoint("http://localhost", "endPoint"); sbd.bindingTemplate[0].serviceKey = sd.businessService[0].serviceKey; bindingDetail bd = publish.save_binding(sbd); System.Console.WriteLine("binding saved"); PrintUDDI<bindingDetail> p2 = new PrintUDDI<bindingDetail>(); Console.Out.WriteLine(p2.print(bd)); save_tModel stm = new save_tModel(); stm.authInfo = token; stm.tModel = new tModel[1]; stm.tModel[0] = new tModel(); stm.tModel[0].name = new name("a uddiv2 tmodel", "en"); tModelDetail td = publish.save_tModel(stm); System.Console.WriteLine("tModel saved"); PrintUDDI<tModelDetail> p3 = new PrintUDDI<tModelDetail>(); Console.Out.WriteLine(p3.print(td)); } 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(); } }
public static void main(string[] args) { Console.Out.Write("Enter WSDL url: >"); String input = Console.In.ReadLine(); if (String.IsNullOrEmpty(input)) input = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"; //String wsdlURL = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"; //if (String.IsNullOrEmpty(input)) Uri url = null; String host = "localhost"; int port = 80; try { url = new Uri(input); host = url.Host; port = url.Port; } catch { } ReadWSDL wsi = new ReadWSDL(); tDefinitions wsdlDefinition = wsi.readWSDL(input); Properties properties1 = new Properties(); properties1.put("serverName", host); properties1.put("businessName", host); properties1.put("keyDomain", "uddi:" + host); if (port <= 0) { if (url.ToString().StartsWith("https", StringComparison.CurrentCultureIgnoreCase)) port = 443; else port = 80; } properties1.put("serverPort", port.ToString()); tModel keypart = UDDIClerk.createKeyGenator(host, host + "'s key partition", "en"); WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizer(), properties1); List<tModel> tModels1 = new List<tModel>(); Dictionary<QName, tPortType> portTypes1 = (Dictionary<QName, tPortType>)wsdlDefinition.getAllPortTypes(); List<tModel> portTypeTModels1 = wsdl2UDDI.createWSDLPortTypeTModels(input, portTypes1); tModels1.AddRange(portTypeTModels1); Dictionary<QName, tBinding> allBindings1 = wsdlDefinition.getAllBindings(); List<tModel> createWSDLBindingTModels1 = wsdl2UDDI.createWSDLBindingTModels(input, allBindings1); tModels1.AddRange(createWSDLBindingTModels1); businessService[] services = wsdl2UDDI.createBusinessServices(wsdlDefinition); save_service ss = new save_service(); ss.businessService = services; Console.Out.WriteLine(new PrintUDDI<save_service>().print(ss)); save_tModel st = new save_tModel(); st.tModel = tModels1.ToArray(); Console.Out.WriteLine(new PrintUDDI<save_tModel>().print(st)); //save keypart //save tmodels //save business //TODO register the stuff }