本文整理汇总了C#中System.Web.Services.Description.ServiceDescriptionCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceDescriptionCollection.Add方法的具体用法?C# ServiceDescriptionCollection.Add怎么用?C# ServiceDescriptionCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Services.Description.ServiceDescriptionCollection
的用法示例。
在下文中一共展示了ServiceDescriptionCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckConformance
public static bool CheckConformance (WsiClaims claims, ServiceDescription service, BasicProfileViolationCollection violations)
{
ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
col.Add (service);
ConformanceCheckContext ctx = new ConformanceCheckContext (col, violations);
return Check (claims, ctx, col);
}
示例2: GetServiceDescriptions
public static ServiceDescriptionCollection GetServiceDescriptions(DiscoveryClientProtocol protocol)
{
ServiceDescriptionCollection services = new ServiceDescriptionCollection();
protocol.ResolveOneLevel();
foreach (DictionaryEntry entry in protocol.References) {
ContractReference contractRef = entry.Value as ContractReference;
if (contractRef != null) {
services.Add(contractRef.Contract);
}
}
return services;
}
示例3: AddDocument
internal static void AddDocument(string path, object document, XmlSchemas schemas, ServiceDescriptionCollection descriptions, StringCollection warnings)
{
ServiceDescription serviceDescription = document as ServiceDescription;
if (serviceDescription != null)
{
descriptions.Add(serviceDescription);
}
else
{
XmlSchema schema = document as XmlSchema;
if (schema != null)
{
schemas.Add(schema);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:ServiceDescriptionImporter.cs
示例4: Generate
public static void Generate (ArrayList services, ArrayList schemas, string binOper, string protocol)
{
ServiceDescriptionCollection descCol = new ServiceDescriptionCollection ();
foreach (ServiceDescription sd in services)
descCol.Add (sd);
XmlSchemas schemaCol;
if (schemas.Count > 0) {
schemaCol = new XmlSchemas ();
foreach (XmlSchema sc in schemas)
schemaCol.Add (sc);
}
else
schemaCol = descCol[0].Types.Schemas;
string oper, bin = null;
int i = binOper.IndexOf ('/');
if (i != -1) {
oper = binOper.Substring (i+1);
bin = binOper.Substring (0,i);
}
else
oper = binOper;
ConsoleSampleGenerator sg = new ConsoleSampleGenerator (descCol, schemaCol);
string req, resp;
sg.GenerateMessages (oper, bin, protocol, out req, out resp);
Console.WriteLine ();
Console.WriteLine ("Sample request message:");
Console.WriteLine ();
Console.WriteLine (req);
Console.WriteLine ();
Console.WriteLine ("Sample response message:");
Console.WriteLine ();
Console.WriteLine (resp);
}
示例5: AddDocument
private void AddDocument(string path, object document, XmlSchemas schemas, ServiceDescriptionCollection descriptions)
{
ServiceDescription serviceDescription = document as ServiceDescription;
if (serviceDescription != null)
{
if (descriptions[serviceDescription.TargetNamespace] == null)
{
descriptions.Add(serviceDescription);
StringWriter w = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(w);
writer.Formatting = Formatting.Indented;
serviceDescription.Write(writer);
this.wsdls.Add(w.ToString());
}
else
{
this.CheckPoint(MessageType.Warning, string.Format(duplicateService, serviceDescription.TargetNamespace, path));
}
}
else
{
XmlSchema schema = document as XmlSchema;
if (schema != null)
{
if (schemas[schema.TargetNamespace] == null)
{
schemas.Add(schema);
StringWriter writer3 = new StringWriter();
XmlTextWriter writer4 = new XmlTextWriter(writer3);
writer4.Formatting = Formatting.Indented;
schema.Write(writer4);
this.xsds.Add(writer3.ToString());
}
else
{
this.CheckPoint(MessageType.Warning, string.Format(duplicateSchema, serviceDescription.TargetNamespace, path));
}
}
}
}
示例6: GetServiceDescriptionCollection
ServiceDescriptionCollection GetServiceDescriptionCollection(DiscoveryClientProtocol protocol)
{
ServiceDescriptionCollection services = new ServiceDescriptionCollection();
foreach (DictionaryEntry entry in protocol.References) {
ContractReference contractRef = entry.Value as ContractReference;
DiscoveryDocumentReference discoveryRef = entry.Value as DiscoveryDocumentReference;
if (contractRef != null) {
services.Add(contractRef.Contract);
}
}
return services;
}
示例7: WsdlImporter
public WsdlImporter (
MetadataSet metadata,
IEnumerable<IPolicyImportExtension> policyImportExtensions,
IEnumerable<IWsdlImportExtension> wsdlImportExtensions)
: base (policyImportExtensions)
{
if (metadata == null)
throw new ArgumentNullException ("metadata");
if (wsdlImportExtensions == null) {
wsdl_extensions = new KeyedByTypeCollection<IWsdlImportExtension> ();
wsdl_extensions.Add (new StandardBindingImporter ());
wsdl_extensions.Add (new TransportBindingElementImporter ());
//wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
wsdl_extensions.Add (new XmlSerializerMessageContractImporter ());
wsdl_extensions.Add (new DataContractSerializerMessageContractImporter ());
} else {
wsdl_extensions = new KeyedByTypeCollection<IWsdlImportExtension> (wsdlImportExtensions);
}
this.metadata = metadata;
this.wsdl_documents = new ServiceDescriptionCollection ();
this.xmlschemas = new XmlSchemaSet ();
this.policies = new List<XmlElement> ();
foreach (MetadataSection ms in metadata.MetadataSections) {
if (ms.Dialect == MetadataSection.ServiceDescriptionDialect &&
ms.Metadata.GetType () == typeof (WSServiceDescription))
wsdl_documents.Add ((WSServiceDescription) ms.Metadata);
else
if (ms.Dialect == MetadataSection.XmlSchemaDialect &&
ms.Metadata.GetType () == typeof (XmlSchema))
xmlschemas.Add ((XmlSchema) ms.Metadata);
}
}
示例8: ProcessWsdl
private void ProcessWsdl()
{
string wsdlText;
string portType;
string bindingName;
string address;
string spnIdentity = null;
string upnIdentity = null;
string dnsIdentity = null;
EndpointIdentity identity = null;
string serializer = null;
string contractNamespace = null;
string bindingNamespace = null;
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Wsdl, out wsdlText);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Contract, out portType);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Binding, out bindingName);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Address, out address);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.SpnIdentity, out spnIdentity);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.UpnIdentity, out upnIdentity);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.DnsIdentity, out dnsIdentity);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Serializer, out serializer);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.BindingNamespace, out bindingNamespace);
propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.ContractNamespace, out contractNamespace);
if (string.IsNullOrEmpty(wsdlText))
{
throw Fx.AssertAndThrow("Wsdl should not be null at this point");
}
if (string.IsNullOrEmpty(portType) || string.IsNullOrEmpty(bindingName) || string.IsNullOrEmpty(address))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(SR.GetString(SR.ContractBindingAddressCannotBeNull)));
if (!string.IsNullOrEmpty(spnIdentity))
{
if ((!string.IsNullOrEmpty(upnIdentity)) || (!string.IsNullOrEmpty(dnsIdentity)))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(SR.GetString(SR.MonikerIncorrectServerIdentity)));
identity = EndpointIdentity.CreateSpnIdentity(spnIdentity);
}
else if (!string.IsNullOrEmpty(upnIdentity))
{
if ((!string.IsNullOrEmpty(spnIdentity)) || (!string.IsNullOrEmpty(dnsIdentity)))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(SR.GetString(SR.MonikerIncorrectServerIdentity)));
identity = EndpointIdentity.CreateUpnIdentity(upnIdentity);
}
else if (!string.IsNullOrEmpty(dnsIdentity))
{
if ((!string.IsNullOrEmpty(spnIdentity)) || (!string.IsNullOrEmpty(upnIdentity)))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(SR.GetString(SR.MonikerIncorrectServerIdentity)));
identity = EndpointIdentity.CreateDnsIdentity(dnsIdentity);
}
else
identity = null;
bool removeXmlSerializerImporter = false;
if (!String.IsNullOrEmpty(serializer))
{
if ("xml" != serializer && "datacontract" != serializer)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(SR.GetString(SR.MonikerIncorectSerializer)));
if ("xml" == serializer)
useXmlSerializer = true;
else
removeXmlSerializerImporter = true; // specifying datacontract will explicitly remove the Xml importer
// if this parameter is not set we will simply use indigo defaults
}
TextReader reader = new StringReader(wsdlText);
try
{
try
{
WsdlNS.ServiceDescription wsdl = WsdlNS.ServiceDescription.Read(reader);
if (String.IsNullOrEmpty(contractNamespace))
contractNamespace = wsdl.TargetNamespace;
if (String.IsNullOrEmpty(bindingNamespace))
bindingNamespace = wsdl.TargetNamespace;
WsdlNS.ServiceDescriptionCollection wsdlDocs = new WsdlNS.ServiceDescriptionCollection();
wsdlDocs.Add(wsdl);
XmlSchemaSet schemas = new XmlSchemaSet();
foreach (XmlSchema schema in wsdl.Types.Schemas)
schemas.Add(schema);
MetadataSet mds = new MetadataSet(WsdlImporter.CreateMetadataDocuments(wsdlDocs, schemas, null));
WsdlImporter importer;
if (useXmlSerializer)
importer = CreateXmlSerializerImporter(mds);
else
{
if (removeXmlSerializerImporter)
importer = CreateDataContractSerializerImporter(mds);
else
importer = new WsdlImporter(mds);
}
XmlQualifiedName contractQname = new XmlQualifiedName(portType, contractNamespace);
//.........这里部分代码省略.........
示例9: GenerateSampleData
public model.WebSvcMethodContainer GenerateSampleData()
{
Dictionary<string, model.WebSvcMethod> results = new Dictionary<string, model.WebSvcMethod>();
List<string> methodList = GetMethodList();
foreach (string method in methodList) {
ServiceDescriptionCollection descCol = new ServiceDescriptionCollection();
foreach (ServiceDescription sd in _descriptions) {
descCol.Add(sd);
}
XmlSchemas schemaCol;
if (_schemas.Count > 0) {
schemaCol = new XmlSchemas();
foreach (XmlSchema sc in _schemas) {
schemaCol.Add(sc);
}
}
else {
schemaCol = descCol[0].Types.Schemas;
}
string req;
string resp;
SampleGeneratorWebSvc sg = new SampleGeneratorWebSvc(descCol, schemaCol);
sg.GenerateMessages(method, null, "Soap", out req, out resp);
int indexOfReqMsg = req.IndexOf(@"<soap:Envelope");
string reqHeaderMsg = req.Substring(0, indexOfReqMsg);
string sampleReqMsg = req.Substring(indexOfReqMsg);
int indexOfRespMsg = resp.IndexOf(@"<soap:Envelope");
string respHeaderMsg = resp.Substring(0, indexOfRespMsg);
string sampleRespMsg = resp.Substring(indexOfRespMsg);
string[] reqHeaderLines = reqHeaderMsg.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
string soapAction = GetHeader(reqHeaderLines, "SOAPAction:");
string reqContentType = GetHeader(reqHeaderLines, "Content-Type:");
string[] respHeaderLines = respHeaderMsg.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
string respContentType = GetHeader(respHeaderLines, "Content-Type:");
model.WebSvcMessageRequest messageRequest = new model.WebSvcMessageRequest();
messageRequest.Body = sampleReqMsg;
messageRequest.Headers[model.WebSvcMessage.HEADER_NAME_CONTENT_TYPE] = reqContentType;
messageRequest.Headers[model.WebSvcMessageRequest.HEADER_NAME_SOAP_ACTION] = soapAction;
model.WebSvcMessageResponse messageResponse = new model.WebSvcMessageResponse();
messageResponse.Body = sampleRespMsg;
messageResponse.Headers[model.WebSvcMessage.HEADER_NAME_CONTENT_TYPE] = respContentType;
model.WebSvcMethod webMethod = new model.WebSvcMethod(method, _serviceURI) {
Request = messageRequest,
Response = messageResponse
};
results[method] = webMethod;
}
return new model.WebSvcMethodContainer(results);
}
示例10: AddDocument
private void AddDocument(string path, object document, XmlSchemas schemas,
ServiceDescriptionCollection descriptions)
{
ServiceDescription description1 = document as ServiceDescription;
if (description1 != null)
{
if (descriptions[description1.TargetNamespace] == null)
{
descriptions.Add(description1);
StringWriter writer1 = new StringWriter();
XmlTextWriter writer2 = new XmlTextWriter(writer1);
writer2.Formatting = Formatting.Indented;
description1.Write(writer2);
wsdls.Add(writer1.ToString());
}
else
{
CheckPoint(MessageType.Warning, string.Format(duplicateService, description1.TargetNamespace, path));
}
}
else
{
XmlSchema schema1 = document as XmlSchema;
if (schema1 != null)
{
if (schemas[schema1.TargetNamespace] == null)
{
schemas.Add(schema1);
StringWriter writer3 = new StringWriter();
XmlTextWriter writer4 = new XmlTextWriter(writer3);
writer4.Formatting = Formatting.Indented;
schema1.Write(writer4);
xsds.Add(writer3.ToString());
}
else
{
CheckPoint(MessageType.Warning,
string.Format(duplicateSchema, description1.TargetNamespace, path));
}
}
}
}
示例11: ParseCode
/// <summary>
/// Given an assembly, use reflection to parse the assemblies module(s) and gerenate a wsdl.
/// </summary>
/// <param name="assemblyName">A String containing the path/name of an assembly to process.</param>
/// <param name="referencePath">A string containing a path used to load refernced assemblies not found in the Gac.</param>
/// <param name="wsdlFilenameOverride">A string containing a specified wsdl filename.</param>
/// <param name="contractName">A string containing the name of a specific service contract in the assembly to process.</param>
/// <param name="destinationPath">A string containing the name of a directory where generated files are created.</param>
/// <param name="generateSourceFiles">If true generate DPWS source files.</param>
public void ParseCode(string assemblyName, string referencePath, string wsdlFilenameOverride, string contractName, string destinationPath, bool generateSourceFiles)
{
m_assemblyRefPath = referencePath;
AppDomain domain = AppDomain.CurrentDomain;
domain.AssemblyResolve += new ResolveEventHandler(domain_AssemblyResolve);
if (assemblyName == null)
throw new ArgumentNullException("assemblyName", "Must not be null");
// If a specific contract is specified only process it
bool contractFound = false;
// Load the assembly
Assembly asm = Assembly.LoadFrom(assemblyName);
Module[] mods = asm.GetLoadedModules();
ServiceDescriptionCollection serviceDescriptions = new ServiceDescriptionCollection();
List<Type> m_processedTypes = new List<Type>();
bool m_includeBinding = true;
// Iterate the colleciton of modules in the assembly
foreach (Module mod in mods)
{
Logger.WriteLine("Module name = " + mod.Name, LogLevel.Verbose);
// Iterate the types in a module looking for types with key attributes
Type[] types = mod.GetTypes();
foreach (Type t in types)
{
bool hasPolicy = false;
bool hasEvents = false;
bool hasOptimizedMimePolicy = false;
if (m_processedTypes.Contains(t))
continue;
// Inintialize a service description used to store the type information if key types are found
ServiceDescription serviceDesc = null;
PortType portType = null;
// For a type iterate an optional list of attributes looking for ServiceContract or DataContract attributes
object[] customAttribs = t.GetCustomAttributes(true);
for (int i = 0; i < customAttribs.Length; ++i)
{
// Look for ServiceContract and DataContract attributes
Attribute attrib = (Attribute)customAttribs[i];
switch (((Type)attrib.TypeId).Name)
{
case "PolicyAssertionAttribute":
case "PolicyAssertion":
// Set policy flag
hasPolicy = true;
// If an Mtom policy assertinon attribute is found set the mtom flag
string policy = (string)attrib.GetType().GetProperty("Name", typeof(string)).GetValue(attrib, null);
if (policy != null && policy == "OptimizedMimeSerialization")
hasOptimizedMimePolicy = true;
break;
case "ServiceContractAttribute":
case "ServiceContract":
// This flag enforces processing of the specified service contract only if specified
if (contractFound == true)
break;
// If the specified contract is found set the flag
if (contractName != null && contractName == t.Name)
contractFound = true;
// If a matching service description is found, append this contract to it else
// create a new service description and add it to the service description collection
if (serviceDesc == null)
{
// If a service description with the same namespace exists append this types information
string typeNamespace = (string)attrib.GetType().GetProperty("Namespace", typeof(string)).GetValue(attrib, null);
typeNamespace = typeNamespace == null ? FixupNamespace(t.Namespace) : typeNamespace;
if ((serviceDesc = FindServiceDescription(typeNamespace, serviceDescriptions)) == null)
{
serviceDesc = new ServiceDescription();
serviceDesc.TargetNamespace = typeNamespace;
serviceDescriptions.Add(serviceDesc);
}
}
// Process contract type
if ((portType = ProcessServiceContract(t, false, serviceDesc)) == null)
throw new Exception("Contract " + t.FullName + " failed to process.");
else
{
// Set the port type name
portType.Name = (string)attrib.GetType().GetProperty("Name", typeof(string)).GetValue(attrib, null);
if (portType.Name == null)
//.........这里部分代码省略.........
示例12: ConformanceCheckContext
public ConformanceCheckContext (WebReference webReference, BasicProfileViolationCollection violations)
{
this.webReference = webReference;
this.violations = violations;
services = new ServiceDescriptionCollection ();
foreach (object doc in webReference.Documents.Values)
{
if (doc is XmlSchema)
schemas.Add ((XmlSchema)doc);
else if (doc is ServiceDescription) {
ServiceDescription sd = (ServiceDescription) doc;
services.Add (sd);
if (sd.Types != null && sd.Types.Schemas != null)
schemas.Add (sd.Types.Schemas);
}
}
}
示例13: WsdlImporter
public WsdlImporter (
MetadataSet metadata,
IEnumerable<IPolicyImportExtension> policyImportExtensions,
IEnumerable<IWsdlImportExtension> wsdlImportExtensions)
: base (policyImportExtensions)
{
if (metadata == null)
throw new ArgumentNullException ("metadata");
if (wsdlImportExtensions == null) {
wsdl_extensions = new KeyedByTypeCollection<IWsdlImportExtension> ();
wsdl_extensions.Add (new DataContractSerializerMessageContractImporter ());
wsdl_extensions.Add (new XmlSerializerMessageContractImporter ());
wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
wsdl_extensions.Add (new TransportBindingElementImporter ());
wsdl_extensions.Add (new StandardBindingImporter ());
} else {
wsdl_extensions = new KeyedByTypeCollection<IWsdlImportExtension> (wsdlImportExtensions);
}
// It is okay to fill these members immediately when WsdlImporter.ctor() is invoked
// i.e. after this .ctor(), those metadata docs are not considered anymore.
this.metadata = metadata;
this.wsdl_documents = new ServiceDescriptionCollection ();
this.xmlschemas = new XmlSchemaSet ();
this.policies = new List<XmlElement> ();
this.contractHash = new Dictionary<PortType, ContractDescription> ();
this.bindingHash = new Dictionary<WSBinding, ServiceEndpoint> ();
this.endpointHash = new Dictionary<Port, ServiceEndpoint> ();
foreach (MetadataSection ms in metadata.MetadataSections) {
if (ms.Dialect == MetadataSection.ServiceDescriptionDialect &&
ms.Metadata.GetType () == typeof (WSServiceDescription))
wsdl_documents.Add ((WSServiceDescription) ms.Metadata);
else
if (ms.Dialect == MetadataSection.XmlSchemaDialect &&
ms.Metadata.GetType () == typeof (XmlSchema))
xmlschemas.Add ((XmlSchema) ms.Metadata);
}
}
示例14: CheckConformance
public static bool CheckConformance(WsiProfiles claims, ServiceDescription description, BasicProfileViolationCollection violations)
{
if (description == null)
{
throw new ArgumentNullException("description");
}
ServiceDescriptionCollection descriptions = new ServiceDescriptionCollection();
descriptions.Add(description);
return CheckConformance(claims, descriptions, violations);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:WebServicesInteroperability.cs
示例15: ProcessWsdl
private void ProcessWsdl()
{
string str;
string str2;
string str3;
string str4;
string str5 = null;
string str6 = null;
string str7 = null;
EndpointIdentity identity = null;
string str8 = null;
string targetNamespace = null;
string str10 = null;
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Wsdl, out str);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Contract, out str2);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Binding, out str3);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Address, out str4);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.SpnIdentity, out str5);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.UpnIdentity, out str6);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.DnsIdentity, out str7);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Serializer, out str8);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.BindingNamespace, out str10);
this.propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.ContractNamespace, out targetNamespace);
if (string.IsNullOrEmpty(str))
{
throw Fx.AssertAndThrow("Wsdl should not be null at this point");
}
if ((string.IsNullOrEmpty(str2) || string.IsNullOrEmpty(str3)) || string.IsNullOrEmpty(str4))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(System.ServiceModel.SR.GetString("ContractBindingAddressCannotBeNull")));
}
if (!string.IsNullOrEmpty(str5))
{
if (!string.IsNullOrEmpty(str6) || !string.IsNullOrEmpty(str7))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(System.ServiceModel.SR.GetString("MonikerIncorrectServerIdentity")));
}
identity = EndpointIdentity.CreateSpnIdentity(str5);
}
else if (!string.IsNullOrEmpty(str6))
{
if (!string.IsNullOrEmpty(str5) || !string.IsNullOrEmpty(str7))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(System.ServiceModel.SR.GetString("MonikerIncorrectServerIdentity")));
}
identity = EndpointIdentity.CreateUpnIdentity(str6);
}
else if (!string.IsNullOrEmpty(str7))
{
if (!string.IsNullOrEmpty(str5) || !string.IsNullOrEmpty(str6))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(System.ServiceModel.SR.GetString("MonikerIncorrectServerIdentity")));
}
identity = EndpointIdentity.CreateDnsIdentity(str7);
}
else
{
identity = null;
}
bool flag = false;
if (!string.IsNullOrEmpty(str8))
{
if (("xml" != str8) && ("datacontract" != str8))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MonikerSyntaxException(System.ServiceModel.SR.GetString("MonikerIncorectSerializer")));
}
if ("xml" == str8)
{
this.useXmlSerializer = true;
}
else
{
flag = true;
}
}
TextReader textReader = new StringReader(str);
try
{
WsdlImporter importer;
System.Web.Services.Description.ServiceDescription serviceDescription = System.Web.Services.Description.ServiceDescription.Read(textReader);
if (string.IsNullOrEmpty(targetNamespace))
{
targetNamespace = serviceDescription.TargetNamespace;
}
if (string.IsNullOrEmpty(str10))
{
str10 = serviceDescription.TargetNamespace;
}
ServiceDescriptionCollection wsdlDocuments = new ServiceDescriptionCollection();
wsdlDocuments.Add(serviceDescription);
XmlSchemaSet xmlSchemas = new XmlSchemaSet();
foreach (System.Xml.Schema.XmlSchema schema in serviceDescription.Types.Schemas)
{
xmlSchemas.Add(schema);
}
MetadataSet metaData = new MetadataSet(WsdlImporter.CreateMetadataDocuments(wsdlDocuments, xmlSchemas, null));
if (this.useXmlSerializer)
{
importer = this.CreateXmlSerializerImporter(metaData);
}
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:WsdlServiceChannelBuilder.cs