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).aspxBut 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