EnvelopeVersion 类

定义

包含与 SOAP 版本相关的信息,该版本与消息及其交换关联。

public ref class EnvelopeVersion sealed
public sealed class EnvelopeVersion
type EnvelopeVersion = class
Public NotInheritable Class EnvelopeVersion
继承
EnvelopeVersion

示例

下面的代码演示如何访问 EnvelopeVersion 的方法和属性。


using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Text;

namespace CS
{
    class Program
    {
        static void Main(string[] args)
        {
            // MessageVersion
            EnvelopeVersion envS11 = EnvelopeVersion.Soap11;
            string nextDestS11 = envS11.NextDestinationActorValue;
            string[] ultDestsS11 = envS11.GetUltimateDestinationActorValues();
            string ultS11 = ultDestsS11[0];
            string toStrS11 = envS11.ToString();

            EnvelopeVersion envS12 = EnvelopeVersion.Soap12;

            EnvelopeVersion envNotSOAP =  EnvelopeVersion.None;

            string nextDestS12 = envS12.NextDestinationActorValue;

            string[] ultDestsS12 = envS12.GetUltimateDestinationActorValues();

            string ultS12 = ultDestsS12[1];

            string toStrS12 = envS12.ToString();

            EnvelopeVersion envNone = EnvelopeVersion.None;
            string nextDestNone = envNone.NextDestinationActorValue;
            //The following code throws a System.ArgumentReferenceException.
            //The object reference is not set to an instance of an object
            // string[] ultDestsNone = envNone.GetUltimateDestinationActorValues();
            string toStrNone = envNone.ToString();

             //EnvelopeVersions
            Console.WriteLine("EnvelopeVersion.Soap11: {0}", envS11);
            Console.WriteLine("EnvelopeVersion.Soap12: {0}", envS12);
            Console.WriteLine("EnvelopeVersion.None: {0}", envNone);
            Console.WriteLine();

            //NextDestination
            Console.WriteLine("NextDest EnvelopeVersion.Soap11: {0}", nextDestS11);
            Console.WriteLine("NextDest EnvelopeVersion.Soap12: {0}", nextDestS12);
            Console.WriteLine("NextDest EnvelopeVersion.None: {0}", nextDestNone);
            Console.WriteLine();

            //UltimateDestinations
            Console.WriteLine("UltDest EnvelopeVersion.Soap11: {0}", ultS11);
            Console.WriteLine("UltDest EnvelopeVersion.Soap12: {0}", ultS12);
            //Console.WriteLine("UltDest EnvelopeVersion.None: {0}", ultDestsNone);
            Console.WriteLine();

            //ToString
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS11);
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS12);
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrNone);
            Console.WriteLine();
        }
    }
}
/*
Output:
EnvelopeVersion.Soap11: Soap11 (http://schemas.xmlsoap.org/soap/envelope/)
EnvelopeVersion.Soap12: Soap12 (http://www.w3.org/2003/05/soap-envelope)
EnvelopeVersion.None: EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)

NextDest EnvelopeVersion.Soap11: http://schemas.xmlsoap.org/soap/actor/next
NextDest EnvelopeVersion.Soap12: http://www.w3.org/2003/05/soap-envelope/role/next
NextDest EnvelopeVersion.None:

UltDest EnvelopeVersion.Soap11:
UltDest EnvelopeVersion.Soap12:

EnvelopeVersion.Soap11.ToString(): Soap11 (http://schemas.xmlsoap.org/soap/envelope/)
EnvelopeVersion.Soap11.ToString(): Soap12 (http://www.w3.org/2003/05/soap-envelope)
EnvelopeVersion.Soap11.ToString(): EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)
*/


Imports System.Collections.Generic
Imports System.ServiceModel
Imports System.Text

Namespace CS
    Module Module1
        Sub Main(ByVal args() As String)

            ' MessageVersion
            Dim envS11 As EnvelopeVersion = EnvelopeVersion.Soap11
            Dim nextDestS11 As String = envS11.NextDestinationActorValue
            Dim ultDestsS11() As String = envS11.GetUltimateDestinationActorValues()
            Dim ultS11 As String = ultDestsS11(0)
            Dim toStrS11 As String = envS11.ToString()

            Dim envS12 As EnvelopeVersion = EnvelopeVersion.Soap12

            Dim envNotSOAP As EnvelopeVersion = EnvelopeVersion.None

            Dim nextDestS12 As String = envS12.NextDestinationActorValue

            Dim ultDestsS12() As String = envS12.GetUltimateDestinationActorValues()

            Dim ultS12 As String = ultDestsS12(1)

            Dim toStrS12 As String = envS12.ToString()

            Dim envNone As EnvelopeVersion = EnvelopeVersion.None
            Dim nextDestNone As String = envNone.NextDestinationActorValue
            'The following code throws a System.ArgumentReferenceException.
            'The object reference is not set to an instance of an object
            ' string[] ultDestsNone = envNone.GetUltimateDestinationActorValues();
            Dim toStrNone As String = envNone.ToString()

            'EnvelopeVersions
            Console.WriteLine("EnvelopeVersion.Soap11: {0}", envS11)
            Console.WriteLine("EnvelopeVersion.Soap12: {0}", envS12)
            Console.WriteLine("EnvelopeVersion.None: {0}", envNone)
            Console.WriteLine()

            'NextDestination
            Console.WriteLine("NextDest EnvelopeVersion.Soap11: {0}", nextDestS11)
            Console.WriteLine("NextDest EnvelopeVersion.Soap12: {0}", nextDestS12)
            Console.WriteLine("NextDest EnvelopeVersion.None: {0}", nextDestNone)
            Console.WriteLine()

            'UltimateDestinations
            Console.WriteLine("UltDest EnvelopeVersion.Soap11: {0}", ultS11)
            Console.WriteLine("UltDest EnvelopeVersion.Soap12: {0}", ultS12)
            'Console.WriteLine("UltDest EnvelopeVersion.None: {0}", ultDestsNone);
            Console.WriteLine()

            'ToString
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS11)
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrS12)
            Console.WriteLine("EnvelopeVersion.Soap11.ToString(): {0}", toStrNone)
            Console.WriteLine()

        End Sub
    End Module
End Namespace
'
' * 
' * 
' * 
'Output:
'EnvelopeVersion.Soap11: Soap11 (http://schemas.xmlsoap.org/soap/envelope/)
'EnvelopeVersion.Soap12: Soap12 (http://www.w3.org/2003/05/soap-envelope)
'EnvelopeVersion.None: EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)
'
'NextDest EnvelopeVersion.Soap11: http://schemas.xmlsoap.org/soap/actor/next
'NextDest EnvelopeVersion.Soap12: http://www.w3.org/2003/05/soap-envelope/role/next
'NextDest EnvelopeVersion.None:
'
'UltDest EnvelopeVersion.Soap11:
'UltDest EnvelopeVersion.Soap12:
'
'EnvelopeVersion.Soap11.ToString(): Soap11 (http://schemas.xmlsoap.org/soap/envelope/)
'EnvelopeVersion.Soap11.ToString(): Soap12 (http://www.w3.org/2003/05/soap-envelope)
'EnvelopeVersion.Soap11.ToString(): EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)
'

注解

目前可用的 SOAP 版本为 SOAP 1.1 和 SOAP 1.2。 每个可以使用 EnvelopeVersionSoap11 属性恢复的 SOAP 版本都具有一个 Soap12。 此外,还有一个 None 消息版本可用于收发不使用 SOAP 格式的 XML 消息。 与每个消息版本关联的处理角色可以使用 NextDestinationActorValue 属性和 GetUltimateDestinationActorValues 方法进行恢复。

属性

NextDestinationActorValue

获取一个字符串,该字符串包含与下一目标的当前消息版本关联的 SOAP 角色的 URI 名称。

None

获取不使用 SOAP 版本的信封版本。

Soap11

获取 SOAP1.1 信封版本。

Soap12

获取 SOAP1.2 信封版本。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
GetUltimateDestinationActorValues()

获取一个字符串,该字符串包含与最终目标的当前消息版本关联的 SOAP 角色的 URI 名称。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

获取表示当前信封版本的字符串。

适用于