CATEGORII DOCUMENTE |
Asp | Autocad | C | Dot net | Excel | Fox pro | Html | Java |
Linux | Mathcad | Photoshop | Php | Sql | Visual studio | Windows | Xml |
Overview of Part 5
XML Web services will revolutionize software development both inside and outside the firewall. Visual Studio .NET makes it easy to create and consume Web services, using the familiar metaphor of the application component.
Developers using Visual Studio .NET can simply right-click in the Solution Explorer window and select "Add Web Reference." From there, they need only supply the URL to the Web service on their intranet or the Web, or browse the UDDI (Universal Description, Discovery, and Integration) registry to locate desirable Web references. The Web service is then available for use from within Visual Studio, with statement completion and other IntelliSense features automatically supported.
When Downhill Bikes wants to implement a new service for customers, the company needs tools to help their developers turn ideas into implementation. By using Visual Studio .NET, developers can add new functionality in a matter of hours, not days.
In this part of the tour, you'll add a Web reference to a third-party Microsoft partner to the Web application. The new functionality will enable Downhill Bikes to offer gift certificates to its customers. You will then add a Web reference to a service provided by one of DownhillBikes' partners so customers can find authorized bike stores to redeem their certificates.
Part 5: Build a Web Page - Orders
Step 1 of 8: Add an image to the page
In this step you will add user interface elements to the thank you page to offer a gift certificate to a Downhill Bikes customer as they complete a transaction.
Important
The following step requires an Internet Connection.
a. Double-click ThankYou.aspx in the Solution Explorer. CTRL+ALT+L
b. Display the Web Forms toolbar by pressing CTRL+ALT+X and clicking the Web Forms button.
c. Drag an Image control from the Web Forms toolbar bar into the lower-right cell. The image will be populated dynamically from the Web service.
Part 5: Build a Web Page - Orders
Step 2 of 8: Add a Web reference
In this step you will use UDDI and a Web service that returns valid gift certificates to customers.
a. Click the DownhillBikes project in the Solution Explorer.
b. From the Project menu, click Add Web Reference.
c. Click the Test Microsoft UDDI Directory hyperlink.
d. Type fontvelocity in the Business name box and click Search.
e. Click the blue FontVelocity link, then click the FontVelocity WSDL-interface link. The resulting XML is the Web Service Description Language contract, describing a single method, Render.
f. Click the Add Reference button.
Part 5: Build a Web Page - Orders
Step 3 of 8: Generate the gift certificate
In this step you will call a Web service that instantiates a gift certificate, which is actually a series of database records stored on a third party partner's server. The back-end service is using a C++ component to generate and return a unique serial number, though the Web service interface abstracts the implementation, enabling business partners to integrate regardless of platform or tool.
a. In the Solution Explorer, right-click ThankYou.aspx, then click View Code.
b. Place the insertion point on the empty line in the Page_Load method.
c. Double-click 5.3 ThankYou: Page_Load snippet.
Part 5: Build a Web Page - Orders
Step 4 of 8: Place an order
Let's run the application and see the results of our work.
a. From the View menu, click Solution Explorer. (Or, press CTRL+ALT+L.)
b. In the Solution Explorer, under the DownhillBikes project, right-click Default.aspx, then click Set As Start Page.
c. From the Debug menu, click Start Without Debugging. (Or, press CTRL+F5.)
d. Click Add to Cart, and then click Checkout.
e. Click Sign In, then click Place Order.
f. Note the dynamically-generated text in the gift certificate, created through a Web service.
Part 5: Build a Web Page - Orders
Step 5 of 8: Add the bike store finder service
In this step we will integrate another Web service to find locations of authorized and convenient bike stores where we can redeem our gift certificates. This Web service interaction is more complex than the previous, in that we'll be passing the user's zip code to the service, and using that to locate and return a list of nearby stores.
a. Click the DownhillBikes project in the Solution Explorer.
b. From the Project menu, click Add Web Reference.
c. Type https://www.bikestorefinder.com/locator.asmx in the Address box.
d. Click Add Reference.
Part 5: Build a Web Page - Orders
Step 6 of 8: Add elements to the page
In this step, we will enhance our Web Form by adding additional user interface elements to the page. Note how similar this experience is to the Windows Forms design experience.
a. Double-click the ThankYou.aspx page in the Solution Explorer.
b. Position the insertion point after the Image and press ENTER. Type:
Enter your ZIP code for stores nearest you
c. Drag a TextBox onto the form, below the text you previously entered.
d. Drag a Button to the right of the TextBox and press F4 to show its properties.
e. Change the Text property to Search.
f. Position the insertion point after the Search button and press ENTER. Drag a Label below the TextBox. Your screen should look like the following:
Part 5: Build a Web Page - Orders
Step 7 of 8: Add code to handle the button click
The code behind the button will set a reference to the Web service and send the user's zip code to it, returning an XML-based list of bike stores that we will then append to a label control on the page.
a. Double-click the Search button to add a server-side event handler.
b. Double-click 5.8 ThankYou: Store locator.
c. On the Build menu, click Build Solution. CTRL+SHIFT+B
Part 5: Build a Web Page - Orders
Step 8 of 8: Place an order
Start the application and test it.
a. From the Debug menu, click Start Without Debugging. CTRL+F5
b. Click add to cart then checkout.
c. Click sign in then place order.
d. Type your ZIP code in the box and click the button.
e. Note the location of the stores near to that ZIP code.
f. Close the browser.
g. In Visual Studio .NET, from the Window menu, click Close All Documents. If asked to save changes, click Yes.
In this part of the Tour, you used the built-in support for UDDI that is found in Visual Studio .NET to discover and incorporate a Web service from third-party partners to your Web application. The new functionality enables Downhill Bikes to both offer gift certificates to its customers find authorized bike stores where they can redeem their certificates.
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 984
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved