Fault12.cs :  » 2.6.4-mono-.net-core » System.Web » System » Web » Services » Protocols » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » 2.6.4 mono .net core » System.Web 
System.Web » System » Web » Services » Protocols » Fault12.cs
// 
// Fault12.cs
//
// Author:
//  Atsushi Enomoto  <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc.
//

//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

//
// This file is used to generate Fault12Serializer.cs with fault-12.genxs.
// To generate the file, do:
//  - replace _internal_ class in this file to _public_ class
//  - optionally you might have to remove Fault12Serializer.cs from
//    System.Web.Services.dll.sources.
//  - Build System.Web.Services.dll with make PROFILE=net_2_0.
//  - run genxs.exe with 2.0 libraries (the easiest way would be
//    to build genxs under 2.0 profile i.e. make PROFILE=net_2_0)
//  - Edit Fault12Serializer.cs to rename "FaultSerializer" to
//    "Fault12Serializer" as the name is a duplicate, and
//    wrap the entire code with #if NET_2_0.
//  - revert _public_ class in this file to _internal_ class back.
//

using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Text;
using System.Collections;
using System.Globalization;

namespace System.Web.Services.Protocols{
  [XmlRoot ("Fault", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  [XmlType ("Fault", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  internal class Soap12Fault
  {
    // dummy constructor to not be rejected by genxs.
    public Soap12Fault ()
    {
    }

    public static XmlSerializer Serializer =
#if NET_2_0
      new Fault12Serializer ();
#else
      null;
#endif

#if NET_2_0

    public Soap12Fault (SoapException ex) 
    {
      Code = new Soap12FaultCode ();
      Code.Value = ex.Code;
      if (ex.SubCode != null)
        Code.Subcode = CreateFaultCode (ex.SubCode);
      Node = ex.Node;
      Role = ex.Role;
      Reason = new Soap12FaultReason ();
      Soap12FaultReasonText text =
        new Soap12FaultReasonText ();
      text.XmlLang = ex.Lang;
      text.Value = ex.Message;
      Reason.Texts = new Soap12FaultReasonText [] {text};
      if (ex.Detail != null) {
        Detail = new Soap12FaultDetail ();
        if (ex.Detail.NodeType == XmlNodeType.Attribute)
          Detail.Attributes = new XmlAttribute [] {
            (XmlAttribute) ex.Detail};
        else if (ex.Detail.NodeType == XmlNodeType.Element)
          Detail.Children = new XmlElement [] {
            (XmlElement) ex.Detail};
        else
          Detail.Text = ex.Detail.Value;
      }
    }

    static Soap12FaultCode CreateFaultCode (SoapFaultSubCode code)
    {
      if (code == null)
        throw new ArgumentNullException ("code");
      Soap12FaultCode ret = new Soap12FaultCode ();
      ret.Value = code.Code;
      if (code.SubCode != null)
        ret.Subcode = CreateFaultCode (code.SubCode);
      return ret;
    }

    public static SoapFaultSubCode GetSoapFaultSubCode (Soap12FaultCode src)
    {
      return (src == null) ? null :
        new SoapFaultSubCode (src.Value, GetSoapFaultSubCode (src.Subcode));
    }
#endif

    public Soap12FaultCode Code;

    public Soap12FaultReason Reason;

    [XmlElement (DataType = "anyURI")]
    public string Node;

    [XmlElement (DataType = "anyURI")]
    public string Role;

    public Soap12FaultDetail Detail;
  }

  [XmlType ("Code", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  internal class Soap12FaultCode
  {
    public XmlQualifiedName Value;

    public Soap12FaultCode Subcode;
  }

  [XmlType ("Reason", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  internal class Soap12FaultReason
  {
    [XmlElement ("Text", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
    public Soap12FaultReasonText [] Texts;
  }

  [XmlType ("Text", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  internal class Soap12FaultReasonText
  {
    [XmlAttribute ("lang", Namespace = "http://www.w3.org/XML/1998/namespace")]
    public string XmlLang;

    [XmlText]
    public string Value;
  }

  [XmlType ("Detail", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
  internal class Soap12FaultDetail
  {
    [XmlAnyAttribute]
    public XmlAttribute [] Attributes;

    [XmlAnyElement]
    public XmlElement [] Children;

    [XmlText]
    public string Text;
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.