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,644 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now