473,659 Members | 2,920 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple WebService

Newbie Q...

When I hit the "ws.asmx" in a browser, I get
"Parser Error Message: Could not create type 'Service1'" ??

If I use the file "ws_ok.asmx " (without codebehind, but same code), I
get no errors.

Any 1 ??

TIA
-- ws.asmx --
<%@ WebService Language="vb" Codebehind="ws. vb" Class="Service1 " %>
--
-- ws.vb --
Imports System
Imports System.Web
Imports System.Web.Serv ices

<WebService(Nam espace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--
-- ws_ok.asmx --
<%@ WebService Language="vb" Class="Service1 " %>

Imports System
Imports System.Web
Imports System.Web.Serv ices

<WebService(Nam espace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--

Nov 19 '05 #1
2 1503
You should compile the project first before you can start using it. During
this, all the code-behind pages are compiled into a binary file in the bin
folder. This file contains all the code-behind classes you use in your ASMX
file. Since you probably did not do this, you are receiving this error.

--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"author" <no**@available .com> wrote in message
news:68******** *************** *********@4ax.c om...
Newbie Q...

When I hit the "ws.asmx" in a browser, I get
"Parser Error Message: Could not create type 'Service1'" ??

If I use the file "ws_ok.asmx " (without codebehind, but same code), I
get no errors.

Any 1 ??

TIA
-- ws.asmx --
<%@ WebService Language="vb" Codebehind="ws. vb" Class="Service1 " %>
--
-- ws.vb --
Imports System
Imports System.Web
Imports System.Web.Serv ices

<WebService(Nam espace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--
-- ws_ok.asmx --
<%@ WebService Language="vb" Class="Service1 " %>

Imports System
Imports System.Web
Imports System.Web.Serv ices

<WebService(Nam espace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--

Nov 19 '05 #2
> You should compile the project first before you can start using it.

Ahh.. okey. So I just can't do it like I do with my
aspx-codebehind-files ?? - only if I put it all in the asmx-file ??
mypage.aspx
--
<%@ Page Language="vb" Inherits="mypag e" Src="mypage.vb" %>
--

mypage.vb
--
Imports ....

Public Class mypage
Inherits page

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
End Sub
End Class
--
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1558
by: hellrazor | last post by:
Hi, (new to webservices here) Is it possible to access a class instance variable defined in a webservice? I want to access this variable, in addition to the data being returned by the . so let's say I have the following webservice class: public class Service1 : System.Web.Services.WebService
6
768
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a .NET Framework application, but just not on the .NET CF version. Can anyone suggest anything that might be wrong with the code? (I could post the app and webservice, but i was hoping that you might have noticed something from the supplied...
2
1287
by: Temp | last post by:
I have created a webservice that currently exists on my localhost. I have no trouble creating an instance of the service in my ASP application, but everything blows up when I try to instantiate one of the public methods. The error returned tells me that access is denied. Is there a setting either in the web.config file or IIS that I need to adjust in order for the service to be made public? Thanks ,
1
4218
by: Maik Thiele | last post by:
Hey, I have following simple ftpService class with a method download. When I run the class not as a web service it works fine. But when I run the class as a web service the FtpGetFile() method fails. I guess the reason is that I try to save a file locally, what is maybe not allowed with in a web service. Has anybody an idea?
0
1668
by: Rene Ruppert | last post by:
Hi, On the web I found a simple sample/tutorial for a webservice, some kind of chat software. I implemented the server and the client. When I run the client form on the host PC everything works fine. When I run it on the PPC device emulator it keeps saying that it cannot connect to the server. The device emu is cradled and I can surf the web with Pocket Internet Explorer. But: when I call the ChatService.asmx file from Pocket Explorer
1
345
by: toudidel | last post by:
What can be named webservice? Is asp script receiving by POST method some xml data, performing and responding result, webservice or not yet? Must it be described with WSDL or not (if i want to name it webservice)? Question is: is any server script (performing e.g. xml's) a webservice or not? what must be done to name it webservice? -- td
5
3047
by: Andy | last post by:
Hi, below is simple webservice wich I'd like to test in my local host and when I put http://localhost/test.asmx I'm getting this error: XML Parsing Error: no element found Location: http://localhost/test.asmx Line Number 1, Column 1: Can somebody help me why? What I'm missing?
4
2192
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
I need to do a simple asych post back to validate that an id is unique. I do not want to post back the entire page for this, but i want to make this part of the clientside validators. 1. i already have a custom validator that checks for a correctly formatted id and the javascript works w/o problem. Any help would be appreciated. -- Share The Knowledge. I need all the help I can get and so do you!
10
2125
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel <System.Web.Services.WebService(Namespace:="http:// wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")_
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.