Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
1,899 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
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.

 

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 1500 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…
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 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