本文整理汇总了C#中System.Web.Services.Description.ServiceDescription类的典型用法代码示例。如果您正苦于以下问题:C# ServiceDescription类的具体用法?C# ServiceDescription怎么用?C# ServiceDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceDescription类属于System.Web.Services.Description命名空间,在下文中一共展示了ServiceDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Binding
public Binding ()
{
extensions = new ServiceDescriptionFormatExtensionCollection (this);
operations = new OperationBindingCollection (this);
serviceDescription = null;
type = XmlQualifiedName.Empty;
}
示例2: Import
public Import ()
{
extensions = new ServiceDescriptionFormatExtensionCollection (this);
location = String.Empty;
ns = String.Empty;
serviceDescription = null;
}
示例3: 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);
}
示例4: 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);
}
示例5: GetSingleWsdl
private static WsdlNS.ServiceDescription GetSingleWsdl(List<WsdlNS.ServiceDescription> wsdls)
{
// Use WSDL that has the contracts as the base for single WSDL
WsdlNS.ServiceDescription singleWsdl = wsdls.First(wsdl => wsdl.PortTypes.Count > 0);
if (singleWsdl == null)
{
singleWsdl = new WsdlNS.ServiceDescription();
}
else
{
singleWsdl.Types.Schemas.Clear();
singleWsdl.Imports.Clear();
}
Dictionary<XmlQualifiedName, XmlQualifiedName> bindingReferenceChanges = new Dictionary<XmlQualifiedName, XmlQualifiedName>();
foreach (WsdlNS.ServiceDescription wsdl in wsdls)
{
if (wsdl != singleWsdl)
{
MergeWsdl(singleWsdl, wsdl, bindingReferenceChanges);
}
}
EnsureSingleNamespace(singleWsdl, bindingReferenceChanges);
return singleWsdl;
}
示例6: 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;
}
示例7: GetSoapBinding
private static Binding GetSoapBinding(ServiceDescription description, string bindingName)
{
var soapBindings = description.GetSoapBindings()
.Where(binding => binding.Name == bindingName)
.OrderByDescending(binding => binding.Type.Name);
return soapBindings.FirstOrDefault();
}
示例8: 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);
}
示例9: Add
public int Add (ServiceDescription serviceDescription)
{
if (importer != null)
importer.OnServiceDescriptionAdded (serviceDescription, null, null);
Insert (Count, serviceDescription);
return (Count - 1);
}
示例10: 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);
}
示例11: SoapEditorProxy
public SoapEditorProxy(Connections.ConnectionData connData, ServiceDescription description, XmlSchemaSet schemas)
{
_connData = connData;
_descrip = description;
_schemas = schemas;
_helper = new XmlCompletionDataProvider(schemas, "http://schemas.xmlsoap.org/soap/envelope/"
, "soapenv", () => "xmlns:soap=\"" + description.TargetNamespace + "\""
, e => (e.Name == "Envelope" && e.QualifiedName.Namespace == "http://schemas.xmlsoap.org/soap/envelope/")
|| TypeMatchesAction(e.QualifiedName, this.Action));
_baseUrl = new Uri(_connData.Url).GetLeftPart(UriPartial.Path);
switch (_connData.Authentication)
{
case Connections.Authentication.Windows:
_cred = CredentialCache.DefaultNetworkCredentials;
break;
case Connections.Authentication.Explicit:
_cred = new NetworkCredential(_connData.UserName, _connData.Password);
break;
}
_actionUrls = _descrip.Services.OfType<Service>()
.SelectMany(s => s.Ports.OfType<Port>().Where(SoapPort))
.SelectMany(p => _descrip.Bindings[p.Binding.Name].Operations.OfType<OperationBinding>())
.Select(o => new { Name = o.Name, Address = o.Extensions.OfType<SoapOperationBinding>().First().SoapAction })
.Distinct()
.ToDictionary(a => a.Name, a => a.Address);
}
示例12: 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);
}
示例13: GenerateClientProxy
/// <summary>
/// Generate a DPWSClientProxy source file from a wsdl service description.
/// </summary>
/// <param name="serviceDesc">A valid wsdl service description.</param>
public void GenerateClientProxy(ServiceDescription serviceDesc, TargetPlatform platform)
{
// Well here's a nasty used in an attempt to make up a name
string clientProxyClassName = serviceDesc.Name;
string clientProxyNs = CodeGenUtils.GenerateDotNetNamespace(serviceDesc.TargetNamespace);
string filename = serviceDesc.Name + "ClientProxy.cs";
ClientProxies clientProxies = new ClientProxies(clientProxyNs);
foreach (PortType portType in serviceDesc.PortTypes)
{
ClientProxy clientProxy = new ClientProxy(portType.Name, platform);
foreach (Operation operation in portType.Operations)
{
// Create action names
// Apply special naming rules if this is a notification (event) operation
string inAction = serviceDesc.TargetNamespace + "/" + operation.Name + "Request";
string outAction = serviceDesc.TargetNamespace + "/" + operation.Name + ((operation.Messages.Flow == OperationFlow.Notification) ? "" : "Response");
clientProxy.AddOperation(operation, inAction, outAction);
}
foreach (Message message in serviceDesc.Messages)
{
clientProxy.Messages.Add(message);
}
if (clientProxy.ServiceOperations.Count > 0)
clientProxies.Add(clientProxy);
}
ClientProxyGenerator clientProxyGen = new ClientProxyGenerator();
clientProxyGen.GenerateCode(filename, clientProxies);
}
示例14: GenerateHostedService
/// <summary>
/// Generate a DPWSHostedService source file from a Wsdl service description.
/// </summary>
/// <param name="serviceDesc">A valid wsdl service description.</param>
public void GenerateHostedService(ServiceDescription serviceDesc, TargetPlatform platform)
{
// Well here's a nasty used in an attempt to make up a name
string hostedServiceClassName = serviceDesc.Name;
string hostedServiceNs = CodeGenUtils.GenerateDotNetNamespace(serviceDesc.TargetNamespace);
string filename = serviceDesc.Name + "HostedService.cs";
HostedServices hostedServices = new HostedServices(hostedServiceNs);
foreach (PortType portType in serviceDesc.PortTypes)
{
HostedService hostedService = new HostedService(portType.Name, hostedServiceNs, platform);
foreach (Operation operation in portType.Operations)
{
// Create action names
// Apply special naming rules if this is a notification (event) operation
string inAction = serviceDesc.TargetNamespace + "/" + operation.Name + "Request";
string outAction = serviceDesc.TargetNamespace + "/" + operation.Name + ((operation.Messages.Flow == OperationFlow.Notification) ? "" : "Response");
hostedService.AddOperation(operation, inAction, outAction);
}
foreach (Message message in serviceDesc.Messages)
{
hostedService.Messages.Add(message);
}
}
HostedServiceGenerator hostedServiceGen = new HostedServiceGenerator();
hostedServiceGen.GenerateCode(filename, hostedServices);
}
示例15: ParseWsdl
/// <summary>
/// Open specified Wsdl file and parse content into ServiceDescription hierarchy. Method attempts
/// to Import external schema references.
/// </summary>
/// <param name="fileName">A valid Wsdl file name.</param>
/// <exception cref="FileNotFoundException">If specified file is cannot be opened.</exception>
public void ParseWsdl(string fileName, List<string> schemaRefs)
{
isParsing = true;
Logger.WriteLine("Reading WSDL file: " + fileName, LogLevel.Normal);
// Use a validating xml reader to validate the schema. If it checks out
// we only have to worry about building code fragements and data contracts.
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.ValidationFlags = XmlSchemaValidationFlags.AllowXmlAttributes |
XmlSchemaValidationFlags.ProcessIdentityConstraints |
XmlSchemaValidationFlags.ProcessInlineSchema |
XmlSchemaValidationFlags.ProcessSchemaLocation |
XmlSchemaValidationFlags.ReportValidationWarnings;
// Create the reader
settings.ValidationEventHandler += new ValidationEventHandler(Settings_ValidationEventHandler);
XmlReader reader = XmlReader.Create(fileName, settings);
if (!ServiceDescription.CanRead(reader)) throw new InvalidOperationException("The WSDL file is not compatible.");
// Parse the Wsdl
m_svcDesc = ServiceDescription.Read(reader, true);
reader.Close();
List<string> importFiles = new List<string>();
importFiles.Add(fileName);
ParseWsdl(m_svcDesc, schemaRefs, settings, importFiles);
}