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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:39:48+00:00 2026-06-13T04:39:48+00:00

I am trying to send a request using a wcf client to a ColdFusion

  • 0

I am trying to send a request using a wcf client to a ColdFusion 9 service using json. However, the content-type of the request is for xml.

Here is the service contract. As you can see we specificy using RequestFormat of json.

[ServiceContract(Name = "ServiceAgreementRequestService", Namespace = NetworkNamespaces.ServiceNamespace)]
public interface IServiceAgreementRequestService
{
[OperationContract]
[FaultContract(typeof(RequestFault))]
[WebInvoke(UriTemplate = "?method=CreateUser", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
CreateUserResponse CreateUser(CreateUserRequest request);
}

I have also tried to set the Request.ContentType on the OutGoing request and this also did not work.

using (var context = this.GetServiceClient(clientId))
{
WebOperationContext.Current.OutgoingRequest.ContentType = "application/json; charset=UTF-8";
var request = new CreateUserRequest(user.Id, user.Person.FirstName, user.Person.LastName);
var response = context.Channel.CreateUser(request);
}

Here is the request that gets sent

POST http://somesite.domain.com/WebServices/ProviderService.cfc/?method=CreateUser HTTP/1.1
Content-Type: application/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo7eh9U9jsBVLqVgGtqTK+eMBAAAAb++0xkOSQEmcAKZLgQEsp2/muY2ca6NJiul6pkAaWZwACQAA
Host: somehost.domain.com
Content-Length: 58
Expect: 100-continue
Accept-Encoding: gzip, deflate

{"UserId":4,"FirstName":"FirstName","LastName":"LastName"}

How do I get this to use the correct content-type?

EDIT:

Under the hood, the GetServiceClient(clientId) call uses system.servicemodel.clientbase and ChannelFactory to create the communication channel. The endpoint that we call out to changes by client so we have some code on top of those to dynamically change out the endpoint.

Some more info. We have two applications : One is a .net MVC 4 web application to host the client app and one is a .net WCF Server application to host the backend services. I can call out to the ColdFusion app successfully from the web application, but not the wcf Server application. These both use the same code base to make the outgoing call.

As far as I can tell the config is the same for both.

<system.serviceModel>
<endpointBehaviors>
<behavior name="WcfRestBehavior">
<webHttp />
</behavior>

<client>
<endpoint name="ServiceAgreementRequestService" address="http://PLACEHOLDER/" binding="webHttpBinding" behaviorConfiguration="WcfRestBehavior" contract="IServiceAgreementRequestService"/>
  • 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-13T04:39:50+00:00Added an answer on June 13, 2026 at 4:39 am

    To use the WCF REST Client within a service, you’ll need to create a new operation context scope, by using code similar to the one below.

    Calling code:

    var client = this.GetServiceClient(clientId);
    using (new OperationContextScope(client.InnerChannel))
    { 
        var request = new CreateUserRequest(user.Id, user.Person.FirstName, user.Person.LastName); 
        var response = client.CreateUser(request); 
    } 
    

    Other implementations:

    class MyType : ClientBase<IServiceClient>, IServiceClient
    {
        public MyType() : base("ServiceAgreementRequestService") { }
        public CreateUserResponse CreateUser(CreateUserRequest req)
        {
            return this.Channel.CreateUser(req);
        }
    }
    
    public MyType GetServiceClient(int clientId)
    {
        return new MyType();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send a SOAP request using SOAPpy as the client. I've found
I wrote REST service using ASP.NET Web API. I'm trying to send HttpDelete request,
Trying to send POST request on click event using jQuery with no luck. Here
I am trying to send app request notification to multiple friends using Graph api,,here
Hello I'm trying to send a simple GET request using flex mx:HTTPService: <mx:HTTPService id=service
I'm trying to send a POST request to a simple WCF service I wrote,
I am trying to send a json RPC ajax request when the page is
I'm trying to replace a legacy REST/plain old xml web service with a WCF
I've got a problem trying to send a request using QNetworkAccessManager from a QObject
Anyone here who has experience with using Exchange webservice. I am trying to send

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.