Release and deployment (1)
Deploying an XML Web Service includes copying the. asmx file and the Assembly file used by any XML Web Service, rather than using a part of Microsoft. NET Framework as a virtual directory on the Web server. For information about how to deploy an XML Web Service, see "deploy XML Web Service ". The XML Web Service is applicable to users who use the discovery mechanism. You can browse a special discover file or the Web server root to locate the Discover file. From these files, they can determine which services are useful to them.
Deploy XML Web Services
Deploying an XML Web Service includes copying the. asmx file and the Assembly file used by any XML Web Service, instead of a part of Microsoft. NET Framework, to the Web server.
For example, assume that you name an XML Web Service StockServices. To deploy the XML Web Service, you need to create a virtual directory on your Web server and put the. asmx file of the XML Web Service into this directory. This virtual directory should also be an IIS Web application, although it is not required. A typical deployment will have the following directory structure:
Inetpub Wwwroot StockServices StockServices. asmx Bin |
The compilation used by your XML Web Service is not part of Microsoft. NET Framework.
XML Web Service Release entry
When you publish an XML Web Service, the following entries deploy a Web server.
Entries |
Description |
Web application directory |
As the root directory of your XML Web Service. All files are stored in this directory. This directory should be marked as used by an IIS Web application. |
<MyXMLWebService>. asmx File |
The basic URL of the client that calls the XML Web Service. This file can be any valid file name. |
<MyXMLWebService>. disco file |
(Optional) as the XML Web Service discovery mechanism .. The disco file is not automatically created for the XML Web Service. This file can be any valid file name. |
Web. config file |
(Optional) if you need to override the default configuration settings, You can include a web. config file. XML Web Service uses this configuration file to allow customization and scalability of the system. For example, if your XML Web Service needs to be verified in the system and other Web applications do not, you can provide a specific Web. config file for the XML web Service. |
Bin directory |
Contains binary files used for this XML Web Service. If your XML Web Service class and. asmx file are not in the same directory, the components that contain the class must be in the Bin directory. |
An XML Web Service is found
XML Web Service discovery is the process of locating and querying XML Web Service descriptions. It is a preparatory step for accessing an XML Web Service. Through the discovery process, the XML Web Service client can know the existence of an XML Web Service during design, what it can do, and how to properly interact with it.
When the XML Web Service releases a. disco file, the program finds that. disco is an XML document that contains connections to other discovery documents, XSD modes, and service descriptions. In other words, the XML Web Service created using ASP. NET automatically provides the ability to generate a document for discovery. When using? When a disco url is accessed, a discovery document is automatically generated for the XML Web Service. For example, if the URL to an XML Web Service is www.contoso.com/getquote.asmx, then automatically use www.contoso.com/getquote.asmx? DISCO generates a discovery document.
To enable the discovery of an XML Web Service:
Use your favorite editor to create an XML document and tag <? Xml version = "1.0"?> Add to the first line.
Add a <discovery> element to the XML file, for example:
<Disco: discovery xmlns: disco = "http://schemas.xmlsoap.org/disco/"> </Disco: discovery> |
Add a reference to the service description, XSD mode, and other discovery documents in the <discovery> element.
You can add a reference to anything you want to publish. Service description Reference is specified in a discovery document by adding a <contractRef> element using the http://schemas.xmlsoap.org/disco/scl/ XML Domain Name Space. Similarly, references to other discovery documents and XSD modes are specified by adding <discoveryRef> and <schemaRef> XML elements. For XSD mode reference, you must specify the XML Domain Name Space http://schemas.xmlsoap.org/disco/schema .. The following code example describes the discovery document, service description, and reference of an XSD mode.
<? Xml version = "1.0"?> <Discovery xmlns = "http://schemas.xmlsoap.org/disco/"> <DiscoveryRef ref = "/Folder/Default. disco"/> <ContractRef ref = "http: // MyWebServer/UserName. asmx? WSDL" DocRef = "Service.htm" Xmlns = "http://schemas.xmlsoap.org/disco/scl/"/> <SchemaRef ref = "Schema. xsd" Xmlns = "http://schemas.xmlsoap.org/disco/schema/"/> </Discovery> |
References can be related to directories where documents are found, as shown in the discoveryRef element or a URI, as shown in the contractRef element.
Copy the discovery document to a virtual directory on the Web server and deploy the discovery document on this Web server.
Alternatively, if you want to allow the expected consumers to navigate to a URL by specifying an IIS application without specifying a document, then you can add a default page to the IIS application. This is useful to intended consumers who do not need to know the name of any document found. You can provide the URL for the following discovery process:
Http: // MyWebServer/MyWebApplication
If the default page used for Web applications is an HTML page:
Add a link to the Discovery document in the
<HEAD> <Link type = text/xml rel = alternate href = MyWebService. disco/> </HEAD> |
If the default page used for Web applications is an XML document:
Add a link to the Discovery document in the
<? Xml-stylesheet type = "text/xml" alternate = "yes" href = "MyWebService. disco"?> |
If you use Visual Studio.. NET, you can enable dynamic discovery to allow XML Web Service client applications to discover available XML Web Services on a Web server that does not create any documents. When dynamic discovery is enabled, the client application specifies a URL in the Add Web Reference dialog box that references a file with. vsdisco, for example, www.contoso.com/default.vsdisco, to represent a specific discovery document.
To enable dynamic discovery for a Web server, modify machine. config to add the following <add> element.
<Configuration> <System. web> <HttpHandlers> <Add verb = "*" path = "*. vsdisco" Type = "System. Web. Services. Discovery. DiscoveryRequestHandler, System. Web. Services, Version = 1.0.3300.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" Validate = "false"/> </HttpHandlers> </System. web> </Configuration> |
Note: When dynamic discovery is enabled, all XML Web Services and Web server discovery documents are discoverable. Therefore, be careful when enabling dynamic discovery, because if the Web server is not in a secure network with fire walls, it may inadvertently expose sensitive data.