Link to home
Start Free TrialLog in
Avatar of axnst2
axnst2Flag for United States of America

asked on

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.'

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!
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What binding are you using with the WCF web service?  

Did you try to update the service reference after adding IsReference = true?
Avatar of axnst2

ASKER

'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
I saw something about using wsHttpBinding, instead of BasicHttpBinding.  Was there a reason for using basic binding?
Avatar of axnst2

ASKER

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial