I have been discussing simple “game” design for the Xbox 360, now I have to talk about what I have been working on for the past couple of days. It is really, really sad, so if you want to think that I am a complete idiot, you have my permission. The story goes like this:
Web Service, I have been working on how to get a web service to work from a web site using the instructions that I found on the web. Wow, all of the articles assumed that the reader would easily be able to implement a web service using an ISP as easily as they would by using the Localhost provided by Visual Studio or IIS on a Windows machine. I have to commend the patience of the technicians at Godaddy, they are the reason I keep going back and using GoDaddy, and not just because they have all of those good looking models on the site. And yes, I am an idiot.
If you have attempted to set up a simple Web Service, and had problems, then the following instructions should be of assistance, this is a long article and you may need to scroll down to see all of it.
The goal is to consume the default “Hello World” from a web server located on the internet and not locally. Most of the articles assume that the experience is the same as if you are using localhost, it isn’t. We will not have to write any code. This is a procedural blog, that is: You will follow a procedure, not create code.
Why didn’t I use a video? I might post a video next week, but if you print this out and follow the step by step, you should see how to utilize a web service and the ease of use.
First create a basic Web Service using:
· Visual Studio 2008 Web Developer Express (free)
· Visual Studio 2008 Professional
· Visual Studio 2008 Team System
· Visual Studio 2010 versions
Notice that I am using FTP in the New Web Site dialog box, this means the site will be created directed on my GoDaddy site, you could do the same thing. You will need to have an account as well as know your password to do this.
You would use the location drop down box to select FTP, HTTP or File (your computer or a network computer).
· FTP is used to move the web service to IIS7 servers
· HTTP can be used on IIS 6 servers because IIS6 has Front Page Server Extensions
· File system is on your computer or networked hard drives
Select the language from the Language Drop Down Box, I will use Visual C#, but for no particular reason, they both work just as well, except that Visual C# has full refactoring capabilities:
· Visual C#
· Visual Basic
My Integrated Development Environment (IDE) looks like the following, yours will likely look a little different, MAKE sure to set the file: Service.ASMX as the Start Page.
You will get an error later on if you do not do this! Keep in mind that you do not have to enter ANY CODE!
In all versions of Visual Studio, assuming that you are in the web site part has the icon circled below. Use this to easily copy your web site from Visual Studio to your web site. In all versions, except for Express, you can create a deployment project, but we won’t go over that in this blog.
Now you will see the copy web dialog box
Once you have clicked the Connect link, you will see the Open Web Site, select the FTP site.
Now it gets a little tricky, you will need to understand how your web site is set-up. In the next few images we will take a look at the way the GoDaddy ISP works. If you are using Dreamsparhosting as a student your experience will vary.
Once you have an account at Godaddy or Dreamsparkhosting (free for College or University Students), you will need to manage your account.
At GoDaddy for instance you would select “hosting” from the opening screen after you login. On other sites you will see a screen like the following, although with differences. I will click on the button:
Since I am kind of cheap, I just pay for one domain at the highest level, which I use on and off for testing or demostrations of how to use Microsoft Expressions Suite, so your experience at your ISP may be different
http://createdesignlearn.com, then I have a number of folders under it that point to my other urls like y75.us and z25.us as you see below. We will use the z25.us site for our “Hello World” demonstration.
When you load the Web Services files from Visual Web Dev or other Visual Studio products, your File manager will look like the following, of course there may be differences.
Now let’s go back to Visual Studio. I will use the File Transfer Protocol (FTP) to transfer my files from Visual Studio to the Web Site. Notice however, that there is a slight difference:
1. I am not transferring the files directly to the z25.us site, rather I am using the higher URL, createdesignlearn.com site
2. The z25.us directory could be named anything, you set this up in the your website, I chose to set it up to match the domain name. To keep management easy, consider using the same name for the file as the URL
3. Fill in your username and password, most ISPs allow you to log in with your account/customer number but require that you set up a username, so it is easy to forget it, usually there ways to find it out. Then you need your password, you shouldn’t use the same password and change it frequently as the password could be passed in the clear.
Wow, lot’s of work right? Once you do it a few time it will be easy to do! Let’s continue…
Here is the Copy Web dialog box connected, but nothing in your Web Site, use your shift key+ctrl to select all of the files and then click on the circled button.
Earlier I showed you what the File Manager should look like, now let’s open the http://z25.us/service.asmx , you will need to type out the full filename.
Keep in mind that this blog will age and I will be making changes to z25.us, it is being used as a realistic demonstration. I can only guarantee that the site will remain unchanged through Monday, Jan. 4, 2010.
When you first see this display, it almost looks like an error, it isn’t, but there is a problem with the site that I will cover in the next blog being posted on 1/1/2010 (since this one is so long)
Clicking on the HelloWorld link, will show the following, unlike the localhost type of page that results, you do not have the “Invoke” button or test form. The necessary soap is shown, except that there is an error that we will talk about in the next blog.
You now have seen how to load a webservice to a hosted web site. The process and user experience is slightly different than when you use a web service with the localhost. Next we will take a look at consuming the HelloWorld service and the error that impacts our consumption of the default application.