question

SzendefyAron-8841 avatar image
SzendefyAron-8841 asked ·

How to control the WSDL created by WCF

Dear Forum,

Can you please help.

I've got a Visual Studio WCF project (.NET: 4.7.2, Language: C#) where I am using [ServiceContract], [DataContract] and [MessageContract] attributes to generate WSDL from the classes implementing the services (see attached file).

The WSDL generated by WCF contains the following unnecessary parts, items. How can I get rid of these?

  1. Some XML namespace-es which are not used in the WSDL (eg. xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";)

  2. A complete <xs:schema> section that defines the base types as elements.

  3. Some types are also defined as elements though the SOAP message does not contain them as elements (eg. type="q2:AsyncReportRequest")

  4. The SOAP message elements defined by [MessageBodyMember] attributes inside a [MessageContract] decorated class are defined as optional in the WSDL (Eg. <xs:element minOccurs="0" name="callContext" nillable="true" type="q1:callContext">). I found no option on the attributes to specify "required".
    5.

I've already studied all properties of the decorating attribute classes and found no solution.
I've also looked at the possibilities of IWsdlExportExtension to extend WCF on the WSDL export functionality but I couldn't find a solution for changing the way WCF handles and generates these parts. I could only find description for adding additional information to the WSDL by defining custom attributes.

Thank you for helping, regards,
Áron

ps. I put the tag windows-runtime because wcf is not available in the tags list. Actually not many things are available, why is that?

8359-dwhhorizontaszinkronriportlekerdeze1-localhost-ws.xml






not-supported
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichardZhang-MSFT avatar image
RichardZhang-MSFT answered ·

Hello,

Welcome to Microsoft Q&A!

Currently, Microsoft Q&A is under a public preview. Your issue about WCF is not supported right now. But there is a better place for asking questions about WCF, you could ask about this issue in WCF Data Service.

Thank you.

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.