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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:03:33+00:00 2026-05-26T06:03:33+00:00

I am creating a WCF POX proxy using the generic ClientBase base class against

  • 0

I am creating a WCF POX proxy using the generic ClientBase base class against a fixed specification.

The specification has items created with a POST call to an endpoint. With no body response packet and header status of (201 Created) and the ID of the item in the header collection with the key of Location.

The item is being created but my WCF proxy is raising the following error:

Unexpected end of file

I have started down the route of creating a custom IClientMessageFormatter but the:

IClientMessageFormatter.DeserializeReply(Message message, object[] parameters)

is still being called to late. I am assuming, in order to intercept the responseStream before it is read I have to hook in deeper within the Behavior class.

Any help will be greatly appreciated.

Revision 1.

HTTP/1.1 201 Created
Server: nginx/1.0.5
Date: Thu, 13 Oct 2011 23:52:34 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201 Created
X-Throttle-Max: 500
X-Throttle-Count: 1
Location: https://sample.com/categories/1.xml
X-Throttle-Horizon: 2011-10-13T23:52:40Z
X-Runtime: 232
Set-Cookie: transition_token=BAhbB2kD8bSUSXU6CVRpbWUNwOUbwAkZIdIGOh9AbWFyc2hhbF93aXRoX3V0Y19jb2VyY2lvblQ%3D--de2dc7f909ce89e0ce9f2307ac43ddfc171442b7; path=/; secure
Set-Cookie: _sample_session=BAh7BzoQaWRlbnRpdHlfaWRpA2eiKjoPc2Vzc2lvbl9pZCIlNGVlNWMzNWY4MzdmZmM3MGNlNzE1ZjdjZmM5MDhmYmY%3D--d8927e076329846e844f9f73b4d587c697628481; path=/; HttpOnly; secure
Cache-Control: no-cache
Strict-Transport-Security: max-age=31536000

1

0

Above is the response. It has both no body and a content-type = application/xml. WCF doesn’t know how to reconcile this for some reason. So, that is why I am trying to intercept the WCF Binding or Behavior before the responseStream is read.

I would like to see if someone can point me the right direction. Thanks.

  • 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-05-26T06:03:34+00:00Added an answer on May 26, 2026 at 6:03 am

    Figured it out. I had to create a WebContentTypeMapper and assign it to the WebMessageEncodingBindingElement.ContentTypeMapper. The only issue I had, was that the TypeMapper was not only dependent on the contentType but also the ReturnType of the method. Below is an example:

    internal class RestWebContentTypeMapper : WebContentTypeMapper
    {
        public RestWebContentTypeMapper() : base() { }
    
        public override WebContentFormat GetMessageFormatForContentType(string contentType)
        {
            var type = this.ReturnType;
    
            if (type.FullName == "System.Void" || type.FullName == "RootName.Client.NewEntity")
                return WebContentFormat.Raw;
            else
                return WebContentFormat.Xml;
        }
    
        public Type ReturnType { get; set; }
    }
    

    Therefore, I had to pass the RestWebContentTypeMapper instance along with the OperationDescription around until it reached my custom IClientMessageFormatter. The following code was added to the SerializeRequest in order to pass the ReturnType.

    public Message SerializeRequest(MessageVersion messageVersion, object[] parameters)
    {
        this.Mapper.ReturnType = this.Description.SyncMethod.ReturnType;
    
        return Original.SerializeRequest(messageVersion, parameters);
    }
    

    The following working code will soon be posted to: http://dotnet37signals.codeplex.com.

    I know that now one responded but I hope this helps someone else.

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

Sidebar

Related Questions

Using Visual Studio 2010 when creating a wcf service the template creates a class
I'm creating a WCF service that transfers entity objects created via entity framework. I
I'm creating a WCF application where I'll be using certificates to encrypt the communication
Currently I am creating a WCF service which has to connect to a DAL
I was curious how anyone would go about creating WCF based services using a
I am having problems creating WCF client proxy for service code like in this
I am creating a WCF web service using wsHttpBinding and a corresponding application that
I am creating a webservice using Windows Communication Foundation (WCF) and I currently don't
I'm thinking of creating a generic message queue to handle various inter-process messages. (WCF
When creating a wcf class I used to do [DataContract] Public class Customer {

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.