Groups | Blog | Home
all groups > asp.net webservices > september 2004 >

asp.net webservices : renaming webservice-class ??


Jared
9/11/2004 7:12:16 AM
When you create a web reference, vs generates a proxy class. Click the Show
All Files button in the solution explorer to follow allong. Choose
<references><web references><CalcWS><reference map><reference.vb>
Open it, and you will see all the methods of your web service as well as
their asynchronous signatures. In any sense, that just demonstrates what the
proxy class is. Calls to your web service are invoked by this class. Since
you made a change to the name of the web service the proxy class is no
longer valid. To fix this you will have to right click on the CalcWS
reference and choose <update web reference>. Hope this makes sense.

Jared

[quoted text, click to view]

Chris
9/11/2004 10:06:42 AM
Hi,

I use my Webservice in IE : http://localhost/CalcWS/CalcService.asmx
That works well.

Then, in visual Studio.NET :
I rename the name of the WebService-class from the default name 'Service1'
to 'CCalc'
, rebuild the project, but, using it again in IE :
http://localhost/CalcWS/CalcService.asmx
results in a parser error.
" Could not create type 'CalcWS.CCalc'.

how come ?
how can I still rename the class ?

thnx
Chris

Jared
9/11/2004 11:12:21 AM
Did you change the targetNamespace attribute to reflect the change.
Make sure it's correct. Try to browse to the page using
http://localhost/CalcWS/CalcService.asmx?wsdl
Is the targetNamespace attribute correct?

[quoted text, click to view]

A.Mens
9/11/2004 12:53:15 PM
Have you ranemd/changed it in both the Code file and de ASMX file ?

Greetings Andre

Chris
9/11/2004 3:23:32 PM
hi Andre, you wrote :
[quoted text, click to view]

Yes:
so the asmx-file looks like this :
<%@ WebService Language="c#" Codebehind="CalcService.asmx.cs"
Class="CalcWS.CCalc" %>

and the code behind file :
public class CCalc : System.Web.Services.WebService
{...}

hi Jared:
I'm using the WebService directly from within IE, so not via a Web reference
set in VisStudio.

any ideas ?

[quoted text, click to view]

Jared
9/12/2004 8:08:01 AM
Chris,

What is the physical file names that is stored in the virtual directory?
This is your entry point, you may have changed the class name but if the
file name remains the same you will still have to tell IIS what file you
want to access. Try accessing it
http://localhost/virtualDirectoryName/Filename.asmx

What happens when you try to debug the program, what is the URL? Can you
debug? Step through the code to see where the reference to service1 is.
Have you tried to add a web reference to you application through visual
studio, there is an option to search the local machine, try it. Can you see
your service in the list? If so, add a reference it and look at the url,
does it match the one you are trying to browse to? Does it work?

You didn't change you web.config to include a custom IE page using the
wsdlHelpGenerator file, if you did remove it and see if it works.

<webServices>
<wsdlHelpGenerator href="SomeCustomForm.aspx"/>
</webServices>

Try to generate a discovery document
http://localhost/CalcWS/Calculator.asmx?disco look at the contactRef
attribute and the docRef attribute. Do they point to the correct locations?


Search your project for the old name of the service?

[quoted text, click to view]

Chris
9/12/2004 9:25:13 AM
Hi jared,

I added the attribute, the code-behind looks like this now :
[WebService(Namespace="http://localhost/webservices/")]
public class Calculator : System.Web.Services.WebService
{...}

but I still have the same problem : I cannot browse to
http://localhost/CalcWS/Calculator.asmx
nor to
http://localhost/CalcWS/Calculator.asmx?wsdl

still getting the parser error.

some other place where I have to change it, maybe directly in the asmx-file
using a text-editor ?
actually I tried that as well :
<%@ WebService Language="c#" Namespace="http://localhost/webservices/"
Codebehind="Calculator.asmx.cs" Class="CalcWS.Calculator" %>

but no improvement :-((

what now ?

thanks
Chris

[quoted text, click to view]

AddThis Social Bookmark Button