Can't Expose Data Contract When Not Used By A Web Service Method

Posted on 2008-11-17
Last Modified: 2013-12-17
THis drove me crazy for a couple hours. But I have realized that unless I have a method that uses one of my DataContracts as a parameter or a return value, the class is not exposed in the WSDL. So my question is...why the heck not...and can I expose it anyway somehow?
Question by:SGyves
    LVL 16

    Accepted Solution

    Ok, I'll bite: Why would you want to define a datacontract that no one who uses your web service will ever see? Thats the point of a contract, it is exposed to someone else so they can use it.

    Web service users can call methods, passing params and getting values back. So if it doesn't fall into one of those catagories WCF figures its not a contract.

    "can I expose it anyway somehow?"
    I doubt it. I'll check around tho.

    Author Closing Comment

    Okay...problem is...I am mimicing a web service that takes XML as a string and does some serialization\desiralization into these objexts. Unfortunately...I do not have much say in the design on that part. Probably should have just used regular ASP web services eh? But I appreciate you confirming my insanity. Really I do.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now