Beispiel #1
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);
        }
Beispiel #2
0
 private void AttemptRefreshAuthInfo(UddiException uddiException, AuthToken authToken)
 {
     if (UddiException.ErrorType.E_authTokenExpired == uddiException.Type &&
         true == RefreshAuthToken)
     {
         authToken = Send(authToken.OriginatingAuthToken);
     }
     else
     {
         throw uddiException;
     }
 }
Beispiel #3
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);
        }