Web services deployment question

Associate
Joined
18 Oct 2002
Posts
972
Location
Derby
I have written a web service for my computing class which basically does the following:

An admin department can input various events that are happening in a football match. These events are inputted through a webservice and inserted into a database.

There is a client-side aspx page that refreshes and informs the user of any goals etc..

Basically the coding has gone ok I just have a couple of questions you guys might be able to help me out with with respect to how it's constructed. I have constructed it in Visual Studio 2005 and running the application works fine. The program has to be handed in on a CD with instructions on how it works. What I was thinking was:

Hand the code in on a CD with instructions on how to access the system through my webspace. My webspace supports ASP.NET so I assume that this would also work with my web service. Simple, I though and uploaded the files onto my webspace. I attempt to access the index.aspx page and get the following error:

Code:
 Compiler Error Message: BC30002: Type 'football' is not defined.

Football is name of my class that I have created and in the past working with notepad I have encountered this and read that I may need a proxy class. I then discovered that one of the super duper features of VS2005 is that it creates one for you. Therefore I am a bit concerned that it wont work on demo/hand-in date and was wondering if you guys could point out any glaringly obvious problems with the setup:

File: football.asmx

This page links to a code behind page shown below:

Code:
<%@ WebService Language="VB" CodeBehind="~/App_Code/football.vb" Class="football" %>

File: football.vb (found in App_Code)

Code:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.OleDb


<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class football
    Inherits System.Web.Services.WebService
    'Database variables
    Dim objCmd As New OleDbCommand
    Dim objConn As New OleDbConnection(ConfigurationSettings.AppSettings("DSN"))
    Dim objRdr As OleDbDataReader

File: index.aspx (I have added a method example just so you can check how it accesses the webmethods)

Code:
<%@ Page Language="VB" Debug="true"%>
<%@ import Namespace="System.Data.OleDb"%>

Sub getDates()
        Dim objService As New football()
        dateDropDown.DataSource = objService.getDate()
        dateDropDown.DataValueField = "date"
        dateDropDown.DataTextField = "date"
        dateDropDown.DataBind()
    End Sub

Finally i have a file called index.aspx.vb which contains the following:

Code:
Partial Class _Default
    Inherits System.Web.UI.Page

End Class

Does this look like a typical setup to you? I can imagine I have made a schoolboy error somewhere.

Thanks for your time
 
therubble said:
Did u add a web reference to the consumer? It's the adding of this reference that creates the proxy class from the webservice.

If I do this and enter the local url then it discovers the web service but if I upload all the files to my webspace and enter the web URL i get the same "football" not defined error in the preview pane in VS2005. I did notice this url that maybe should be changed but I had no luck.

Code:
<WebService(Namespace:="http://tempuri.org/")>

Thanks for your help
 
Well I can't work on it today but I was just posting to say thanks a lot for all your input. Gman you have shown me a few obvious omissions. I shall try all of your suggestions and let you know how it goes.

Cheers guys
 
Unable to consume web services

I have been writing a webservice for one of my computing classes. What I have been doing is creating the web service in Visual Studio 2005 and adding aspx pages to invoke the web methods etc..

This has been working fine when I have been going along and debugging etc until the time when Ive got to demonstrate the software. I understand that my teacher wants it to work say, by simply copying the files to localhost and accessing it like that. This is were my problem lies.

I have created a very small web service to test this with at first before messing with my main project. The aim of this is to have a webmethod in a .asmx file and a aspx page that "consumes" the web service. Here is the contents of the asmx file:

Code:
<%@ WebService language="VB" class="CalcService" %>
Imports System.Web.Services

Public Class CalcService
<WebMethod ()> _
Public Function Calculate(x As Integer, y As Integer) As Integer
Return x + y
End Function
End Class

My aspx page contains the following code

Code:
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="CalcService" %>
<html>
<head>
<title>Testing</title>
</head>


<script runat="Server" language="VB">


Sub Calculate(s As Object, E As EventArgs)
Dim objService As New CalcService()

lblResult.Text = objService.Calculate(txtX.Text, txtY.Text)

End Sub

</script>

The whole thing falls over and tells me that on the aspx page:

Code:
BC30002: Type 'CalcService' is not defined

So I get reading and i find out that I am supposed to create a proxy class to enable the two to talk to each other. I firstly find out you can do this by adding a web reference in VS2005. I do this and get the same error. I also tried adding the web reference in my code as follows:

Code:
Dim aWebService As localhost.CalcService = New localhost.CalcService()

This does not work. I then try to make the proxy class and the DLL in cmd prompt. I point my paths to the WDSL.EXE in VS2005 and the compiler path to my .NET framework 2.0. I create the .vb file and the DLL, place them in the Bin directory and I get the same damn thing. I have tried compiling in .NET 1.1 and 2.0, I have also tried changing my compiler in IIS from 1.1 to 2.0.

Does anyone see anything obvious that I have done wrong. I dont get that if it works through VS then it should be a case of putting it in Inetpub/WWWRoot. Any help or suggestions really appreciated.
 
Back
Top Bottom