Solved

Missing reference??

Posted on 2011-02-12
3
2,038 Views
Last Modified: 2012-05-11
I've got a C# web service that uses the "XmlDictionaryWriter" object as shown in the code below.  Using the object explorer I can see this is part of "System.XML".  But niether including the reference nor explicit declaration can find the namespace.

This gets extra strange because I have a second project which uses the same exact class, and "XmlDictionaryWriter" IS found.  What is going on here?  One reference is stopping my build.
using System;
using System.ServiceModel.Channels;
using System.Xml;

namespace Batch
{
    public class SampleHeader : MessageHeader
    {
        private string name;
        private string value;

        public SampleHeader(string name, string value)
        {
            this.name = name;
            this.value = value;
        }

        public override string Name { get { return name; } }
        public override string Namespace { get { return "http://monkey.sample.com/doc/2007-01-01/"; } }

        protected override void OnWriteHeaderContents(XmlDictionaryWriter xmlDictionaryWriter, MessageVersion messageVersion)
        {
            xmlDictionaryWriter.WriteString(value);
        }
    }
}

Open in new window

0
Comment
Question by:Phil5780
3 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 34880192
Hi,

Do you have

using System.Xml.XmlDictionaryWriter;

defined in your using section?
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34880211
@BurnieP

XmlDictionaryWriter is a class, not a namespace   = )

You need to add a reference to System.Runtime.Serialization. The namespace is still System.Xml though.
0
 

Author Closing Comment

by:Phil5780
ID: 34880375
Solved by recreating my project as an ASP.NET website and not a WSDL project.  It appears XMLDictionaryWriter is not available in a web service project.  (No new references added)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
C# Export DataGridView 4 39
Pass through dll 2 37
How do I bind the results to a grid 3 24
Re-position the objects 7 51
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

27 Experts available now in Live!

Get 1:1 Help Now