TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
info
NA
16
0
MessageHeader Methode WriteHeader
Mar 17 2011 4:49 AM
Hi,
I tried to add a custom Header to a client message:
Dim newMessage As Message = buffer.CreateMessage()
newMessage.Headers.RemoveAt(0)
Dim memStream As New MemoryStream()
Dim xdw As XmlDictionaryWriter = XmlDictionaryWriter.CreateBinaryWriter(memStream)
xdw.WriteStartElement("wsse", "Security",
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
)
xdw.WriteStartElement("wsc", "SecurityContextToken",
http://schemas.xmlsoap.org/ws/2005/02/sc
)
xdw.WriteStartElement("wsc", "Identifier",
http://schemas.xmlsoap.org/ws/2005/02/sc
)
xdw.WriteString("Mytext Entry")
xdw.WriteEndElement()
xdw.WriteEndElement()
xdw.WriteEndElement()
xdw.Flush()
Dim MyHeader As MessageHeader
MyHeader.WriteHeader(xdw, request.Version)
newMessage.Headers.Add(MyHeader)
request = newMessage
I got the Methode from a Microsoft page:
http://msdn.microsoft.com/en-us/library/ms195423(v=VS.90).aspx
But it is not working, it throws an exception: Object reference not set to an instance of an object.
at line: MyHeader.WriteHeader(xdw, request.Version)
When I used the
MessageHeader.CreateHeader("Name","","")
For both versions I am happy to get an answer for solving that problem
Lothar
I could not include Prefix for the Namespace
Reply
Answers (
8
)
Error in WCF Error “ does not implement interface member “ in Silverlight and ASP.Net Application
Reflecting changes when database update