[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

WFC Contract in separate assembly

Posted on 2009-04-24
6
Medium Priority
?
1,874 Views
Last Modified: 2013-11-10
When I move my data contract member to a new assembly I get the following error:

Unable to deserialize XML body with root name 'NotificationRequest' and root namespace '' (for operation 'SendNotification' and contract ('NotificationService',  'http://tempuri.org/')) using DataContractSerializer. Ensure that the type corresponding to the XML is added to the known types collection of the service.

I have already changed the assembly tag in my service, but it still does not work.  I am exhausted and have tried everything:

<Assembly: ContractNamespace("", ClrNamespace:="sb.api.notification")>

Here is a link to the code:
http://smartweber.com/wcf.zip
0
Comment
Question by:o1mattweber
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24232229
Ok. I'm not sure if this is the answer, because I'm still a noob with WCF, but I made some changes and I got the wsdl page to show (which I assume means it works). If this is not correct, please let me know. I also created a test project I made which uses the service. I received the hard-coded message when I tested.

Please don't ask to explain what the issue was, because I honestly don't know. I just "trial-and-error" 'ed it :)

http://www.geocities.com/kaufmed2/wcf.zip
http://www.geocities.com/kaufmed2/WindowsFormsApplication1.zip
0
 

Author Comment

by:o1mattweber
ID: 24232751
The error actually occurs when you try to POST to the service, not when you build. I am using Fiddler to do that.  It was a POX service.  I am not sure if your changes work because the way you reconfigured it appear to have made it a SOAP service.  I need it to be a plain xml service on HTTP-POST.  I am not sure how to edit he web.config file to do that.  The only way I know how is the way it was... I am a noob as well.

I really appreciate you taking the time to look into it though.  Unfortunately, it has not yet lead to a resolution of the problem.  
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24232768
Can you try changing the binding in the web.config to:

<endpoint address="" binding="webHttpBinding" contract="sb.api.notification.NotificationService">

If that binding doesn't work, there is a list of other binding types here:

http://msdn.microsoft.com/en-us/library/ms730879.aspx

Perhaps one of those will work.
0
Cyber Threats to Small Businesses (Part 1)

This past May, Webroot surveyed more than 600 IT decision-makers at medium-sized companies to see how these small businesses perceived new threats facing their organizations.  Read what Webroot CISO, Gary Hayslip, has to say about the survey in part 1 of this 2-part blog series.

 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1000 total points
ID: 24232784
Here is a tutorial on endpoints that may be of interest to you.

http://pluralsight-free.s3.amazonaws.com/screencasts/wmv/configuring-services-with-endpoints.wmv
0
 

Author Comment

by:o1mattweber
ID: 24232808
I will look into the endpoint.  However, I do not want to get side tracked.  The solution was working as POX just fine.   The issue was having the classes in a different assembly and they could not be serialized.  Let me mess around with and I'll post the results.

I think this has something to do with the REST Starter Kit and it may be a bug.  This is an odd issue I just found.  If I add a class to the root of my project it works fine.  However, if I add it to a sub folder the project cannot detect that class and namespace.   Also, everything seems to be getting cached.  When I build the project  nothing changes in the browser.  I found there is a file called "sb.gpState" and when I delete it everything seems to work better for a while until that file comes back.

I may just create a new solution and try again.  I will get back to you. Thanks again.  
0
 

Accepted Solution

by:
o1mattweber earned 0 total points
ID: 24234549
I found the solution to the problem.

1.)  The main issue was that the datacontact needs to have a namespace attribute (even if you are not using it).  This is only true when your datacontract in a different assembly.

e.g.  <DataContract(Namespace:="")> _

2.)  The other little bugs I found had to do with the REST Starter Kit.  I created a new solution and did it all from scratch and I did not have any of the odd caching issues.
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Loops Section Overview
Suggested Courses

830 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