Application WSDK - Practice WebServices route and routing
Small gas god 2002-11-18
Article Type: In-Depth Difficult Level: 8/9 Version: 3.46
2. Define routing files and establish virtual links.
Here we need to do the following two steps, the first establishment of a virtual directory called ReferraLsite, this web application will be used as a router (ROUTER), there is no implementation file in this app, only one web.config file defines httphandlers to rush Virtual WebServices - ReferralURL.asmx requested by the user, and the other is the Cache file of the Referral, which defines the specific routing format.
The web.config file is as follows:
XML Version = "1.0" encoding = "UTF-8"?>
TYPE = "Microsoft.Web.Services.Routing.RoutingHandler, Microsoft.Web.Services, Version = 1.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35 "/> httphandlers> Output = "d: //outputtrace.config" /> diagnostics> referral> configure> Referral's cache file is as follows: (ReferRalcache.config) XML Version = "1.0"?> r: for> r: REF> r: referrars> Simply put, it is transforming from ReferralURL.asmx to the real web services file Math.asmx. 3. Generate client access Here we need to create a client, in fact, the client's code may not change, the same as the above test. What we need to do is let our client request a virtual network resource, which is the above we set up the referralRalull.asmx, and then requests the router to pass the REFERRAL to our first step to test WebServices WSDK / WSREFERRAL / MATH.ASMX. As shown below: The specific approach is to add an app.config file, so when we use the Proxy class, we change the link address it requested, let it visit ReferralURL.asmx app.config file Value = "http: // localhost: 8080 / myproject / wsdk / refersite / referralurl.asmx" /> appsettings> configure> The code of the Proxy class performs the following modification (or no modification): Public service1 () { String urlsetting = system.configuration.configurationSettings.Appsettings ["mathurl"]; IF ((UrlSetting! = NULL) { this.url = urlsetting; } Else { This.url = "http://localhost/myproject/wsdk/wsreferra/math.asmx"; } } After completing the above operation, save and compile F5, I dare to ensure that it is running on a machine, and its calculation 5 6 is very slow, but if there is no error, you can see the first test. The result, but if you have DUMP debugging information, or TRACE, then you can see what happened from the two screenshots from below. In fact, you can also distribute the REFERRALSITE to another machine to do this, the effect is the same, but I believe you will find more. Here we see a WS-ROUTING, we have to do two things, first, build a web application to set up a Router, second, we have to build a Referral Cache, which contains the URL of the resource to be redirected, It is a XML file to describe. From here we have also seen such WS-Routing and WS-Referral are similar to a route and transfer, future WSDK supports a route called "content-based routing", which means we can from a request SOAP Message Headers discovers routing information defined in Message Body. When the route in the message body is constantly changing, I think that is a very wonderful and interesting application. The version after Microsoft promises will contain this feature, I think I am very happy to show you this promise in the future, it is really attractive. Ok, I think it is time to tempted the WSDK Routing feature. As the WSDK version is constantly updated, Microsoft will support more new protocols about Web Services. I believe we encounter failures and changes in the process of learning WSDK or WS-XXXX, but the experience is still worthy of sharing. I still believe that any sharing in this process will be a very happy experience. Finally, I wish you a happy program! Related files Download: [WSDKROUTING_REFERRAL.ZIP 38K] especially: This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization. If you have any questions or suggestions, please email new2001@msn.com