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 static uddi.apiv3.serviceDetail MapServiceDetail(uddi.apiv2.serviceDetail serviceDetail)
 {
     if (serviceDetail == null)
     {
         return(null);
     }
     uddi.apiv3.serviceDetail r = new serviceDetail();
     r.businessService    = MapBusinessServices(serviceDetail.businessService);
     r.truncated          = serviceDetail.truncated == uddi.apiv2.truncated.@true;
     r.truncatedSpecified = serviceDetail.truncatedSpecified;
     return(r);
 }
Exemple #3
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 :(");
            }
        }
Exemple #4
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);
        }
 public get_serviceDetailResponse(serviceDetail serviceDetail)
 {
     this.serviceDetail = serviceDetail;
 }
Exemple #6
0
        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 save_serviceResponse(serviceDetail serviceDetail)
 {
     this.serviceDetail = serviceDetail;
 }