예제 #1
0
    public businessDetail get_businessDetail(get_businessDetail get_businessDetail1)
    {
        get_businessDetailRequest inValue = new get_businessDetailRequest();

        inValue.get_businessDetail = get_businessDetail1;
        get_businessDetailResponse retVal = ((Inquire)(this)).get_businessDetail(inValue);

        return(retVal.businessDetail);
    }
        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);
        }
예제 #3
0
 public get_businessDetailRequest(get_businessDetail get_businessDetail)
 {
     this.get_businessDetail = get_businessDetail;
 }
        /// <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();
                }
            }
        }
예제 #5
0
 /// <remarks/>
 public void get_businessDetailAsync(get_businessDetail get_businessDetail1, object userState)
 {
     if ((this.get_businessDetailOperationCompleted == null)) {
         this.get_businessDetailOperationCompleted = new System.Threading.SendOrPostCallback(this.Onget_businessDetailOperationCompleted);
     }
     this.InvokeAsync("get_businessDetail", new object[] {
                 get_businessDetail1}, this.get_businessDetailOperationCompleted, userState);
 }
예제 #6
0
 /// <remarks/>
 public void get_businessDetailAsync(get_businessDetail get_businessDetail1)
 {
     this.get_businessDetailAsync(get_businessDetail1, null);
 }
예제 #7
0
 /// <remarks/>
 public System.IAsyncResult Beginget_businessDetail(get_businessDetail get_businessDetail1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("get_businessDetail", new object[] {
                 get_businessDetail1}, callback, asyncState);
 }