In the [Service Contract(Namespace="http://myuri.org/Simple")] what is the Namespace for? I have done WCF services and never included this. What is its purpose?
The namespace property is really an XML term. It allows you to maintain uniqueness with elements (similar to what .NET does with namespaces). So you can have multiple elements of the same tag name but they are completely different as long as they have different namespaces. The Namespace
property of the ServiceContractAttribute
class according to MSDN refers to the following:
"Gets or sets the namespace of the <portType>
element in Web Services Description Language (WSDL)."
D3eclaring a namespace is particularly important if you are in a big organisation such as a bank that might have multiple implementations of a webservice method such as GetDerivativeProduct().
From the MSDN docs:
It is highly recommended that this default namespace, which is http://tempuri.org, be changed before the XML Web service is made publicly consumable. This is important because the XML Web service must be distinguished from other XML Web services that might inadvertently use the namespace as the default (http://tempuri.org/).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With