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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:56:15+00:00 2026-05-13T12:56:15+00:00

I am currently working on a WCF application that consumes a Rails REST Service.

  • 0

I am currently working on a WCF application that consumes a Rails REST Service. The problem is when I do a update or remove request, Rails does not return XML, only the following header:

HTTP/1.1 200 OK
Date: Wed, 13 Jan 2010 13:56:25 GMT
Server: Apache/2.2.14 (Debian)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.7
X-Runtime: 20
Cache-Control: private, max-age=0, must-revalidate
Set-Cookie: _Shop-R+Server_session=BAh7BzoPc2Vzc2lvbl9pZCIlODY0NmZlZjQyZTg1OTcyNTE0ZTRlN2NkNTcyZDVmYTEiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIidDdXN0b21lciB3YXMgc3VjY2Vzc2Z1bGx5IHVwZGF0ZWQuBjoKQHVzZWR7BjsHRg%3D%3D--88d0f739a64ea3a92e3a034d73365393dcfeee1e; path=/; HttpOnly
Content-Length: 1
Status: 200
Content-Type: application/xml; charset=utf-8

This is to be expected and correct as far as I know. However when calling the following service request from WCF we get a ProtocolException (InnerException: XMLException Unexpected end of file).

    [ServiceContract]
    [XmlSerializerFormat]
    public interface ICustomerService
    {

        [OperationContract]
        [WebGet(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Xml, 
            UriTemplate = "customers/{id}.xml")]
        Customer GetCustomer(string id);

        [OperationContract]
        [WebInvoke(
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "customers/{id}.xml",
            Method = "PUT")]
        void UpdateCustomer(string id, Customer newCustomer);

        [OperationContract]
        [WebInvoke(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Xml,
            UriTemplate = "customers.xml",
            Method = "POST")]
        Customer CreateCustomer(Customer newCustomer);

        [OperationContract]
        [WebInvoke(
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "customers/{id}.xml",
            Method = "DELETE")]
        void DeleteCustomer(string id);

    }

The GetCustomer and CreateCustomer methods work without a problem, UpdateCustomer and DestroyCustomer throw the exception. We suspect this is because XML is expected as a response.

Does anybody have any experience with Rails and WCF and knows a solution/workaround for this problem?

For completeness here are the exception details:

ProtocolException {“There is a problem with the XML that was received from the network. See inner exception for more details.”}

XMLException (InnerException) {“Unexpected end of file.”}
StackTrace:

   at System.Xml.EncodingStreamWrapper.ProcessBuffer(Byte[] buffer, Int32 offset, Int32 count, Encoding encoding)
   at System.Xml.XmlUTF8TextReader.SetInput(Byte[] buffer, Int32 offset, Int32 count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
   at System.Xml.XmlDictionaryReader.CreateTextReader(Byte[] buffer, Int32 offset, Int32 count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
   at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.UTF8BufferedMessageData.TakeXmlReader()
   at System.ServiceModel.Channels.BufferedMessageData.GetMessageReader()
   at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
   at System.ServiceModel.Channels.WebMessageEncoderFactory.WebMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
   at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
  • 1 1 Answer
  • 1 View
  • 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-13T12:56:16+00:00Added an answer on May 13, 2026 at 12:56 pm

    I’ve already found it, thanks to “Darin Dimitrov” and “Nate Bross”. They were right that WCF expects XML when you set the content-type to application/xml. I’ve changed the content-type to text/plain (in rails) and it works.

    Change the following in your rails formatting:

    format.xml { head :ok }
    

    to

    format.xml { head :ok, :content_type => 'text/plain' }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are currently working on an application that will use a WCF service. The
I'm currently working on a WCF service that reaches out to another service to
I'm working on an ASP.NET application containing WCF services that is meant to act
I am currently working on a c# .NET desktop application that will be communicating
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I am working on an application where i am using a wcf service. I
Hi, I have a winform application that is hosting a WCF Service(NamedPipes). When reciving
I'm currently working in a dispatcher service that processes thousands of messages delivered in
I'm currently working on a web service implementation to a combined web/desktop application (ie.
In short, I am currently working on a research problem for my university that

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.