Reputation: 2728
Let's say I have a WCF service that uses the namespace "http://mynamespace.com/myservice" for all the messages (in the SOAP XML).
I add a service reference to this service in Visual Studio and start using it.
Now I want to get that namespace (the string) with code on the client side somehow, but I don't know how. Is it possible?
(Hope you understand what I mean, I'm new to WCF and don't really know the correct terminology)
Upvotes: 1
Views: 1588
Reputation: 1280
If you want to simply find the namespace of any SOAP service you can just inspect the WSDL and look at the wsdl:definitions element. The namespace of the service will be found in the targetNamespace attribute. You can always get to the WSDL by browsing to http://server/service.svc?wsdl
Also note that your service contracts and your data contracts have namespaces too. The service operation namespace becomes your Soap Action and the data contract namespaces discern your types.
From a client perspective you could always look at the binding information that was generated. The endpoint configuration element should automatically expose a bindingNamespace attribute which is the namespace of the service.
If you use the WCF Test Client tool you can look at the Config File that is generated to get a better understanding of your services.
Upvotes: 1