1

这是我到目前为止的代码,但我不明白为什么会收到此错误(错误 400)。

我认为问题在于参数过滤器的格式。有人有什么建议吗?

Imports CookComputing.XmlRpc

Public Class Form2

    <XmlRpcUrl("http://example.wordpress.org/xmlrpc.php")> _
    Public Interface IWP
        Inherits IXmlRpcProxy

        <XmlRpcMethod("wp.getPosts")> _
        Function getPosts(ByVal args() As String) As Post()

    End Interface

    Public Structure Post
        Public post_id As String
        Public post_title As String
        Public post_type As String
        '...
    End Structure

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
        Dim args() As String = {"blog_id", "user", "password", "post_type='page'"}
        Dim posts() As Post
        Try
            posts = proxy.getPosts(args)
            For Each post In posts
                ListBox1.Items.Add(post.post_title)
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

End Class
4

0 回答 0