Exemple #1
0
 /**
  * Gets service details or NULL if it doesn't exist or an error occurred
  * @param getDetail
  * @param node
  * @return
  * @throws RemoteException
  * @throws TransportException
  * @throws ConfigurationException
  */
 public serviceDetail getServiceDetail(get_serviceDetail getDetail, node node)
 {
     getDetail.authInfo = (getAuthToken(node.securityUrl));
     try
     {
         serviceDetail tModelDetail = getUDDINode().getTransport().getUDDIInquiryService(node.inquiryUrl).get_serviceDetail(getDetail);
         return tModelDetail;
     }
     catch (Exception dr)
     {
         //dispositionReport report = DispositionReportFaultMessage.getDispositionReport(dr);
         log.error("error fetching service detail", dr);
     }
     return null;
 }
        /**
         * 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 #3
0
        /**
         * Finds a service by the key, . This is a convenience wrapper
         *
         * @param serviceKey
         * @return null if not found or error
         * @throws RemoteException
         * @throws TransportException
         * @throws ConfigurationException
         * @deprecated see
         */
        public businessService getServiceDetail(String serviceKey, org.apache.juddi.apiv3.node node)
        {
            get_serviceDetail getServiceDetail = new get_serviceDetail();
            getServiceDetail.serviceKey = new string[] { serviceKey };
            getServiceDetail.authInfo = (getAuthToken(node.securityUrl));
            try
            {
                serviceDetail sd = getUDDINode().getTransport().getUDDIInquiryService(node.inquiryUrl).get_serviceDetail(getServiceDetail);
                businessService[] businessServiceList = sd.businessService;
                if (businessServiceList.Length == 0)
                {
                    throw new ConfigurationErrorsException("Could not find Service with key=" + serviceKey);
                }
                return businessServiceList[0];
            }
            catch (Exception dr)
            {
                log.error("", dr);
                //DispositionReport report = DispositionReportFaultMessage.getDispositionReport(dr);
                //checkForErrorInDispositionReport(report, DispositionReport.E_INVALID_KEY_PASSED, serviceKey);
            }

            return null;
        }
Exemple #4
0
 /**
  * Gets service details or NULL if it doesn't exist or an error occurred
  * @param getDetail
  * @return
  * @throws RemoteException
  * @throws ConfigurationException
  * @throws TransportException
  */
 public serviceDetail getServiceDetail(get_serviceDetail getDetail)
 {
     return getServiceDetail(getDetail, this.getUDDINode().getApiNode());
 }
Exemple #5
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);
 }
Exemple #6
0
 /// <remarks/>
 public void get_serviceDetailAsync(get_serviceDetail get_serviceDetail1)
 {
     this.get_serviceDetailAsync(get_serviceDetail1, null);
 }
Exemple #7
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);
 }
        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();
            }
        }
 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;
 }