예제 #1
0
        public static AdwsFault ConstructFault(Message response)
        {
            AdwsFault     adwsFault;
            MessageBuffer buffer       = AdwsMessage.MessageToBuffer(response);
            MessageFault  messageFault = MessageFault.CreateFault(AdwsMessage.BufferToMessage(buffer), 0x500000);
            object        obj          = null;

            if (messageFault.HasDetail)
            {
                try
                {
                    string str  = string.Concat(messageFault.Code.SubCode.Namespace, ":", messageFault.Code.SubCode.Name);
                    Type   item = (Type)AdwsFaultUtil._faultSubCodeType[str];
                    if (item != null)
                    {
                        XmlReader     readerAtDetailContents = messageFault.GetReaderAtDetailContents();
                        XmlSerializer xmlSerializer          = new XmlSerializer(item);
                        obj = xmlSerializer.Deserialize(readerAtDetailContents);
                    }
                }
                catch (Exception exception)
                {
                }
            }
            if (obj == null)
            {
                adwsFault = new AdwsFault(messageFault);
            }
            else
            {
                adwsFault = new AdwsFault(messageFault, obj);
            }
            return(adwsFault);
        }
예제 #2
0
		public static AdwsFault ConstructFault(Message response)
		{
			AdwsFault adwsFault;
			MessageBuffer buffer = AdwsMessage.MessageToBuffer(response);
			MessageFault messageFault = MessageFault.CreateFault(AdwsMessage.BufferToMessage(buffer), 0x500000);
			object obj = null;
			if (messageFault.HasDetail)
			{
				try
				{
					string str = string.Concat(messageFault.Code.SubCode.Namespace, ":", messageFault.Code.SubCode.Name);
					Type item = (Type)AdwsFaultUtil._faultSubCodeType[str];
					if (item != null)
					{
						XmlReader readerAtDetailContents = messageFault.GetReaderAtDetailContents();
						XmlSerializer xmlSerializer = new XmlSerializer(item);
						obj = xmlSerializer.Deserialize(readerAtDetailContents);
					}
				}
				catch (Exception exception)
				{
				}
			}
			if (obj == null)
			{
				adwsFault = new AdwsFault(messageFault);
			}
			else
			{
				adwsFault = new AdwsFault(messageFault, obj);
			}
			return adwsFault;
		}