コード例 #1
0
        private Header[] GetChannelHeaders(ITransportHeaders requestHeaders, out string soapActionToVerify)
        {
            string str3;
            string str4;

            soapActionToVerify = null;
            string uRI = (string)requestHeaders["__RequestUri"];
            string uri = (string)requestHeaders["SOAPAction"];

            if (uri == null)
            {
                throw new RemotingException(CoreChannel.GetResourceString("Remoting_SoapActionMissing"));
            }
            uri = HttpEncodingHelper.DecodeUri(uri);
            soapActionToVerify = uri;
            if (!SoapServices.GetTypeAndMethodNameFromSoapAction(uri, out str3, out str4))
            {
                Type serverTypeForUri = RemotingServices.GetServerTypeForUri(uRI);
                if (serverTypeForUri == null)
                {
                    throw new RemotingException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_TypeNotFoundFromUri"), new object[] { uRI }));
                }
                str3 = "clr:" + serverTypeForUri.FullName + ", " + serverTypeForUri.Assembly.GetName().Name;
            }
            else
            {
                str3 = "clr:" + str3;
            }
            int num = 2;

            Header[] headerArray = new Header[num];
            headerArray[0] = new Header("__Uri", uRI);
            headerArray[1] = new Header("__TypeName", str3);
            return(headerArray);
        }
コード例 #2
0
        } // Properties


        // Helper method for analyzing headers
        private Header[] GetChannelHeaders(ITransportHeaders requestHeaders,
                                           out String soapActionToVerify)
        {
            soapActionToVerify = null;

            // transport sink removes any channel specific information
            String objectURI = (String)requestHeaders[CommonTransportKeys.RequestUri];

            // see if a unique SOAPAction is present (if more than one SOAPAction is present some
            //   scenarios won't work, but one-many soap action to method base relationships are
            //   for interop scenarios only)
            String soapAction = (String)requestHeaders["SOAPAction"];

            if (soapAction == null)
            {
                throw new RemotingException(CoreChannel.GetResourceString("Remoting_SoapActionMissing"));
            }
            soapAction = HttpEncodingHelper.DecodeUri(soapAction);

            soapActionToVerify = soapAction;

            String typeName, methodName;

            if (!SoapServices.GetTypeAndMethodNameFromSoapAction(soapAction, out typeName, out methodName))
            {
                // This means there are multiple methods for this soap action, so we will have to
                // settle for the type based off of the uri.
                Type type = RemotingServices.GetServerTypeForUri(objectURI);
                if (type == null)
                {
                    throw new RemotingException(
                              String.Format(
                                  CultureInfo.CurrentCulture, CoreChannel.GetResourceString(
                                      "Remoting_TypeNotFoundFromUri"), objectURI));
                }

                // @todo: This throws away the version, culture and public key token
                typeName = "clr:" + type.FullName + ", " + type.Assembly.GetName().Name;
            }
            else
            {
                typeName = "clr:" + typeName;
            }

            // Create a new header array and pass it back.
            int headerLen = 2;

            Header[] h = new Header[headerLen];
            h[0] = new Header("__Uri", objectURI);
            h[1] = new Header("__TypeName", typeName);

            return(h);
        } // GetChannelHeaders