I have a Default.asmx file that contains only this line:
<%@ WebService Language="vb" Codebehind="WebService.vb"
class="MyProgramBS.WebService" %>
All my WEbMethods are in MyProgramBS.WebService: e.g.
<WebMethod()> Public Function CanPayOnline(ByVal loginID As Long) as
Boolean()
When I test this, the default value of the namspace is
http://tempuri.org/
I tried modifying the code in Default.asmx as:
Imports System.Web.Services
<System.Web.Services.WebService(Namespace:="http://www.MyWebSite.net/WebService")>
_
Public Class WebService
Inherits System.Web.Services.WebService
' WEB SERVICE EXAMPLE
' The HelloWorld() example service returns the string Hello World.
' To build, uncomment the following lines then save and build the
project.
' To test this web service, ensure that the .asmx file is the
start page
' and press F5.
'
'<WebMethod()> _
'Public Function HelloWorld() As String
' Return "Hello World"
'End Function
End Class
but nothing happens. I think it is because I do not write any of my
web methods in the asmx file, but I redirect to WebService.vb . So how
can I change the Namespace this way?
Jan Tielens - 25 May 2004 21:45 GMT
The TempUri namespace is the namespace for the XML soap message! You can
control this by using the WebService attribute, for example:
[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
// implementation
}

Signature
Greetz
Jan
________________
Read my weblog: http://weblogs.asp.net/jan
> I have a Default.asmx file that contains only this line:
>
[quoted text clipped - 10 lines]
> I tried modifying the code in Default.asmx as:
> Imports System.Web.Services
<System.Web.Services.WebService(Namespace:="http://www.MyWebSite.net/WebServ
ice")>
> _
> Public Class WebService
[quoted text clipped - 18 lines]
> web methods in the asmx file, but I redirect to WebService.vb . So how
> can I change the Namespace this way?
Rocio Katsanis - 25 May 2004 22:06 GMT
Tx. for the reply.
Yes, I know I have to do this, but where? In my Default.asmx.vb file?
Well I put it there, but I do not implement any WebMethod here, but in
another file. What I do in Default.aspx is to redirect the program to
this other file where I implement my WebMethods.
This is what I have:
MySolution (2 projects)
Project
Default.asmx
web.config
Global.asax
ProjectBS
WebService.vb
Default.asmx is empty, but contains a line that redirects it to
ProjectBS.WebService.vb
However, in Default.asmx.vb I put the Namespace as you indicated and as
I did before, and nothing happens.....
Is it because I have the WebMethods in another file?
Jan Tielens - 26 May 2004 17:06 GMT
When you open the CODE of the ASMX page (physically the vb file), you'll see
the code for your web services. Since you are using VB.NET look for Public
Class .... Remember that you must apply this attribute or class level (not
method level) and that attributes in VB.NET are between < and >.

Signature
Greetz
Jan
________________
Read my weblog: http://weblogs.asp.net/jan
> Tx. for the reply.
> Yes, I know I have to do this, but where? In my Default.asmx.vb file?
[quoted text clipped - 18 lines]
>
> Is it because I have the WebMethods in another file?
Rocio Katsanis - 26 May 2004 17:55 GMT
OK.
I got it. Since I have implemented the class WebService in another file
(not in my asmx.vb) and this file resides in another project (a class
project), I added the attribute <WebService> to the class in this file:
<System.Web.Services.WebService(Namespace:="http://www.mywebsite.com/Web
Service")> _
Public Class WebService
Inherits System.Web.Services.WebService
End Class
Previously I had a simple Public Class WebService .... in this file, and
the Namespace attribute was in the asmx.vb file.
Tx!
Jan Tielens - 26 May 2004 22:09 GMT
Np! Glad I could help!

Signature
Greetz
Jan
________________
Read my weblog: http://weblogs.asp.net/jan
> OK.
>
[quoted text clipped - 13 lines]
>
> Tx!