protected override void ImportPartsBySchemaElement(QName qname, List <MessagePartDescription> parts, Message msg, MessagePart msgPart) { if (schema_set_cache != schema_set_in_use) { schema_set_cache = schema_set_in_use; var xss = new XmlSchemas(); foreach (XmlSchema xs in schema_set_cache.Schemas()) { xss.Add(xs); } schema_importer = new XmlSchemaImporter(xss); if (ccu.Namespaces.Count == 0) { ccu.Namespaces.Add(new CodeNamespace()); } var cns = ccu.Namespaces [0]; code_exporter = new XmlCodeExporter(cns, ccu); } var part = new MessagePartDescription(qname.Name, qname.Namespace); part.XmlSerializationImporter = this; var mbrNS = msg.ServiceDescription.TargetNamespace; var xmm = schema_importer.ImportMembersMapping(qname); code_exporter.ExportMembersMapping(xmm); // FIXME: use of ElementName is a hack! part.CodeTypeReference = new CodeTypeReference(xmm.ElementName); parts.Add(part); }
protected override CodeMemberMethod GenerateMethod() { try { HttpOperationBinding httpOper = OperationBinding.Extensions.Find(typeof(HttpOperationBinding)) as HttpOperationBinding; if (httpOper == null) { throw new Exception("Http operation binding not found"); } XmlMembersMapping inputMembers = ImportInMembersMapping(InputMessage); XmlTypeMapping outputMember = ImportOutMembersMapping(OutputMessage); CodeMemberMethod met = GenerateMethod(memberIds, httpOper, inputMembers, outputMember); xmlExporter.ExportMembersMapping(inputMembers); if (outputMember != null) { xmlExporter.ExportTypeMapping(outputMember); } return(met); } catch (Exception ex) { UnsupportedOperationBindingWarning(ex.Message); return(null); } }
protected override CodeMemberMethod GenerateMethod() { try { SoapOperationBinding soapOper = OperationBinding.Extensions.Find(typeof(SoapOperationBinding)) as SoapOperationBinding; if (soapOper == null) { throw new InvalidOperationException("Soap operation binding not found"); } SoapBindingStyle style = soapOper.Style != SoapBindingStyle.Default ? soapOper.Style : soapBinding.Style; SoapBodyBinding isbb = null; XmlMembersMapping inputMembers = null; bool isWrapped = CheckIsWrapped(); isbb = OperationBinding.Input.Extensions.Find(typeof(SoapBodyBinding)) as SoapBodyBinding; if (isbb == null) { throw new InvalidOperationException("Soap body binding not found"); } inputMembers = ImportMembersMapping(InputMessage, isbb, style, false, isWrapped); if (inputMembers == null) { throw new InvalidOperationException("Input message not declared"); } // If OperationBinding.Output is null, it is an OneWay operation SoapBodyBinding osbb = null; XmlMembersMapping outputMembers = null; if (OperationBinding.Output != null) { osbb = OperationBinding.Output.Extensions.Find(typeof(SoapBodyBinding)) as SoapBodyBinding; if (osbb == null) { throw new InvalidOperationException("Soap body binding not found"); } outputMembers = ImportMembersMapping(OutputMessage, osbb, style, true, isWrapped); if (outputMembers == null) { throw new InvalidOperationException("Output message not declared"); } } CodeMemberMethod met = GenerateMethod(memberIds, soapOper, isbb, inputMembers, outputMembers); if (isbb.Use == SoapBindingUse.Literal) { xmlExporter.ExportMembersMapping(inputMembers); } else { soapExporter.ExportMembersMapping(inputMembers); } if (osbb != null) { if (osbb.Use == SoapBindingUse.Literal) { xmlExporter.ExportMembersMapping(outputMembers); } else { soapExporter.ExportMembersMapping(outputMembers); } } foreach (SoapExtensionImporter eximporter in extensionImporters) { eximporter.ImportContext = this; eximporter.ImportMethod(met.CustomAttributes); } return(met); } catch (InvalidOperationException ex) { UnsupportedOperationBindingWarning(ex.Message); return(null); } }