Exemplo n.º 1
0
        public string getServiceUrl(string name)
        {
            serviceInfo s = new serviceInfo();
            UDDIInquiryService juddi = new UDDIInquiryService();
            find_service fs = new find_service();
            fs.findQualifiers = new []{"approximateMatch"};
            name n = new name();
            n.Value = name;
            n.lang = "en";
            fs.name = new []{n};
            serviceList services = juddi.find_service(fs);

            for(int i = 0; i<services.serviceInfos.Count(); i++){
                s = services.serviceInfos[i];
            }

            get_serviceDetail sd= new get_serviceDetail();
            sd.serviceKey = new string[]{s.serviceKey};
            serviceDetail service = juddi.get_serviceDetail(sd);
            string url = service.businessService[0].bindingTemplates[0].accessPoint.Value;

            if(checkUrl(url)){
                url = url;
            }else{
                url =url;
            }

            return url;
        }
Exemplo n.º 2
0
    public serviceDetail get_serviceDetail(get_serviceDetail get_serviceDetail1)
    {
        get_serviceDetailRequest inValue = new get_serviceDetailRequest();

        inValue.get_serviceDetail = get_serviceDetail1;
        get_serviceDetailResponse retVal = ((Inquire)(this)).get_serviceDetail(inValue);

        return(retVal.serviceDetail);
    }
        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);
        }
Exemplo n.º 4
0
        /**
         * this will look up our service by name and we'll discover multiple
         * bindings with different versions
         */
        private void ServiceLookUpByName()
        {
            //here we are assuming we don't know what key is used for the service, so we look it up
            find_service fs = new find_service();

            fs.findQualifiers = new string[] { UDDIConstants.EXACT_MATCH };
            fs.name           = new name[] { new name("ZeroCool Service", lang) };
            serviceList findService = inquiry.find_service(fs);

            //parse the results and get a list of services to get the details on
            get_serviceDetail gsd   = new get_serviceDetail();
            List <string>     items = new List <string>();

            for (int i = 0; i < findService.serviceInfos.Length; i++)
            {
                items.Add(findService.serviceInfos[i].serviceKey);
            }
            gsd.serviceKey = items.ToArray();
            serviceDetail          serviceDetail = inquiry.get_serviceDetail(gsd);
            List <bindingTemplate> ret           = new List <bindingTemplate>();
            //parse the service details, looking for our versioned service
            Boolean success = false;

            if (serviceDetail != null)
            {
                for (int i = 0; i < serviceDetail.businessService.Length; i++)
                {
                    if (serviceDetail.businessService[i].bindingTemplates != null)
                    {
                        List <bindingTemplate> bindingByVersion = UDDIClerk.getBindingByVersion("1.2.0.0",
                                                                                                serviceDetail.businessService[i].bindingTemplates);
                        for (int x = 0; x < bindingByVersion.Count; x++)
                        {
                            success = true;
                            Console.Out.WriteLine("SUCCESS! Found the right version on key " + bindingByVersion[x].bindingKey);
                            //TODO so now that you've found the right version of the right service
                            //now you can go execute that the url
                        }
                    }
                }
            }
            if (!success)
            {
                Console.Out.WriteLine("FAIL! We didn't find a damn thing matching that version number :(");
            }
        }
Exemplo n.º 5
0
        private IList <UddiService> GetUddiServices(Identifier organizationIdentifier, UddiId serviceUddiId, string profileConformanceClaim)
        {
            keyedReference profileConformanceClaimKeyReference = new keyedReference();

            profileConformanceClaimKeyReference.tModelKey = "uddi:cc5f1df6-ae0a-4781-b24a-f30315893af7";
            profileConformanceClaimKeyReference.keyName   = "http://oio.dk/profiles/OWSA/modelT/1.0/UDDI/Categories/profileConformanceClaim/";
            profileConformanceClaimKeyReference.keyValue  = profileConformanceClaim;

            keyedReference registrationConformanceClaim = new keyedReference();

            registrationConformanceClaim.tModelKey = "uddi:80496ef5-4d24-4788-a3f8-12fb54a75106";
            registrationConformanceClaim.keyName   = "http://oio.dk/profiles/OWSA/modelT/1.0/UDDI/Categories/registrationConformanceClaim/";
            registrationConformanceClaim.keyValue  = RASPREGISTRATIONCONFORMANCECLAIM;

            keyedReference endpointKeyType = new keyedReference();

            endpointKeyType.tModelKey = "uddi:182a4a2b-3717-4283-b97c-55cc3b684dae";
            endpointKeyType.keyName   = "http://oio.dk/profiles/OIOSI/1.0/UDDI/Categories/endpointKeyType/";
            endpointKeyType.keyValue  = organizationIdentifier.KeyTypeCode;

            keyedReference endpointKey = new keyedReference();

            endpointKey.tModelKey = "uddi:e733684d-9f40-40ff-8807-1d80abc7c665";
            endpointKey.keyName   = "http://oio.dk/profiles/OIOSI/1.0/UDDI/Categories/endpointKey/";
            endpointKey.keyValue  = organizationIdentifier.GetAsString();

            keyedReference[] categories = new[] { profileConformanceClaimKeyReference, registrationConformanceClaim, endpointKeyType, endpointKey };

            categoryBag serviceCategories = new categoryBag {
                Items = categories
            };

            find_service findService = new find_service();

            findService.findQualifiers = new string[] { FindQualifers.andAllKeys.ToString() };
            if (serviceUddiId != null)
            {
                findService.tModelBag = new string[] { serviceUddiId.ID };
            }
            findService.categoryBag = serviceCategories;

            serviceList listOfServices = this.uddiProxy.find_service(findService);

            List <string> endPointUddiIds = new List <string>();

            if (listOfServices.serviceInfos == null)
            {
                return(new List <UddiService>());
            }
            foreach (serviceInfo service in listOfServices.serviceInfos)
            {
                endPointUddiIds.Add(service.serviceKey);
            }

            // Har uddi-ID på service endpoint, skal finde endpoint uri
            get_serviceDetail getServiceDetail = new get_serviceDetail();

            getServiceDetail.serviceKey = endPointUddiIds.ToArray();
            serviceDetail detail = this.uddiProxy.get_serviceDetail(getServiceDetail);

            if (detail.businessService == null)
            {
                return(new List <UddiService>());
            }

            IList <UddiService> uddiServices = new List <UddiService>();

            foreach (businessService businessServiceItem in detail.businessService)
            {
                List <UddiBinding> uddiBindings = new List <UddiBinding>();
                foreach (bindingTemplate bindingTemplate in businessServiceItem.bindingTemplates)
                {
                    List <string> tModelKeys = new List <string>();
                    foreach (tModelInstanceInfo tModel in bindingTemplate.tModelInstanceDetails)
                    {
                        tModelKeys.Add(tModel.tModelKey);
                    }

                    // Get the tModel details:
                    get_tModelDetail tModelDetail = new get_tModelDetail();
                    tModelDetail.tModelKey = tModelKeys.ToArray();
                    tModelDetail modelDetail = this.uddiProxy.get_tModelDetail(tModelDetail);

                    List <tModel> uddiTModels = new List <tModel>();
                    foreach (tModel tModelItem in modelDetail.tModel)
                    {
                        uddiTModels.Add(tModelItem);
                    }

                    UddiBinding uddiBinding = new UddiBinding(bindingTemplate, uddiTModels);
                    uddiBindings.Add(uddiBinding);
                }

                UddiService uddiService = new UddiService(businessServiceItem, uddiBindings);
                uddiServices.Add(uddiService);
            }

            return(uddiServices);
        }
Exemplo n.º 6
0
 public get_serviceDetailRequest(get_serviceDetail get_serviceDetail)
 {
     this.get_serviceDetail = get_serviceDetail;
 }
Exemplo n.º 7
0
        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");

                UDDI_Security_SoapBinding    security = transport.getUDDISecurityService();
                UDDI_Inquiry_SoapBinding     inquiry  = transport.getUDDIInquiryService();
                UDDI_Publication_SoapBinding publish  = transport.getUDDIPublishService();

                clerk = clerkManager.getClerk("default");


                find_business fb = new find_business();
                fb.authInfo       = clerk.getAuthToken(security.Url);
                fb.findQualifiers = new string[] { UDDIConstants.APPROXIMATE_MATCH };
                fb.name           = new name[1];
                fb.name[0]        = new name(UDDIConstants.WILDCARD, "en");
                businessList bl = inquiry.find_business(fb);
                if (bl.businessInfos.Length > 0)
                {
                    Console.Out.WriteLine(bl.businessInfos[0].name[0].Value);
                    Console.Out.WriteLine("attempting to sign");
                    businessService sd = clerk.getServiceDetail(bl.businessInfos[0].serviceInfos[0].serviceKey);

                    //pist, the signing config comes from the stuff in in uddi.xml
                    DigSigUtil                  ds        = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
                    businessService             signedsvc = (businessService)ds.signUddiEntity(sd);
                    PrintUDDI <businessService> p         = new PrintUDDI <businessService>();
                    Console.Out.WriteLine("signed successfully!");

                    Console.Out.WriteLine(p.print(signedsvc));
                    Console.Out.WriteLine("attempting verify and validate");
                    String err   = "";
                    bool   valid = ds.verifySignedUddiEntity(signedsvc, out err);
                    Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err);

                    Console.Out.WriteLine("saving");
                    clerk.register(signedsvc);
                    Console.Out.WriteLine("reloading content from the server...");

                    get_serviceDetail gsd = new get_serviceDetail();
                    gsd.authInfo   = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
                    gsd.serviceKey = new string[] { signedsvc.serviceKey };
                    sd             = inquiry.get_serviceDetail(gsd).businessService[0];

                    Console.Out.WriteLine(p.print(sd));
                    Console.Out.WriteLine("attempting verify and validate");
                    err   = "";
                    valid = ds.verifySignedUddiEntity(sd, out err);
                    Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err);
                }
                else
                {
                    Console.Out.WriteLine("no businesses were returned!");
                }
            }
            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();
                }
            }
        }
Exemplo n.º 8
0
 /// <remarks/>
 public void get_serviceDetailAsync(get_serviceDetail get_serviceDetail1, object userState)
 {
     if ((this.get_serviceDetailOperationCompleted == null)) {
         this.get_serviceDetailOperationCompleted = new System.Threading.SendOrPostCallback(this.Onget_serviceDetailOperationCompleted);
     }
     this.InvokeAsync("get_serviceDetail", new object[] {
                 get_serviceDetail1}, this.get_serviceDetailOperationCompleted, userState);
 }
Exemplo n.º 9
0
 /// <remarks/>
 public void get_serviceDetailAsync(get_serviceDetail get_serviceDetail1)
 {
     this.get_serviceDetailAsync(get_serviceDetail1, null);
 }
Exemplo n.º 10
0
 /// <remarks/>
 public System.IAsyncResult Beginget_serviceDetail(get_serviceDetail get_serviceDetail1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("get_serviceDetail", new object[] {
                 get_serviceDetail1}, callback, asyncState);
 }