/// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember member) { TypeMapping typeMapping = ImportType(member.MemberType, true); if (!(typeMapping is StructMapping)) { return(ImportMembersMapping(name, ns, new SoapSchemaMember[] { member })); } MembersMapping mapping = new MembersMapping(); mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); mapping.Members = ((StructMapping)typeMapping).Members; mapping.HasWrapperElement = true; ElementAccessor accessor = new ElementAccessor(); accessor.IsSoap = true; accessor.Name = name; accessor.Namespace = typeMapping.Namespace != null ? typeMapping.Namespace : ns; accessor.Mapping = mapping; accessor.IsNullable = false; accessor.Form = XmlSchemaForm.Qualified; return(new XmlMembersMapping(Scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write)); }
public void MemberNameDefault () { SoapSchemaMember member = new SoapSchemaMember (); Assert.AreEqual (string.Empty, member.MemberName); member.MemberName = null; Assert.AreEqual (string.Empty, member.MemberName); }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember member) { TypeMapping mapping = this.ImportType(member.MemberType, true); if (!(mapping is StructMapping)) { return(this.ImportMembersMapping(name, ns, new SoapSchemaMember[] { member })); } MembersMapping mapping2 = new MembersMapping { TypeDesc = base.Scope.GetTypeDesc(typeof(object[])), Members = ((StructMapping)mapping).Members, HasWrapperElement = true }; return(new XmlMembersMapping(base.Scope, new ElementAccessor { IsSoap = true, Name = name, Namespace = (mapping.Namespace != null) ? mapping.Namespace : ns, Mapping = mapping2, IsNullable = false, Form = XmlSchemaForm.Qualified }, XmlMappingAccess.Write | XmlMappingAccess.Read)); }
/// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember member) { TypeMapping typeMapping = ImportType(member.MemberType, true); if (!(typeMapping is StructMapping)) return ImportMembersMapping(name, ns, new SoapSchemaMember[] { member }); MembersMapping mapping = new MembersMapping(); mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); mapping.Members = ((StructMapping)typeMapping).Members; mapping.HasWrapperElement = true; ElementAccessor accessor = new ElementAccessor(); accessor.IsSoap = true; accessor.Name = name; accessor.Namespace = typeMapping.Namespace != null ? typeMapping.Namespace : ns; accessor.Mapping = mapping; accessor.IsNullable = false; accessor.Form = XmlSchemaForm.Qualified; return new XmlMembersMapping(Scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write); }
internal override string ImportType(MessagePartDescription part, XmlQualifiedName typeName, bool isEncoded) { XmlName memberName = new XmlName(part.Name, true /*isEncoded*/); string memberNs = part.Namespace; XmlMembersMapping membersMapping; SoapSchemaMember schemaMember = new SoapSchemaMember(); schemaMember.MemberName = memberName.EncodedName; schemaMember.MemberType = typeName; if (isEncoded) membersMapping = soapImporter.ImportMembersMapping(memberName.DecodedName, memberNs, new SoapSchemaMember[] { schemaMember }); else membersMapping = xmlImporter.ImportMembersMapping(memberName.DecodedName, memberNs, new SoapSchemaMember[] { schemaMember }); return AddPartType(part, membersMapping, isEncoded); }
internal override CodeTypeReference ImportFaultType(XmlQualifiedName elementName, XmlQualifiedName typeName, bool isEncoded) { XmlName memberName = new XmlName(elementName.Name, true /*isEncoded*/); string memberNs = elementName.Namespace; XmlMembersMapping membersMapping; SoapSchemaMember schemaMember = new SoapSchemaMember(); schemaMember.MemberName = memberName.EncodedName; schemaMember.MemberType = typeName; if (isEncoded) { membersMapping = soapImporter.ImportMembersMapping(memberName.DecodedName, memberNs, new SoapSchemaMember[] { schemaMember }); this.xmlSerializerOperationGenerator.SoapExporter.ExportMembersMapping(membersMapping); } else { membersMapping = xmlImporter.ImportMembersMapping(memberName.DecodedName, memberNs, new SoapSchemaMember[] { schemaMember }); this.xmlSerializerOperationGenerator.XmlExporter.ExportMembersMapping(membersMapping); } return new CodeTypeReference(this.xmlSerializerOperationGenerator.GetTypeName(membersMapping[0])); }
/// <summary> /// Search and returns the type mapping between method parameters/return value /// and the element parts of a literal-use SOAP message. /// </summary> private XmlMembersMapping GetMembersMapping(string messageName, MessagePartCollection messageParts, SoapBodyBinding soapBodyBinding, SoapBindingStyle soapBindingStyle) { if (soapBindingStyle == SoapBindingStyle.Rpc) { SoapSchemaMember[] soapSchemaMembers = new SoapSchemaMember[messageParts.Count]; for (int i = 0; i < messageParts.Count; i++) { SoapSchemaMember ssm = new SoapSchemaMember(); ssm.MemberName = messageParts[i].Name; ssm.MemberType = messageParts[i].Type; soapSchemaMembers[i] = ssm; } return this.schemaImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, soapSchemaMembers); } else { return this.schemaImporter.ImportMembersMapping(messageParts[0].Element); } }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement, Type baseType, bool baseTypeCanBeIndirect) { XmlSchemaComplexType type = new XmlSchemaComplexType(); XmlSchemaSequence sequence = new XmlSchemaSequence(); type.Particle = sequence; foreach (SoapSchemaMember member in members) { XmlSchemaElement item = new XmlSchemaElement { Name = member.MemberName, SchemaTypeName = member.MemberType }; sequence.Items.Add(item); } CodeIdentifiers identifiers = new CodeIdentifiers { UseCamelCasing = true }; MembersMapping mapping = new MembersMapping { TypeDesc = base.Scope.GetTypeDesc(typeof(object[])), Members = this.ImportTypeMembers(type, ns, identifiers), HasWrapperElement = hasWrapperElement }; if (baseType != null) { for (int i = 0; i < mapping.Members.Length; i++) { MemberMapping mapping2 = mapping.Members[i]; if (mapping2.Accessor.Mapping is StructMapping) { base.MakeDerived((StructMapping) mapping2.Accessor.Mapping, baseType, baseTypeCanBeIndirect); } } } return new XmlMembersMapping(base.Scope, new ElementAccessor { IsSoap = true, Name = name, Namespace = ns, Mapping = mapping, IsNullable = false, Form = XmlSchemaForm.Qualified }, XmlMappingAccess.Write | XmlMappingAccess.Read); }
internal XmlMembersMapping ImportEncodedMembersMapping (string name, string ns, SoapSchemaMember member) { XmlSchemaComplexType stype = schemas.Find (member.MemberType, typeof (XmlSchemaComplexType)) as XmlSchemaComplexType; if (stype == null) throw new InvalidOperationException ("Schema type '" + member.MemberType + "' not found or not valid"); XmlMemberMapping[] mapping = ImportMembersMappingComposite (stype, member.MemberType); return new XmlMembersMapping (name, ns, mapping); }
public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members) { throw new NotImplementedException (); }
/// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping2"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement) { return ImportMembersMapping(name, ns, members, hasWrapperElement, null, false); }
XmlMembersMapping ImportMembersMapping (Message msg, SoapBodyBinding sbb, SoapBindingStyle style, bool output) { string elemName = Operation.Name; if (output) elemName += "Response"; if (msg.Parts.Count == 1 && msg.Parts[0].Name == "parameters") { // Wrapped parameter style MessagePart part = msg.Parts[0]; if (sbb.Use == SoapBindingUse.Encoded) { SoapSchemaMember ssm = new SoapSchemaMember (); ssm.MemberName = part.Name; ssm.MemberType = part.Type; return soapImporter.ImportMembersMapping (elemName, part.Type.Namespace, ssm); } else return xmlImporter.ImportMembersMapping (part.Element); } else { if (sbb.Use == SoapBindingUse.Encoded) { SoapSchemaMember[] mems = new SoapSchemaMember [msg.Parts.Count]; for (int n=0; n<mems.Length; n++) { SoapSchemaMember mem = new SoapSchemaMember(); mem.MemberName = msg.Parts[n].Name; mem.MemberType = msg.Parts[n].Type; mems[n] = mem; } // Rpc messages always have a wrapping element if (style == SoapBindingStyle.Rpc) return soapImporter.ImportMembersMapping (elemName, sbb.Namespace, mems, true); else return soapImporter.ImportMembersMapping ("", "", mems, false); } else { if (style == SoapBindingStyle.Rpc) throw new InvalidOperationException ("The combination of style=rpc with use=literal is not supported"); if (msg.Parts.Count == 1 && msg.Parts[0].Type != XmlQualifiedName.Empty) return xmlImporter.ImportAnyType (msg.Parts[0].Type, null); else { XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count]; for (int n=0; n<pnames.Length; n++) pnames[n] = msg.Parts[n].Element; return xmlImporter.ImportMembersMapping (pnames); } } } }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember member) { return(_importer.ImportEncodedMembersMapping(name, ns, member)); }
private XmlMembersMapping ImportLiteralMessage(string messageName, MessagePart[] parts, SoapBodyBinding soapBodyBinding, SoapBindingStyle soapBindingStyle, bool wrapped) { XmlMembersMapping mapping; if (soapBindingStyle == SoapBindingStyle.Rpc) { SoapSchemaMember[] members = new SoapSchemaMember[parts.Length]; for (int i = 0; i < members.Length; i++) { MessagePart part = parts[i]; members[i] = new SoapSchemaMember { MemberName = part.Name, MemberType = part.Type }; } mapping = this.xmlImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, members); } else if (wrapped) { mapping = this.xmlImporter.ImportMembersMapping(parts[0].Element); } else { if ((parts.Length == 1) && !parts[0].Type.IsEmpty) { mapping = this.xmlImporter.ImportAnyType(parts[0].Type, parts[0].Name); this.xmlMembers.Add(mapping); return mapping; } XmlQualifiedName[] names = new XmlQualifiedName[parts.Length]; for (int j = 0; j < parts.Length; j++) { names[j] = parts[j].Element; } mapping = this.xmlImporter.ImportMembersMapping(names); } this.xmlMembers.Add(mapping); return mapping; }
private XmlMembersMapping ImportEncodedMessage(string messageName, MessagePart[] parts, SoapBodyBinding soapBodyBinding, bool wrapped) { XmlMembersMapping mapping; if (wrapped) { SoapSchemaMember member = new SoapSchemaMember { MemberName = parts[0].Name, MemberType = parts[0].Type }; mapping = this.soapImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, member); } else { SoapSchemaMember[] members = new SoapSchemaMember[parts.Length]; for (int i = 0; i < members.Length; i++) { MessagePart part = parts[i]; members[i] = new SoapSchemaMember { MemberName = part.Name, MemberType = part.Type }; } mapping = this.soapImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, members); } this.soapMembers.Add(mapping); return mapping; }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members) { XmlSchemaComplexType type = new XmlSchemaComplexType(); XmlSchemaSequence sequence = new XmlSchemaSequence(); type.Particle = sequence; foreach (SoapSchemaMember member in members) { XmlSchemaElement item = new XmlSchemaElement { Name = member.MemberName, SchemaTypeName = member.MemberType }; sequence.Items.Add(item); } MembersMapping mapping = this.ImportMembersType(type, null, name); return new XmlMembersMapping(base.Scope, new ElementAccessor { Name = Accessor.EscapeName(name), Namespace = ns, Mapping = mapping, IsNullable = false, Form = XmlSchemaForm.Qualified }, XmlMappingAccess.Write | XmlMappingAccess.Read); }
XmlMembersMapping ImportLiteralMessage(string messageName, MessagePart[] parts, SoapBodyBinding soapBodyBinding, SoapBindingStyle soapBindingStyle, bool wrapped) { XmlMembersMapping membersMapping; if (soapBindingStyle == SoapBindingStyle.Rpc) { SoapSchemaMember[] schemaMembers = new SoapSchemaMember[parts.Length]; for (int i = 0; i < schemaMembers.Length; i++) { MessagePart part = parts[i]; SoapSchemaMember schemaMember = new SoapSchemaMember(); schemaMember.MemberName = part.Name; schemaMember.MemberType = part.Type; schemaMembers[i] = schemaMember; } membersMapping = xmlImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, schemaMembers); } else if (wrapped) { membersMapping = xmlImporter.ImportMembersMapping(parts[0].Element); } else { if (parts.Length == 1 && !parts[0].Type.IsEmpty) { // special case for <any> at root // we know this will work because we tried it earlier in CheckMessageStyles. membersMapping = xmlImporter.ImportAnyType(parts[0].Type, parts[0].Name); xmlMembers.Add(membersMapping); return membersMapping; } XmlQualifiedName[] names = new XmlQualifiedName[parts.Length]; for (int i = 0; i < parts.Length; i++) names[i] = parts[i].Element; membersMapping = xmlImporter.ImportMembersMapping(names); } xmlMembers.Add(membersMapping); return membersMapping; }
XmlMembersMapping ImportEncodedMessage(string messageName, MessagePart[] parts, SoapBodyBinding soapBodyBinding, bool wrapped) { XmlMembersMapping membersMapping; if (wrapped) { SoapSchemaMember schemaMember = new SoapSchemaMember(); schemaMember.MemberName = parts[0].Name; schemaMember.MemberType = parts[0].Type; membersMapping = soapImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, schemaMember); } else { SoapSchemaMember[] schemaMembers = new SoapSchemaMember[parts.Length]; for (int i = 0; i < schemaMembers.Length; i++) { MessagePart part = parts[i]; SoapSchemaMember schemaMember = new SoapSchemaMember(); schemaMember.MemberName = part.Name; schemaMember.MemberType = part.Type; schemaMembers[i] = schemaMember; } membersMapping = soapImporter.ImportMembersMapping(messageName, soapBodyBinding.Namespace, schemaMembers); } soapMembers.Add(membersMapping); return membersMapping; }
public void MemberTypeDefault () { SoapSchemaMember member = new SoapSchemaMember (); Assert.AreEqual (XmlQualifiedName.Empty, member.MemberType); }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members) { XmlSchemaComplexType type = new XmlSchemaComplexType(); XmlSchemaSequence seq = new XmlSchemaSequence(); type.Particle = seq; foreach (SoapSchemaMember member in members) { XmlSchemaElement element = new XmlSchemaElement(); element.Name = member.MemberName; element.SchemaTypeName = member.MemberType; seq.Items.Add(element); } MembersMapping mapping = ImportMembersType(type, null, name); ElementAccessor accessor = new ElementAccessor(); accessor.Name = Accessor.EscapeName(name); accessor.Namespace = ns; accessor.Mapping = mapping; accessor.IsNullable = false; accessor.Form = XmlSchemaForm.Qualified; return new XmlMembersMapping(Scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write); }
/// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members) { return ImportMembersMapping(name, ns, members, true); }
public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement) { return _importer.ImportEncodedMembersMapping (name, ns, members, hasWrapperElement); }
/// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping3"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement, Type baseType, bool baseTypeCanBeIndirect) { XmlSchemaComplexType type = new XmlSchemaComplexType(); XmlSchemaSequence seq = new XmlSchemaSequence(); type.Particle = seq; foreach (SoapSchemaMember member in members) { XmlSchemaElement element = new XmlSchemaElement(); element.Name = member.MemberName; element.SchemaTypeName = member.MemberType; seq.Items.Add(element); } CodeIdentifiers identifiers = new CodeIdentifiers(); identifiers.UseCamelCasing = true; MembersMapping mapping = new MembersMapping(); mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); mapping.Members = ImportTypeMembers(type, ns, identifiers); mapping.HasWrapperElement = hasWrapperElement; if (baseType != null) { for (int i = 0; i < mapping.Members.Length; i++) { MemberMapping member = mapping.Members[i]; if (member.Accessor.Mapping is StructMapping) MakeDerived((StructMapping)member.Accessor.Mapping, baseType, baseTypeCanBeIndirect); } } ElementAccessor accessor = new ElementAccessor(); accessor.IsSoap = true; accessor.Name = name; accessor.Namespace = ns; accessor.Mapping = mapping; accessor.IsNullable = false; accessor.Form = XmlSchemaForm.Qualified; return new XmlMembersMapping(Scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write); }
public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement, Type baseType, bool baseTypeCanBeIndirect) { throw new NotImplementedException (); }
internal XmlMembersMapping ImportEncodedMembersMapping (string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement) { XmlMemberMapping[] mapping = new XmlMemberMapping [members.Length]; for (int n=0; n<members.Length; n++) { TypeData td = GetTypeData (members[n].MemberType, null, false); // FIXME: isNullable could be true? XmlTypeMapping tmap = GetTypeMapping (td); mapping[n] = ImportMemberMapping (members[n].MemberName, members[n].MemberType.Namespace, true, td, tmap, n); } BuildPendingMaps (); return new XmlMembersMapping (name, ns, hasWrapperElement, false, mapping); }
public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members) { return _importer.ImportEncodedMembersMapping (name, ns, members, false); }
XmlMembersMapping ImportInMembersMapping (Message msg) { SoapSchemaMember[] mems = new SoapSchemaMember [msg.Parts.Count]; for (int n=0; n<mems.Length; n++) { SoapSchemaMember mem = new SoapSchemaMember(); mem.MemberName = msg.Parts[n].Name; mem.MemberType = msg.Parts[n].Type; mems[n] = mem; } return soapImporter.ImportMembersMapping (Operation.Name, "", mems); }
public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember member) { TypeMapping mapping = this.ImportType(member.MemberType, true); if (!(mapping is StructMapping)) { return this.ImportMembersMapping(name, ns, new SoapSchemaMember[] { member }); } MembersMapping mapping2 = new MembersMapping { TypeDesc = base.Scope.GetTypeDesc(typeof(object[])), Members = ((StructMapping) mapping).Members, HasWrapperElement = true }; return new XmlMembersMapping(base.Scope, new ElementAccessor { IsSoap = true, Name = name, Namespace = (mapping.Namespace != null) ? mapping.Namespace : ns, Mapping = mapping2, IsNullable = false, Form = XmlSchemaForm.Qualified }, XmlMappingAccess.Write | XmlMappingAccess.Read); }