<hu********@gmail.comwrote in message
news:17**********************************@m36g2000 hse.googlegroups.com...
On Jul 21, 10:46 am, "John Saunders" <n...@dont.do.that.comwrote:
><huohaod...@gmail.comwrote in message
news:cd**********************************@f36g200 0hsa.googlegroups.com...
I have a webservice class MyService.asmx.cs with:
namespace XMLWS
{
[WebService(Namespace = "http://mydomain.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Poster : System.Web.Services.WebService
{
[WebMethod]public int MyMethod()
This web service is intended to developed for different customers that
will be installed and used for different domains, Some article says
that changing web server namespace at runtime is not something should
do. "The namespace is just a contract definition and if one specific
webservice is deployed to two different servers it should use the same
namespace on both. The url used in the namespace has no actual
meaning. By convention, you should use the your own domain, and append
to it to make it unique for the specific service (http://
www.yourdomain.com/poster)" But, since my web service is designed for
different costumers, and the changing and recompiling of code for each
for them is not something I think I should do.
Do not change the namespace. It has nothing to do with the URL at which
the
service is deployed. It has to do with the contract, and you're not
changing
the contract from one customer to the next.
--
John Saunders | MVP - Connected System Developer
Thanks for the response.
If I develop my web services for the AAA.com and BBB.com, how should
I define the wsdl's definitions to something like
targetNamespace="http://www.aaa.com/webservices" and
targetNamespace="http://www.bbb.com/webservices" respectively?
It's a common misconception, but the namespaces are not URLs. They have
nothing to do with locations on the Internet. They are simply names, in a
particular format, used to disambiguate names in an XML document. It's
similar to the idea of namespaces in .NET, which allow you to have a class
named "huohaodian.Exception" and me to have a class named
"JohnSaunders.Exception" and for them to be seen as different names.
They are actually in the format of a URI (Universal Resource _Identifier_).
One form of a URI is a URL, which is an identifier that also represents the
location from which the identified resource may be retrieved. But the more
general form is a URI.
One example of a URI is "urn:schemas-microsoft-com:xml-msdatasource".
So, don't worry about it. Use a unique namespace that you devise for your
own web service. These namespaces need to be unique within your
organization, otherwise there can be confusion between the same name used in
two of your different web services. This means you will need some way to
keep track of namespaces you use, or at least a pattern of generating them
that will tend to prevent duplication. For example, you might use something
like
"http://www.yourcompany.com/division/department/application/service/wsdl/2008/07"
This sort of format, for instance, enables you to produce a different
version of the same service, with changes, at a later date, just by changing
the date part at the end.
--
John Saunders | MVP - Connected System Developer