开发者

WCF 'BasicHttpBinding' with a XML Parameter

开发者 https://www.devze.com 2022-12-11 00:30 出处:网络
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 parame

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消