コード例 #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
        private void SerializeMessage(IMethodCallMessage mcm, out ITransportHeaders headers, out Stream stream)
        {
            BaseTransportHeaders headers2 = new BaseTransportHeaders();

            headers = headers2;
            MethodBase methodBase = mcm.MethodBase;

            headers["SOAPAction"] = '"' + HttpEncodingHelper.EncodeUriAsXLinkHref(SoapServices.GetSoapActionFromMethodBase(methodBase)) + '"';
            headers2.ContentType  = "text/xml; charset=\"utf-8\"";
            if (this._channelProtocol == SinkChannelProtocol.Http)
            {
                headers["__RequestVerb"] = "POST";
            }
            bool flag = false;

            stream = this._nextSink.GetRequestStream(mcm, headers);
            if (stream == null)
            {
                stream = new ChunkedMemoryStream(CoreChannel.BufferPool);
                flag   = true;
            }
            CoreChannel.SerializeSoapMessage(mcm, stream, this._includeVersioning);
            if (flag)
            {
                stream.Position = 0L;
            }
        }
コード例 #3
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
コード例 #4
0
ファイル: soapformattersinks.cs プロジェクト: ydunk/masters
        } // AsyncProcessMessage

        //
        // end of IMessageSink implementation
        //


        // helper function to serialize the message
        private void SerializeMessage(IMethodCallMessage mcm,
                                      out ITransportHeaders headers, out Stream stream)
        {
            BaseTransportHeaders requestHeaders = new BaseTransportHeaders();

            headers = requestHeaders;

            // add SOAPAction header
            MethodBase mb = mcm.MethodBase;

            headers["SOAPAction"] =
                '"' +
                HttpEncodingHelper.EncodeUriAsXLinkHref(
                    SoapServices.GetSoapActionFromMethodBase(mb)) +
                '"';

            // add other http soap headers
            requestHeaders.ContentType = CoreChannel.SOAPContentType;
            if (_channelProtocol == SinkChannelProtocol.Http)
            {
                headers["__RequestVerb"] = "POST";
            }

            bool bMemStream = false;

            stream = _nextSink.GetRequestStream(mcm, headers);
            if (stream == null)
            {
                stream     = new ChunkedMemoryStream(CoreChannel.BufferPool);
                bMemStream = true;
            }
            CoreChannel.SerializeSoapMessage(mcm, stream, _includeVersioning);
            if (bMemStream)
            {
                stream.Position = 0;
            }
        } // SerializeMessage