|
|
YOUR FEEDBACK
|
TOP MICROSOFT .NET LINKS Feature
Publishing .NET Web Services Using SQL Anywhere 10.0.1
Take a database and create a mini version of an "Amazon-like" item lookup
By: Deanne M. Chance
Apr. 4, 2008 11:00 AM
Digg This!
Page 2 of 3
« previous page
next page »
Database Schema
Writing the Stored Procedure
Defining a Web Service The first step in defining a new service is to give it a name. If you look at Figure 2, you'll see we've named our new Web Service OurAmazonItemLookup. But you may be wondering what that extra text and backslash is for? The answer is that it's used by the DISH services that construct our WSDL. The rule is simple: when you create a DISH service, the name given in the GROUP clause determines which SOAP services the DISH service exposes. We haven't done that yet, but we will after we finish defining our service. So just type what I've indicated in Figure 2. You'll understand when we go about creating our WSDL definition. With the name established, click next and the wizard will take you to the screen shown in Figure 3. Here we need to specify the type of service requests we'll accept and how the results will be returned. In this case, we're going to use SOAP. Step through the wizard by clicking Next and you'll be shown the screen shown in Figure 4. It's asking what type of service to use. In this case, we're going to use .NET. Note this implies a SOAP request and result set format - both needed for Visual Studio. Click Next and the wizard will show you the screen shown in Figure 5. It's asking what kind of typing to use for input parameters. Choose the default behavior of off. Click Next and you'll see the screen shown in Figure 6 prompting you for the kind of security needed for the Web Service. In our case, to keep things simple, we won't use any. If you click through Next, you'll see the screen shown in Figure 7. Here, they're asking whether or not we want to use HTTPS. Again, we're keeping things simple, so indicate None. Now comes the interesting part. Click Next and you'll see the screen shown in Figure 8. Here we get to specify the SELECT statement that will be used when returning our result set. Remember that stored procedure we wrote earlier? (See Listing 2). Well, here we're going to use it. Type in CALL ItemLookup( :url). This tells SQL Anywhere to call the ItemLookup procedure whenever it gets a request. It also indicates in the request that there will be a parameter that should be passed to that procedure. Finally, click Next and you'll be brought to the screen shown in Figure 9. Here, you'll have the opportunity to add a comment for your service, type in something meaningful and click Finish.
Defining a DISH Service Given that, click on the Create a Web Service hyperlink in the left-hand pane of the Web Services screen. The wizard will begin and you'll be presented with the screen shown in Figure 10. Here you need to type in a name for your service. Since this is going to describe the WSDL, let's give it a meaningful name such as ItemLookupWSDL. Click Next and you'll be presented with the screen shown in Figure 11. Here you'll select the type of service you want to construct. Choose DISH. Click Next and the wizard will display the screen shown in Figure 12. Here you'll enter two pieces of information - the format the Web Service will expose and the GROUP name we specified when we created the OurAmazonItemLookup service. The format is .NET, and if you recall, the GROUP name is OurAmazon. Click Next and you'll see the screen shown in Figure 13. Here you'll specify whether or not to use authorization. Again, we're keeping things simple so indicate No. Click Next and you'll see the screen shown in Figure 14. Here we're asked if we want to use HTTPS, indicate No. Finally click Next and you'll see the screen shown in Figure 15. Here you can enter a comment that describes the service. Enter something meaningful and click on Finish. (Figure 16)
Starting the Database Server This is the command I used to start the database server and a little explanation may be in order: C:\MyAmazon>dbsrv10 Amazon.db -xs http(port=8080) First, we specify the command to start a database server, dbsrv10. Second, we must tell SQL Anywhere where our database lives. Since I started the server in the same directory where the database is, I can simply type the name of the database. In this case, it's Amazon.db. Lastly, we specify the -xs switch. You can consult the documentation, but, simply put, this switch tells SQL Anywhere to enable protocols. The two available protocols for Web Services are HTTP or HTTPS. In this case, I chose HTTP and told it to listen for requests on Port 8080. Page 2 of 3 « previous page next page » MICROSOFT .NET LATEST STORIES
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK BREAKING NEWS FROM THE WIRES
|
||||||||||||||||||||||||||||||||||