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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:57:52+00:00 2026-05-11T18:57:52+00:00

I want to create a web service for my clients so they can display

  • 0

I want to create a web service for my clients so they can display their data on their own web sites. Since I will not know what platform each client is running, what would be the best solution to create a proxy to the WCF service that can be used by all browsers? Also, I am not sure how I should present the data. Let’s assume my users do not have any development skills. I will, by some other interface, give the user the ability to download the code needed to create the request and then process the response. Would it be better to parse an xml response on the client side then create the list of data or have the list already formatted (in a string) and have the client do a document.write? I have looked at a few solutions, but they seem to require the use of an ASP page with a script manager. Like I said, I would like something generic enough to use different browsers. Mainly IE and FireFox.

Daniel

  • 1 1 Answer
  • 2 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-05-11T18:57:52+00:00Added an answer on May 11, 2026 at 6:57 pm

    First, since you don’t want to depend on Microsoft Ajax ScriptManager, don’t use <enableWebScript /> in the endpointBehaviors/behavior. It is Microsoft-specific JSON.

    Fortunately, however, WCF makes it very easy to allow your client to decide whether they want XML or generic JSON.

    1. Use the <webHttp /> behavior.

      <endpointBehaviors>
      <behavior name=”My.WcfServices.webHttpBehavior”>
      <webHttp />
      </behavior>
      </endpointBehaviors>

    2. Create a custom WebServiceHost and custom property attribute as described in
      Damian Mehers’ blog, WCF REST Services. In Mehers’ code, the type is determined by the request content type. You may want to extend it to examine the URL, for example, .xml or .json or ?format=xml|json.

    3. In the SerializeReply method, examine the URL.

      Message request = OperationContext.Current.RequestContext.RequestMessage;
      Uri url = request.Properties[“OriginalHttpRequestUri”] as Uri;
      // Examine ?format query string
      System.Collections.Specialized.NameValueCollection colQuery = System.Web.HttpUtility.ParseQueryString(url.Query);
      string strResponseFormat = colQuery[“format”];
      // or examine extension
      string strResponseFormat = url.LocalPath.Contains(“.json”) ? “json” : “xml”;

    4. Define your method(s)

      [OperationContract]
      [WebGet(UriTemplate=”Hello.{responseFormat}”)] // or “Hello?format={responseFormat}”
      [DynamicResponseType]
      public string Hello(string responseFormat)
      {
      return “Hello World”;
      }

    Example URLs:
    http://localhost/myrest.svc/Hello.xml
    http://localhost/myrest.svc/Hello.json
    or
    http://localhost/myrest.svc/Hello?format=xml
    http://localhost/myrest.svc/Hello?format=json

    1. Both JSON and XML are easy to consume across browsers. Libraries, such as jQuery for JSON and Sarissa for XML make it even easier.

    NOTE: If you see error “Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding.”, add the baseAddressPrefixFilters element and add localhost (or whatever your domain) to IIS Host Header Names.

    <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
        <baseAddressPrefixFilters>
            <add prefix="http://localhost"/>
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a web service in ASP.NET that fetches data from a
Objective: I want to create a web service that allows me to connect to
As I have already figured out. I want to create a web service on
I want to create tree structure using web service. I have used bottom up
I want to create an iPhone app which makes calls to a web service.
We have build several web service based on .net. Now we want to create
I want to create a spring-ws web service that eventually marshals a POJO into
I want to create client-server GPS tracking application that clients send location data to
I want to test my web service if a number of clients access it
I have created Web-Service in asp.net with c# . Now i want to pass

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.