public string PublishBusiness(string businessName, string description) { save_business newBusiness = new save_business(); newBusiness.authInfo = token.authInfo; newBusiness.generic = "2.0"; newBusiness.businessEntity = new businessEntity[1] { new businessEntity() }; businessEntity myBusinessEntity = newBusiness.businessEntity[0]; myBusinessEntity.name = new name[1] { new name() }; myBusinessEntity.name[0].Value = businessName; myBusinessEntity.businessKey = ""; myBusinessEntity.description = new description[1] { new description() }; myBusinessEntity.description[0].Value = description; businessDetail myBusinessDetail = publishProxy.save_business(newBusiness); return(myBusinessDetail.businessEntity[0].businessKey); }
private static bool CheckServiceAndParentForSignature(String serviceKey, UDDI_Inquiry_SoapBinding uddiInquiryService, String token) { get_serviceDetail gsd = new get_serviceDetail(); gsd.authInfo = (token); gsd.serviceKey = new string[] { serviceKey }; String bizkey = null; try { serviceDetail serviceDetail = uddiInquiryService.get_serviceDetail(gsd); if (serviceDetail != null && serviceDetail.businessService != null) { { bizkey = serviceDetail.businessService[0].businessKey; if (serviceDetail.businessService[0].Signature != null && serviceDetail.businessService[0].Signature.Length > 0) { log.info("the service with key=" + serviceKey + " exists and is digitally signed"); return(true); } } } } catch (Exception ex) { log.info("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex); throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex); } if (bizkey == null) { throw new UnexpectedResponseException("The service with key " + serviceKey + " parent's business key could not be determined. This is unexpected"); } get_businessDetail gbd = new get_businessDetail(); gbd.authInfo = (token); gbd.businessKey = new string[] { bizkey }; try { businessDetail businessDetail = uddiInquiryService.get_businessDetail(gbd); if (businessDetail != null && businessDetail.businessEntity != null) { if (businessDetail.businessEntity[0].Signature != null && businessDetail.businessEntity[0].Signature.Length > 0) { log.info("the business with key=" + bizkey + " exists and is digitally signed"); return(true); } } } catch (Exception ex) { log.info("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex); throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex); } return(false); }
public get_businessDetailResponse(businessDetail businessDetail) { this.businessDetail = businessDetail; }
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(); } } }
/// <summary> /// From file /// create business, save in juddi, download from juddi, sign and save it, /// download it again, verify sig is valid /// </summary> /// <param name="config"></param> void SignSaveAndVerifyToJuddi(String config) { UDDIClient clerkManager = null; Transport transport = null; UDDIClerk clerk = null; try { clerkManager = new UDDIClient(config); transport = clerkManager.getTransport("default"); UDDI_Security_SoapBinding security = transport.getUDDISecurityService(); UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService(); UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService(); clerk = clerkManager.getClerk("default"); businessEntity be = new businessEntity(); be.name = new name[] { new name("Test biz", "en") }; Console.Out.WriteLine("saving test biz"); businessEntity complete = clerk.register(be); Console.Out.WriteLine("attempting to sign"); DigSigUtil ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration()); businessEntity signed = (businessEntity)ds.signUddiEntity(complete); PrintUDDI <businessEntity> p = new PrintUDDI <businessEntity>(); Console.Out.WriteLine("signed successfully!"); if (serialize) { Console.Out.WriteLine(p.print(signed)); } Console.Out.WriteLine("attempting verify signature locally"); String err = ""; bool valid = ds.verifySignedUddiEntity(signed, out err); Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err); Assert.True(valid); Assert.True(String.IsNullOrEmpty(err)); Console.Out.WriteLine("saving to signed entity to the registry"); clerk.register(signed); Console.Out.WriteLine("reloading content from the server..."); get_businessDetail gsd = new get_businessDetail(); gsd.authInfo = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl()); gsd.businessKey = new string[] { signed.businessKey }; businessDetail saved = inquiry.get_businessDetail(gsd); Console.Out.WriteLine("done. attempting verify signed entity"); if (serialize) { Console.Out.WriteLine(p.print(saved.businessEntity[0])); } err = ""; valid = ds.verifySignedUddiEntity(saved.businessEntity[0], out err); Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err); } catch (Exception ex) { while (ex != null) { System.Console.WriteLine("Error! " + ex.Message); ex = ex.InnerException; } throw ex; } finally { if (transport != null && transport is IDisposable) { ((IDisposable)transport).Dispose(); } if (clerk != null) { clerk.Dispose(); } } }
public save_businessResponse(businessDetail businessDetail) { this.businessDetail = businessDetail; }