I am new to web development and WCF. I am tasked to create a WCF application/service that can be accessed by other technologies as well. Thus I ended up with BasicHttpBinding. I will have a XML parameter. Here is my code:
<OperationContract()> _
<WebInvoke(Method:="POST", UriTemplate:="")> _
Function ReceiveMessage( _
ByVal input As Stream) _
As String
Public Function ReceiveMessage(ByVal input As System.IO.Stream) As String Implements IService.ReceiveMessage
Dim rssDS As New DataSet
Dim MsgStrHeader As String = ""
Dim sr As New System.IO.StreamReader(input)
rssDS.ReadXml(sr)
For Each RssRow As DataRow In rssDS.Tables(0).Rows
MsgStrHeader = RssRow.Item(0).ToString & " -- " & RssRow.Item(2).To开发者_运维百科String & " Unread Messages"
Next
Return MsgStrHeader
End Function
Any concrete example on how do I go about this? How do I test this one? Using a simple HTML page.
There is a problem sending an XML parameter over WCF.
The easy work around is to convert the XML document to a string.
See: Is there an issue sending XML via WCF?
精彩评论