コード例 #1
0
        static UddiVersionSupport()
        {
            //
            // Increase this array if you want to support more previous versions.  Do not include
            // the current version in this array.
            //
            SupportedVersions = new UddiVersion[1];

            //
            // Add our supported previous versions
            //
            SupportedVersions[0] = UddiVersion.V1;

            //
            // Current version is version 2.0
            //
            CurrentVersion = UddiVersion.V2;

            //
            // Store instances to versions
            //
            UddiVersions = new Hashtable();

            UddiVersions[UddiVersion.V1] = new UddiVersion1();
            UddiVersions[UddiVersion.V2] = new UddiVersion2();
        }
コード例 #2
0
        private object[] InvokeWebMethod(string webMethodName, object[] parameters)
        {
            object[] results = null;

            //
            // The first (and only) parameter is the Uddi message we are about to send.
            //
            UddiCore uddiMessage = parameters[0] as UddiCore;

            try
            {
                uddiMessage.SerializeMode = true;
                results = Invoke(webMethodName, parameters);
            }
            catch (SoapException soapException)
            {
                //
                // We have no meaningful results at this point.
                //
                results = null;
                UddiException uddiException   = new UddiException(soapException);
                UddiVersion   originalVersion = uddiVersion;

                //
                // If the exception is either a fatal error or a unrecognized version error, we will
                // assume that the exception had something to do with a versioning problem.  This is about
                // the most reliable way to do this, since there is no standard way of reporting a version
                // mismatch.  If IterateOverVersions still does not return results, then we use the original
                // exception and assume that that exception was indeed not version related.
                //
                if ((uddiException.Type == UddiException.ErrorType.E_unrecognizedVersion ||
                     uddiException.Type == UddiException.ErrorType.E_fatalError) &&
                    uddiVersion == UddiVersion.Negotiate)
                {
                    results = InvokeForVersions(webMethodName, parameters, ref uddiException);

                    //
                    // Restore the original version.  TODO: should we just keep this version as is?
                    //
                    uddiVersion = originalVersion;
                }

                if (null == results)
                {
                    throw uddiException;
                }
            }
            finally
            {
                uddiMessage.SerializeMode = false;
            }

            return(results);
        }
コード例 #3
0
        internal static string Translate(string xml, UddiVersion version)
        {
            //
            // Use the current version in this case
            //
            if (version == UddiVersion.Negotiate)
            {
                version = CurrentVersion;
            }

            IUddiVersion uddiVersion = ( IUddiVersion )UddiVersions[version];

            return(uddiVersion.Translate(xml));
        }
コード例 #4
0
        private object[] InvokeForVersions(string webMethodName, object[] parameters, ref UddiException returnException)
        {
            object[] results = null;

            //
            // Try to invoke this web method for each supported version
            //
            int numVersions = UddiVersionSupport.SupportedVersions.Length;
            int index       = 0;

            while (index < numVersions && null == results)
            {
                try
                {
                    UddiVersion versionToTry = UddiVersionSupport.SupportedVersions[index++];

                    //
                    // Don't repeat versions.
                    //
                    if (versionToTry != uddiVersion)
                    {
                        uddiVersion = versionToTry;
                    }

                    results = Invoke(webMethodName, parameters);
                }
                catch (UddiException uddiException)
                {
                    returnException = uddiException;
                }
                catch (Exception exception)
                {
                    returnException = new UddiException(exception);
                }
            }

            return(results);
        }
コード例 #5
0
 public SoapClient()
 {
     uddiVersion = UddiVersion.Negotiate;
     UserAgent   = UddiUserAgent;
 }
コード例 #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="innerStream">Should be from a WebRequest object.</param>
 /// <param name="uddiVersion">The UDD version we should use to send to the server</param>
 public UddiRequestStream(Stream innerStream, UddiVersion uddiVersion)
 {
     this.innerStream = innerStream;
     this.uddiVersion = uddiVersion;
 }
コード例 #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="innerWebResponse">This object should come from the WebResponse created by HttpSoapClientProtocol.</param>
 public UddiWebResponse(WebResponse innerWebResponse)
 {
     this.innerWebResponse = innerWebResponse;
     this.uddiVersion      = uddiVersion;
 }
コード例 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="uri">Uri to the web service we are calling</param>
 /// <param name="uddiVersion">Uddi version to use for requests</param>
 public UddiWebRequest(WebRequest innerWebRequest, UddiVersion uddiVersion)
 {
     this.innerWebRequest = innerWebRequest;
     this.uddiVersion     = uddiVersion;
 }