Reputation: 1438
I have WSDL exported from WCF service with singleWSDL parameter applied.
There are a lot of qXX XML namespaces used like in the following fragments for type and method.
<xs:complexType name="PrincipalReference">
<xs:complexContent mixed="false">
<xs:extension base="q2:EntityReferenceBase">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="GetPermissions">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="principal" nillable="true" type="q1:PrincipalReference"/>
</xs:sequence>
</xs:complexType>
</xs:element>
PrincipalReference class is inherited from EntityReferenceBase. Both PrincipalReference and EntityReferenceBase are in the same C# namespace and have one and the same value of Namespace field of DataContractAttribute. So they are in one namespace by all means.
Can I somehow get rid of these q1 and q2 XML namespaces? Web-service is intended to be used from various environments (platforms/languages), so clearer WSDL is, happier I am.
I can, for instance, just as a workaround, stop using inheritance, copy base class content to derived ones and thus solve q2 problem, but I have no idea what to do with q1 namespace applied to method parameter type.
Upvotes: 3
Views: 1139
Reputation: 1436
I had the same problem, the strange thing was it first had not have these q1, q2, q3 prefixes. I am using the DataContract serializer and I missed to cover all I needed with DataContract and DataMember attributs. After that these prefixes were gone.
Also take care about what you serialize, I had a TimeSpan value that I had to replace to an int, so that this did not happen anymore.
Upvotes: 1
Reputation: 2670
I think you need to do the following:-
Use the namespace attribute when annotating your service contracts and data contracts. Something like this for example:-
[ServiceContract(Namespace = "http://some.url/2012/11")]
[DataContract(Namespace = "http://some.url/2012/11")]
Also, when you are setting up your endpoint, ensure you set the bindingNameSpace
attribute:-
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="someBindingConfiguration"
bindingNamespace="http://some.url/2012/11"
contract="Some.Contract" />
Upvotes: 2