本文整理汇总了C#中System.Web.Services.Discovery.DiscoveryClientProtocol类的典型用法代码示例。如果您正苦于以下问题:C# DiscoveryClientProtocol类的具体用法?C# DiscoveryClientProtocol怎么用?C# DiscoveryClientProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiscoveryClientProtocol类属于System.Web.Services.Discovery命名空间,在下文中一共展示了DiscoveryClientProtocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FixtureSetUp
public override void FixtureSetUp()
{
base.FixtureSetUp();
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = FileName.Create("C:\\projects\\test\\foo.csproj");
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
webReference = new Gui.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
foreach (ProjectItem item in webReference.Items) {
ProjectService.AddProjectItem(project, item);
}
webReferencesProjectItem = webReference.WebReferencesProjectItem;
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:27,代码来源:WebReferenceProjectItemsCachedTest.cs
示例2: SetUpFixture
public void SetUpFixture()
{
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = "C:\\projects\\test\\foo.csproj";
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services");
ProjectService.AddProjectItem(project, referenceItem);
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeLanguageBindings();
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:25,代码来源:WebServicesReferenceExistsTests.cs
示例3: DownloadFile
//MetadataExchangeClient can only download data from a local wsdl file, if it is a file we user the DiscoveryClientProtocol
void DownloadFile(out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas)
{
descriptions = new List<wsdlDescription.ServiceDescription>();
schemas = new List<XmlSchema>();
DiscoveryClientProtocol client = new DiscoveryClientProtocol();
//download document
client.AllowAutoRedirect = true;
client.Timeout = _timeoutInSeconds * 1000;
client.Documents.Clear();
client.DiscoverAny(_wsdlEndpoint);
client.ResolveAll();
foreach (var v in client.Documents.Values) {
if (v is wsdlDescription.ServiceDescription) {
descriptions.Add((wsdlDescription.ServiceDescription)v);
}
else if (v is XmlSchema) {
schemas.Add((XmlSchema)v);
}
}
}
开发者ID:umabiel,项目名称:WsdlUI,代码行数:26,代码来源:WsdlDownload.cs
示例4: FixtureSetUp
public override void FixtureSetUp()
{
base.FixtureSetUp();
// Set up the project.
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = FileName.Create("c:\\projects\\test\\foo.csproj");
// Web references item.
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
webReferencesItem.Include = "Web References\\";
ProjectService.AddProjectItem(project, webReferencesItem);
// Web reference url.
WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);
webReferenceUrl.Include = "http://localhost/test.asmx";
webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
webReferenceUrl.RelPath = "Web References\\localhost";
ProjectService.AddProjectItem(project, webReferenceUrl);
FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);
discoFileItem.Include = "Web References\\localhost\\test.disco";
ProjectService.AddProjectItem(project, discoFileItem);
FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);
wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
ProjectService.AddProjectItem(project, wsdlFileItem);
// Proxy
FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);
proxyItem.Include = "Web References\\localhost\\Reference.cs";
proxyItem.DependentUpon = "Reference.map";
ProjectService.AddProjectItem(project, proxyItem);
// Reference map.
FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);
mapItem.Include = "Web References\\localhost\\Reference.map";
ProjectService.AddProjectItem(project, mapItem);
// System.Web.Services reference.
ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
ProjectService.AddProjectItem(project, webServicesReferenceItem);
// Set up the web reference.
DiscoveryClientProtocol protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = "http://localhost/new.asmx";
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/new.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
var webReference = new Gui.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol);
changes = webReference.GetChanges(project);
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:60,代码来源:WebReferenceChangesTest.cs
示例5: FixtureSetUp
public override void FixtureSetUp()
{
base.FixtureSetUp();
project = WebReferenceTestHelper.CreateTestProject("C#");
WebReferencesProjectItem item = new WebReferencesProjectItem(project);
item.Include = "Web References\\";
ProjectService.AddProjectItem(project, item);
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
webReference = new Gui.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webReferencesProjectItem = WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:25,代码来源:ProjectHasExistingWebRefFolderTest.cs
示例6: SetUpFixture
public void SetUpFixture()
{
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = FileName.Create("C:\\projects\\test\\foo.csproj");
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webReferenceUrl = webReference.WebReferenceUrl;
discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.disco", ItemType.None);
referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.map", ItemType.None);
wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.wsdl", ItemType.None);
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.cs", ItemType.Compile);
webReferencesProjectItem = (WebReferencesProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:29,代码来源:WebReferenceTests.cs
示例7: GetDocumentNoParse
private static DiscoveryDocument GetDocumentNoParse(ref string url, DiscoveryClientProtocol client)
{
DiscoveryDocument document2;
DiscoveryDocument document = (DiscoveryDocument) client.Documents[url];
if (document != null)
{
return document;
}
string contentType = null;
Stream stream = client.Download(ref url, ref contentType);
try
{
XmlTextReader xmlReader = new XmlTextReader(new StreamReader(stream, RequestResponseUtils.GetEncoding(contentType))) {
WhitespaceHandling = WhitespaceHandling.Significant,
XmlResolver = null,
DtdProcessing = DtdProcessing.Prohibit
};
if (!DiscoveryDocument.CanRead(xmlReader))
{
ArgumentException innerException = new ArgumentException(System.Web.Services.Res.GetString("WebInvalidFormat"));
throw new InvalidOperationException(System.Web.Services.Res.GetString("WebMissingDocument", new object[] { url }), innerException);
}
document2 = DiscoveryDocument.Read(xmlReader);
}
finally
{
stream.Close();
}
return document2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:DiscoveryDocumentReference.cs
示例8: DiscoResolve
protected DiscoveryClientProtocol DiscoResolve (string url)
{
// Checks the availablity of any services
var protocol = new DiscoveryClientProtocol ();
var creds = new AskCredentials ();
protocol.Credentials = creds;
bool unauthorized;
do {
unauthorized = false;
creds.Reset ();
try {
protocol.DiscoverAny (url);
} catch (WebException wex) {
var wr = wex.Response as HttpWebResponse;
if (!creds.Canceled && wr != null && wr.StatusCode == HttpStatusCode.Unauthorized) {
unauthorized = true;
continue;
}
throw;
}
} while (unauthorized);
if (protocol != null) {
creds.Store ();
if (protocol.References.Count == 0)
return null;
}
return protocol;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:31,代码来源:WebServiceEngine.cs
示例9: WebServiceDiscoveryResultWCF
public WebServiceDiscoveryResultWCF (DiscoveryClientProtocol protocol, MetadataSet metadata, WebReferenceItem item, ReferenceGroup refGroup, ClientOptions defaultOptions): base (WebReferencesService.WcfEngine, item)
{
this.refGroup = refGroup;
this.protocol = protocol;
this.metadata = metadata;
this.defaultOptions = defaultOptions;
}
开发者ID:riverans,项目名称:monodevelop,代码行数:7,代码来源:WebServiceDiscoveryResultWCF.cs
示例10: Generate
static void Generate(string url, TextWriter writer)
{
var cr = new ContractReference();
cr.Url = url;
var protocol = new DiscoveryClientProtocol();
var wc = new WebClient();
using (var stream = wc.OpenRead(cr.Url))
protocol.Documents.Add(cr.Url, cr.ReadDocument(stream));
var mset = ToMetadataSet(protocol);
var importer = new WsdlImporter(mset);
var xsdImporter = new XsdDataContractImporter();
var options = new ImportOptions();
options.ReferencedCollectionTypes.Add(typeof(LinkedList<>));
xsdImporter.Options = options;
importer.State.Add(typeof(XsdDataContractImporter), xsdImporter);
Collection<ContractDescription> contracts = importer.ImportAllContracts();
CodeCompileUnit ccu = new CodeCompileUnit();
CodeNamespace cns = new CodeNamespace("TestNamespace");
ccu.Namespaces.Add(cns);
var generator = new ServiceContractGenerator(ccu);
foreach (var cd in contracts)
generator.GenerateServiceContractType(cd);
var provider = new CSharpCodeProvider();
provider.GenerateCodeFromCompileUnit(ccu, writer, null);
}
开发者ID:baulig,项目名称:Provcon-Faust,代码行数:34,代码来源:MainClass.cs
示例11: WebReference
public WebReference(IProject project, string url, string name, string proxyNamespace, DiscoveryClientProtocol protocol)
{
this.project = project;
this.url = url;
this.protocol = protocol;
this.proxyNamespace = proxyNamespace;
this.name = name;
GetRelativePath();
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:9,代码来源:WebReference.cs
示例12: DiscoverWebServiceMetadata
void DiscoverWebServiceMetadata(object sender, DoWorkEventArgs e)
{
Uri url = (Uri)e.Argument;
var client = new DiscoveryClientProtocol();
client.Credentials = GetCredentials();
DiscoveryDocument document = client.DiscoverAny(url.AbsoluteUri);
client.ResolveOneLevel();
e.Result = new ServiceReferenceDiscoveryEventArgs(client.References);
}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:10,代码来源:ServiceReferenceDiscoveryClient.cs
示例13: DiscoverDocuments
DiscoveryClientDocumentCollection DiscoverDocuments()
{
var protocol = new DiscoveryClientProtocol {
AllowAutoRedirect = true,
Credentials = credentials ?? CredentialCache.DefaultCredentials
};
protocol.DiscoverAny(uri);
protocol.ResolveAll();
return protocol.Documents;
}
开发者ID:phaufe,项目名称:SoapContextDriver,代码行数:12,代码来源:Discovery.cs
示例14: 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;
}
开发者ID:AdamLStevenson,项目名称:SharpDevelop,代码行数:13,代码来源:ServiceReferenceHelper.cs
示例15: SetupFixture
public void SetupFixture()
{
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = "C:\\Projects\\Web.csproj";
WebReferencesProjectItem item = new WebReferencesProjectItem(project);
item.Include = "Foo\\";
ProjectService.AddProjectItem(project, item);
protocol = new DiscoveryClientProtocol();
WebReferenceTestHelper.InitializeProjectBindings();
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl);
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:15,代码来源:RenamedWebReferencesFolderTest.cs
示例16: ReadServiceDescriptionImporter
/// <summary>Read the specified protocol into an ServiceDescriptionImporter.</summary>
/// <param name="protocol">A DiscoveryClientProtocol containing the service protocol detail.</param>
/// <returns>A ServiceDescriptionImporter for the specified protocol.</returns>
public static ServiceDescriptionImporter ReadServiceDescriptionImporter(DiscoveryClientProtocol protocol)
{
// Service Description Importer
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = "Soap";
// Add all the schemas and service descriptions to the importer
protocol.ResolveAll ();
foreach (object doc in protocol.Documents.Values)
{
if (doc is ServiceDescription)
importer.AddServiceDescription((ServiceDescription)doc, null, null);
else if (doc is XmlSchema)
importer.Schemas.Add((XmlSchema)doc);
}
return importer;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:19,代码来源:Library.cs
示例17: Resolve
/// <summary>
/// Resolves metadata from the specified URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <returns>A list of metadata sections.</returns>
public static IEnumerable<MetadataSection> Resolve(string url)
{
MetadataSet metadataSet = new MetadataSet();
DiscoveryClientProtocol discoveryClient = new DiscoveryClientProtocol
{
UseDefaultCredentials = true,
AllowAutoRedirect = true
};
discoveryClient.DiscoverAny(url);
discoveryClient.ResolveAll();
foreach (object document in discoveryClient.Documents.Values)
{
AddDocumentToSet(metadataSet, document);
}
return metadataSet.MetadataSections;
}
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:22,代码来源:DiscoveryMetadataResolver.cs
示例18: GetServiceDescription
/// <summary>
/// Gets the web service description from the supplied URL.
/// </summary>
/// <param name="url">
/// The URL where XML Web services discovery begins.
/// </param>
/// <param name="username">
/// The username.
/// </param>
/// <param name="password">
/// The password.
/// </param>
/// <returns>
/// The <see cref="WebServiceDescription"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
/// The <paramref name="url"/> parameter is null.
/// </exception>
/// <exception cref="InvalidOperationException">
/// The <paramref name="url"/> parameter is a valid URL, but does not point to a valid discovery document, service description, or XSD schema.
/// </exception>
public WebServiceDescription GetServiceDescription(string url, string username, string password)
{
if (url == null)
throw new ArgumentNullException("url");
url = url.Trim();
var protocol = new DiscoveryClientProtocol { AllowAutoRedirect = true, Credentials = CredentialCache.DefaultCredentials };
if (!string.IsNullOrEmpty(username))
protocol.Credentials = new NetworkCredential(username, password);
try
{
protocol.DiscoverAny(url);
}
catch (InvalidOperationException)
{
if (!url.EndsWith("?WSDL", StringComparison.InvariantCultureIgnoreCase))
protocol.DiscoverAny(url + "?WSDL");
else
throw;
}
protocol.ResolveAll();
var serviceDescription = new WebServiceDescription();
foreach (DictionaryEntry entry in protocol.References)
{
var contractReference = entry.Value as ContractReference;
if (contractReference != null)
serviceDescription.ServiceDescriptions.Add(contractReference.Contract);
var schemaReference = entry.Value as SchemaReference;
if (schemaReference != null)
serviceDescription.XmlSchemas.Add(schemaReference.Schema);
}
return serviceDescription;
}
开发者ID:mparsin,项目名称:Elements,代码行数:63,代码来源:WebServiceDescriptionRetriever.cs
示例19: ReadServiceDescriptionImporter
/// <summary>Read the specified protocol into an ServiceDescriptionImporter.</summary>
/// <param name="protocol">A DiscoveryClientProtocol containing the service protocol detail.</param>
/// <returns>A ServiceDescriptionImporter for the specified protocol.</returns>
public static ServiceDescriptionImporter ReadServiceDescriptionImporter(DiscoveryClientProtocol protocol)
{
// Service Description Importer
var importer = new ServiceDescriptionImporter();
importer.ProtocolName = "Soap";
// Add all the schemas and service descriptions to the importer
protocol.ResolveAll ();
foreach (object doc in protocol.Documents.Values)
{
var serviceDescription = doc as ServiceDescription;
if (serviceDescription != null)
importer.AddServiceDescription (serviceDescription, null, null);
else {
var xmlSchema = doc as XmlSchema;
if (xmlSchema != null)
importer.Schemas.Add (xmlSchema);
}
}
return importer;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:23,代码来源:Library.cs
示例20: ReadWriteTest
public void ReadWriteTest ()
{
string directory = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
Directory.CreateDirectory (directory);
try {
string url = "http://www.w3schools.com/WebServices/TempConvert.asmx";
var p1 = new DiscoveryClientProtocol ();
p1.DiscoverAny (url);
p1.ResolveAll ();
p1.WriteAll (directory, "Reference.map");
var p2 = new DiscoveryClientProtocol ();
var results = p2.ReadAll (Path.Combine (directory, "Reference.map"));
Assert.AreEqual (2, results.Count);
Assert.AreEqual ("TempConvert.disco", results [0].Filename);
Assert.AreEqual ("TempConvert.wsdl", results [1].Filename);
} finally {
Directory.Delete (directory, true);
}
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:22,代码来源:DiscoveryClientProtocolTest.cs
注:本文中的System.Web.Services.Discovery.DiscoveryClientProtocol类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论