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,770 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In previous Articles, we have discussed how we can upload a file using .asmx web service and isolated storage space. Here, in continuation to the topic, I am going to discuss how we can use WCF for the same purpose. Steps: 1.Create the silverli…
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…

734 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