WebReference.ProxyCode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the code namespace associated with the Web reference.
public:
property System::CodeDom::CodeNamespace ^ ProxyCode { System::CodeDom::CodeNamespace ^ get(); };
public System.CodeDom.CodeNamespace ProxyCode { get; }
member this.ProxyCode : System.CodeDom.CodeNamespace
Public ReadOnly Property ProxyCode As CodeNamespace
Property Value
The CodeNamespace in which proxy code will be generated when the GenerateWebReferences(WebReferenceCollection, CodeDomProvider, CodeCompileUnit, WebReferenceOptions) method is called.
Examples
The following code example shows how to use the ProxyCode property.
// Read in a WSDL service description.
string url = "http://www.contoso.com/Example/WebService.asmx?WSDL";
XmlTextReader reader = new XmlTextReader(url);
ServiceDescription wsdl = ServiceDescription.Read(reader);
// Create a WSDL collection.
DiscoveryClientDocumentCollection wsdlCollection =
new DiscoveryClientDocumentCollection();
wsdlCollection.Add(url, wsdl);
// Create a namespace.
CodeNamespace proxyNamespace = new CodeNamespace("ExampleNamespace");
// Create a web reference using the WSDL collection.
string baseUrl = "http://www.contoso.com";
string urlKey = "ExampleUrlKey";
string protocolName = "Soap12";
WebReference reference = new WebReference(
wsdlCollection, proxyNamespace, protocolName, urlKey, baseUrl);
// Print some information about the web reference.
Console.WriteLine("The WebReference object contains {0} document(s).",
reference.Documents.Count);
Console.WriteLine("The protocol name is {0}.", reference.ProtocolName);
Console.WriteLine("The base URL is {0}.", reference.AppSettingBaseUrl);
Console.WriteLine("The URL key is {0}.", reference.AppSettingUrlKey);
// Print some information about the proxy code namespace.
Console.WriteLine("The proxy code namespace is {0}.",
reference.ProxyCode.Name);
// Print some information about the validation warnings.
Console.WriteLine("There are {0} validation warnings.",
reference.ValidationWarnings.Count);
// Print some information about the warnings.
if (reference.Warnings == 0)
{
Console.WriteLine("There are no warnings.");
}
else
{
Console.WriteLine("Warnings: " + reference.Warnings);
}
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET