Solved

DataContract(IsReference=true) causes 'Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.'

Posted on 2014-01-05
6
1,731 Views
Last Modified: 2014-02-21
Hi Experts,

I have a WCF (BasicHTTPBinding) web service (hosted in a Windows Service) that I need to use to deliver an array of self referencing (circular reference, kind of like a linked-list with parent and children) objects.  When I try to transfer this via the web service, I get errors on the array.  I traced this error back to the fact that the objects in the array have "circular reference" and that I need to put the [DataContract(IsReference=true)] in front of my class to overcome the issue.  However, when I do that, I get the blow error:

'Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.'

I do not get the error if I only have '[DataContract]' in fron of the class.  BTW, the service has dozens of other functions that are/have been working just fine.

PLEASE HELP!  THIS IS URGENT!!!!!

Thanks!
0
Comment
Question by:axnst2
  • 4
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39759232
What binding are you using with the WCF web service?  

Did you try to update the service reference after adding IsReference = true?
0
 

Author Comment

by:axnst2
ID: 39759262
'I have a WCF (BasicHTTPBinding) web service (hosted in a Windows Service) ' - Is this what you're asking?

'Did you try to update the service reference after adding IsReference = true?' - Yes, and that's when I get the error.  I use NetCFSvcUtil to generate the signitures
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39759414
I saw something about using wsHttpBinding, instead of BasicHttpBinding.  Was there a reason for using basic binding?
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:axnst2
ID: 39759428
Yes, I saw that too.  I didn't create the original service, but I think it was set to BasicHttpBinding becasue the web Service service is accessed from a Windows Mobile device, and therofore, the Compact Framework (from the client side that is).  Either way changing it to wsHttpBinding resulted in the same error.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39759689
Are you able to use an HTTP debugger, like Fiddler, to see what the response really is?

I am trying to find a reference to the configuration issue, so we can find a resolution.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39759708
According to this article the only difference is additional XML attributes:

 <Employee z:Id=“i1“ xmlns:z=“http://schemas.microsoft.com/2003/10/Serialization/“>

                  <Manager i:nil=“true“ />  

                  <Name>Kenny</Name>

            </Employee>
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will show you how to add an attribute to an XML (http://en.wikipedia.org/wiki/XML) stream returned from a Windows Communication Foundation (http://en.wikipedia.org/wiki/Windows_Communication_Foundation) (WCF) Web Service.  Some knowled…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question