Đang chuẩn bị liên kết để tải về tài liệu:
The book of visual basic 2005 net insight for classic vb developers 2006 - phần 10
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Thông thường, bạn sẽ chọn hệ thống tập tin (như trong hình 12-1), và sau đó sử dụng một thư mục một nơi nào đó trên máy tính của bạn. Đó là đủ cho việc tạo và thử nghiệm một ứng dụng | Sometimes a web service might move to a new URL after you create a client for it. In Visual Studio you can easily change the URL you use by selecting the web reference under the Web References node in the Solution Explorer and changing the Web Reference URL in the Properties window. But what do you if you ve already deployed your client and you don t want to recompile it Fortunately .NET has the answer. Just look for the configuration file which has the same name as your client such as MyClient.exe.config . You can edit the configuration file with any text editor. Inside you ll find the current setting looking something like this setting name PostalClient_localhost_PostalWebService serializeAs String value http localhost NoStarchWeb PostalWebService.asmx value setting You can change this setting to update the web reference URL without recompiling a lick of code. When you launch your client it always uses the URL in the configuration file. Of course if the web service changes more drastically for example the name of the web methods changes you ll need to modify your client application and recompile. Inspecting the Proxy Class Visual Basic 2005 hides the proxy class that it creates from you because you don t really need to see it or modify it directly. However it s always a good idea to peek under the hood of an application and get a better understanding of what s really happening along the way. To see the proxy class select Project Show All Files from the menu. Then expand the Web References node which contains all your web references. Expand the node with the web reference you just added which is named localhost by default . Finally look for a file named Reference.map. Once you expand this node you ll see the Visual Basic proxy file which is named Reference.vb as shown in Figure 13-12. This Reference.vb file includes a proxy class with all the code needed to call the methods of your web service. It also includes the ClientPackageInfo class that you need to use to .