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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:00:37+00:00 2026-06-13T00:00:37+00:00

How can I create the service contract to be in XmlSerializerFormat as well as

  • 0

How can I create the service contract to be in XmlSerializerFormat as well as WebMessageFormat.Json within a WCF RESTful service.

What I need is to call the “CallADSWebMethod” operation contract from code behind of ASP.Net 1.1 which needs to be XML serialized and
from jQuery ajax which is Json serialized.

SERVICE CONTRACT

[ServiceContract, XmlSerializerFormat]
    public interface IService
    {
        [OperationContract, XmlSerializerFormat]
        [WebInvoke(UriTemplate = "/CallADSWebMethod",
                   Method = "POST",
                   BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   ResponseFormat = WebMessageFormat.Json)]
        VINDescription CallADSWebMethod(string vin, string styleID);
    }

Endpoint Info

        <endpoint address="basic"
                  binding="basicHttpBinding"
                  name="httpEndPoint"
                  contract="ADSChromeVINDecoder.IService" />
        <endpoint address="json"
                  binding="webHttpBinding"
                  behaviorConfiguration="webBehavior"
                  name="webEndPoint"
                  contract="ADSChromeVINDecoder.IService" />
        <endpoint contract="IMetadataExchange"
                  binding="mexHttpBinding"
                  address="mex" />
  • 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-13T00:00:39+00:00Added an answer on June 13, 2026 at 12:00 am

    What you can do is specify your Web Service like this:

         [OperationContract]
        [WebInvoke(Method = "POST", 
            ResponseFormat = WebMessageFormat.Xml, 
            BodyStyle = WebMessageBodyStyle.WrappedRequest, 
            UriTemplate = ""/CallADSWebMethod"")]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            UriTemplate = ""/CallADSWebMethod"")]
    VINDescription CallADSWebMethod(string vin, string styleID);
        }
    

    However, what I would suggest you to do is specify 2 different endpoints: one for the XML serialized data and another for JSON serialized data. Come on dude, you are using the REST architecture…..why not make full use of it??!

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

Sidebar

Related Questions

I need to create a service which can process queued requests on a configured
I am working on a WCF webservice. I need to create a Post service
I'm using WCF to create a SOAP web service, with predefined XSD contract, and
How can I create client proxy if I know only the type of service
Is it possible to create a C# web service which can be called asynchronously
I created a Ajax enabled WCF service. I can consume the service from javascript
How can create a string in JSON after a mysql select: $ritorno = '{Prodotto:'.$riga['Prodotto'].',Prezzo:'.$riga['Prezzo'].'}'
I've a must to create wcf service with parameter. I'm following this http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8f18aed8-8e34-48ea-b8be-6c29ac3b4f41 First
I have a RESTful service that I am developing in WCF . I am
I just started learning on WCF and is trying to create a WCF service

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.