Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8622379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:02:25+00:00 2026-06-12T07:02:25+00:00

Background I have inherited a project which relies on several different WCF "mex" endpoints

  • 0

Background

I have inherited a project which relies on several different WCF "mex" endpoints for it’s data. The goal of my particular project, once complete, is to serve as an API layer which calls these legacy WCF services, manipulates the returned objects (in rare cases only), serializes to JSON and then responds Restfully to the requesting client.

C#, MVC 4, .NET 4.

I am very experienced with RESTful web services, but NOT with WCF.

Here is an example of an endpoint uri:

http://product.sqa.acme.com/products.svc/mex

Question

In setting up my first class that consumes one of these WCF services, it appears that I have to set up an entire data contract in order to use the returned object. Is this correct? If this is not correct, how do I call a method of the WCF interface (i.e. IProductService >> GetProductById(123)) and then manipulate the resulting object without a contract?

I have tried this:

var ip = (IProductService)new ProductServiceClient("http://product.sqa.acme.com/product.svc/mex");
            var product = ip.GetProductById("DVP4963619");

But the code fails because a contract is not found. Since 90% of what I will be doing is simply passing-through a request and then serializing the response to JSON, it seems like overkill to have to define a contract for every service call I make. Any help is appreciated.

Thanks,

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:02:26+00:00Added an answer on June 12, 2026 at 7:02 am

    To consume the service, you can just point Visual Studio’s Add Service Reference wizard to the “mex” endpoint that you have, and it will generate a client for you, including the data contract classes for that.

    To create the (REST) service that returns data, you have two choices. You can either create the data contracts representing the data you want to return (or reuse the ones generated by the tool). Or you can bypass those, if you want to control the output of the operation entirely. If the operation returns a Stream type, you can write anything (JSON or not) to the output (by returning a subclass of that abstract type), so you wouldn’t have to create a data contract for that. You can find more this “raw mode” at http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-web.aspx.

    Another alternative for returning data would be to use something like ASP.NET Web API, which does have support for “untyped JSON” model using the JSON.NET types in the Newtonsoft.Json.Linq namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background : I have a few different threads which each need to write to
Hi and thanks for looking! Background I have inherited an old .NET project based
I have inherited a java system which should be run in the background on
I have just 'inherited' a Java-project and not coming from a Java-background I am
Overview I have an iOS project in which I am using Core data I
Background I have inherited a load of XML files that consistently contain a tag
Background I have two lists, the first is items which contains around 250 tuples,
I have a shell which has a background image. Within this shell, I have
I have a project which have three dialog, Let's say A, B, C. And
Background: I'm relatively new to Java/Spring and inherited a project built on them. We're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.