Web services and namespaces

E

Erik Cruz

Hi.

VS.NETO help says the following about the webservice attribute:

"The WebServiceAttribute is not required for an XML Web service to be
published and executed. You can use the WebServiceAttribute to specify a
name for the XML Web service that is not restricted by the rules for a
common language runtime identifier, which is used in the service description
and the Service help page for the XML Web service."

I removed the WebService attribute from a web service I am writing, since
the help says that it is not necessary. When I run the web service I noticed
that the http://tempuri.org namespace was used automatically. I believe
then, that the WebService attribute is necessary. What is the real role of
this attribute? What kind of problems I may have if my web service does not
have a namespace?

TIA,
Erik Cruz
 
E

Erik Cruz

Hi Scott.

No problems with the syntax for designating the namespaces. I would like to
know if it is possible to create a web service without a namespace and if
so, what disadvantages or problems can I find when running the web service?

TIA,
Erik Cruz
 
S

Scott M.

The Namespace is an XML designation that you create to help organize your
stuff. TempURI is just an example. If you look at the comments generated
in VS.NET when you make a web service, you'll see syntax for designating
your custom namespace.
 
S

Scott M.

You need to investigate XML a bit more and this will become clear. In XML,
namespaces are used to qualify and define what xml tags are what, similarly
to how in .NET, namespaces keep classes straight.

You do need a namespace for your web service and it can take the form of a
URL. You can then make up the rest. If you put it in the form of a URL
though, you can use your company's domain name (which is guaranteed by DNS
to be unique).

Namespaces for web services help not only you keep your stuff straight, they
also help the consumers of the web service understand what they are
consuming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top