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 140633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:38:50+00:00 2026-05-11T07:38:50+00:00

Given a contract such as: [ServiceContract] public interface IService { [OperationContract] [WebGet(UriTemplate = GetData/{id}.{format})]

  • 0

Given a contract such as:

[ServiceContract] public interface IService {     [OperationContract]     [WebGet(UriTemplate = 'GetData/{id}.{format}')]     ResponseData GetData(string id, string format); } 

Is there a way to get the service to respond with json when requested as: /GetData/1234.json, xml when requested as /GetData/1234.xml and still be available as a proper soap service at some other url, with a strongly typed wsdl contract?

Using a Stream as the return value for GetData is not workable, as though it fufills the first two requirements, wcf can’t create a full wsdl specification as it has no idea what the contents of the resultant Stream will be.

  • 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. 2026-05-11T07:38:50+00:00Added an answer on May 11, 2026 at 7:38 am

    You should have two separate methods which take id and format (and they would call a shared implementation that returns ResponseData) which have different WebGet attributes:

    [ServiceContract] public interface IService {     [OperationContract]     [WebGet(UriTemplate = 'GetData/{id}.{format}.xml',          ResponseFormat=WebMessageFormat.Xml)]     ResponseData GetDataXml(string id, string format);      [OperationContract]     [WebGet(UriTemplate = 'GetData/{id}.{format}.json',          ResponseFormat=WebMessageFormat.Json)]     ResponseData GetDataJson(string id, string format); } 

    For the SOAP endpoint, you should be able to call either method, but you are going to have to have a separate ServiceHost instance hosting the implementation of the contract.

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

Sidebar

Ask A Question

Stats

  • Questions 194k
  • Answers 194k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Obey the golden rule of performance optimization: Measure first. It… May 12, 2026 at 6:48 pm
  • Editorial Team
    Editorial Team added an answer Agile/XP is an approach to managing your project activities, deliverables… May 12, 2026 at 6:48 pm
  • Editorial Team
    Editorial Team added an answer For the record, the man page (index-pack) states: It is… May 12, 2026 at 6:48 pm

Related Questions

Given an operation contract such as: [OperationContract] void Operation(string param1, string param2, int param3);
Can anyone recommend a framework for templating/formatting messages in a standalone application along the
Moose is a fantastic object framework. The trouble is that, taken together with its
The question title is probably not correct because part of my question is to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.