Damn References

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
Hi

After running into a problem with a reference to a web service. The steps i took in creating the web service were as normal, file->add new project->web service (renamed to Classification.aspx). Inorder to use the methods i created in the web service i put the statement <webmethod()> before the start of the method.

I then went to my front end project and added a web reference and left the name that the system game me (localhost in this case). In my code i then went Dim x as new localhost.Classification. Now in my code when i typed x.methodname, the methods in my web service was ok, however when i actully run the project and try to call the web service methods for the frontend i get the following error:
Object reference not set to an instance of and object.

Any suggestions. This is the same proceedure i have used in previous projects and it worked.

Mike
 
Is the error being raised by the client or the server? If possible could you post the code from the client and maybe the server methods that are failing - or do all the server methods fail?
 
Last edited:
Ok,
Firstly in relation to the breakpoint and stepping through the code, had already done that prior to running this posting.

My code is as following:
Dim x as localhost.classification

The front-end code.
Global Variables: Dim temp as string

private sub btnDelete_click(byVal sender as object, byVal e as System.EventArgs) Handles btnDelete.click
if (Session("access") = "") then
if (txtRef.text = "") then
lblWarning1.visible = true 'Missing data
else
temp = txtRef.text
x.delete(temp)
end if
else
lblWarning2.visible = true 'You do not have permission to access resouce
end if
end sub

The webservice code.
Nameof webservice = classification
Global variables: dim answer as string

<WebMethod()>public sub delete(byVal value as string)
if temp <10
answer = "over"
else if temp >10
answer = "less"
end if
end sub

From stepping through the code, it would seem that the problem lies with the front end. Oh yea all server methods are failing.

Mike55
 
Back
Top