private void Write123_Service(string n, string ns, Service o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(Service)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("Service", "http://schemas.xmlsoap.org/wsdl/");
         }
         XmlAttribute[] extensibleAttributes = o.ExtensibleAttributes;
         if (extensibleAttributes != null)
         {
             for (int i = 0; i < extensibleAttributes.Length; i++)
             {
                 XmlAttribute node = extensibleAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         base.WriteAttribute("name", "", o.Name);
         if ((o.DocumentationElement == null) && (o.DocumentationElement != null))
         {
             throw base.CreateInvalidAnyTypeException(o.DocumentationElement);
         }
         base.WriteElementLiteral(o.DocumentationElement, "documentation", "http://schemas.xmlsoap.org/wsdl/", false, true);
         ServiceDescriptionFormatExtensionCollection extensions = o.Extensions;
         if (extensions != null)
         {
             for (int j = 0; j < extensions.Count; j++)
             {
                 if (!(extensions[j] is XmlNode) && (extensions[j] != null))
                 {
                     throw base.CreateInvalidAnyTypeException(extensions[j]);
                 }
                 base.WriteElementLiteral((XmlNode) extensions[j], "", null, false, true);
             }
         }
         PortCollection ports = o.Ports;
         if (ports != null)
         {
             for (int k = 0; k < ports.Count; k++)
             {
                 this.Write122_Port("port", "http://schemas.xmlsoap.org/wsdl/", ports[k], false, false);
             }
         }
         base.WriteEndElement(o);
     }
 }