0

This is the code i have so far (no i didn't write it all by my self took help from net) but i am unable to understand why i am getting this error

    Imports CookComputing.XmlRpc

Public Structure blogInfo
    Public title As String
    Public description As String
End Structure


<XmlRpcUrl("http://127.0.0.1/wordpress/xmlrpc.php")> _
Class MsnSpacesMetaWeblog
    Inherits XmlRpcClientProtocol


    <XmlRpcMethod("metaWeblog.newPost")> _
    Function NewPage(ByVal blogID As Integer, ByVal strUserName As String, ByVal strPassword As String, ByVal content As blogInfo, ByVal publish As Integer) As String

        Return CStr(Me.Invoke("newPost", New Object() {blogID, strUserName, strPassword, content, publish}))
    End Function

End Class

Public Class Form1

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim mw As MsnSpacesMetaWeblog = New MsnSpacesMetaWeblog

        Dim newBlogPost As blogInfo
        newBlogPost.title = TextBox1.Text
        newBlogPost.description = TextBox2.Text

        Try
            Dim id As String = mw.NewPage(1, "******", "******", newBlogPost, 1)

            MsgBox("Posted to Blog successfullly! Post ID : " + id)
            TextBox1.Text = ""
            TextBox2.Text = ""
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

error i get is "Invoke on Non-Existent or Non-public proxy method"

I would really appreciate it if someone can explain what i am doing wrong

Thnaks

1
  • are you sure you can't just write the post into the mysql database? that's been working for me fairly easily. Sep 18, 2011 at 3:29

1 Answer 1

0
Imports CookComputing.XmlRpcde

Public Class frmMain 'Form name/class  Form1 is the default.
    Public Structure category
        Public categoryId As Object
        Public parentId As Object
        Public description As Object
        Public categoryName As Object
        Public htmlUrl As Object
        Public rssUrl As Object
    End Structure
 <XmlRpcUrl("http://somesite.info/xmlrpc.php")> _
    Public Interface IWP
        Inherits IXmlRpcProxy

        <XmlRpcMethod("wp.getCategories")> _
        Function getCategories(ByVal args() As String) As category()
    End Interface
    Public Structure blogInfo
        Public title As String
        Public description As String
    End Structure

    Public Interface IgetCatList
        <CookComputing.XmlRpc.XmlRpcMethod("metaWeblog.newPost")> _
        Function NewPage(ByVal blogId As Integer, ByVal strUserName As String, ByVal strPassword As String, ByVal content As blogInfo, ByVal publish As Integer) As String
    End Interface
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
        Dim args() As String = {"http://somesite.info", _
                                  "AdminUserName", "Password"}
        Dim categories() As category
        categories = proxy.getCategories(args)
        For Each category In categories
            Debug.Print(category.categoryId)
            Debug.Print(category.categoryName)
            Debug.Print(category.description)
            Debug.Print(category.htmlUrl)
            Debug.Print(category.rssUrl)
        Next

    End Sub

    Private Sub btnPost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPost.Click
        Dim newBlogPost As blogInfo = Nothing
        newBlogPost.title = "The Title"
        newBlogPost.description = "The Post Body Text"
        Dim categories = CType(XmlRpcProxyGen.Create(GetType(IgetCatList)), IgetCatList)
        Dim clientProtocol = CType(categories, XmlRpcClientProtocol)
        clientProtocol.Url = "http://yoursite.com/xmlrpc.php"
        Dim result As String = Nothing
        result = ""
        Try
            result = categories.NewPage(1, "AdminUserName", "password", newBlogPost, 1)
            MessageBox.Show("Posted to Blog successfullly! Post ID : " & result)
            txtpost.Text = ""
            txtTitle.Text = ""
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.