The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 08, 2009, 12:17:37 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Using XMLRPC from Vb.Net?  (Read 767 times)
imred
Rookie
**
Offline Offline

Posts: 26


View Profile
« on: March 07, 2008, 01:32:02 PM »

Hey guys,

I am just stuck on this one...  I created a way to post content to my blogs from vb.net without issue using XML-RPC.   However, the problem is that I cannot get it to go to a particular category nor utilize tagging Sad

Anyone have any code to do this?  Here is my code for posting to Wordpress:

---------------------------------------------------------------------------
<XmlRpcUrl("http://www.myblogurlgoeshere.com/xmlrpc.php")> _
    Public Interface IWP
        Inherits IXmlRpcProxy

        <XmlRpcMethod("blogger.newPost")> _
         Function newPost(ByVal args() As String) As Integer
    End Interface


In a button-click event (eventually on a timer):

        Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
        Dim args() As String = {"", "", "{usernamehere}", "{passwordhere}", {postcontenthere}, "publish"}
        errorreturn = proxy.newPost(args)

---------------------------------------------------------------------------


Any ideas on how I can get Category and Tags into the mix on this???  Also I am looking for one other thing if anyone has some code they can lend Smiley

I need to take content and replace words using a synonym database... I can figure it out myself, but would prefer to have some good code to start with Smiley

Thanks in advance!
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Online Online

Posts: 679



View Profile
« Reply #1 on: March 07, 2008, 02:06:03 PM »

The beauty of XMLRPC is that it is whatever you tell it to be. Check the docs of WP's XMLRPC, I went through this same headache a while ago. The answer is yes, if WP allows you to choose category and tagging.

I will check some of my docs from when I was banging my head against the wall with this and let you know what I find. I was doing mine in PHP, but an XMLRPC packet is an XMLRPC packet is an XMLRPC packet.
Logged

vsloathe
vim ftw!
Global Moderator
Lifer
*****
Online Online

Posts: 679



View Profile
« Reply #2 on: March 07, 2008, 02:12:01 PM »

Ok, looks like what I did was this:

Inside your "post content" field, you can use tags to specify the category, etc.

This is how I was doing it in PHP:

Code:
<?php
$client 
= new xmlrpc_client($xmlrpcurl);
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval($username);            //your wordpress login
$params[] = new xmlrpcval($password);        //your wordpress password
$params[] = new xmlrpcval(
"<title>Title</title>".            //the title of your post
"<category>Category</category>".    //the category
$body);                                 //the body
$params[] = new xmlrpcval("true");          //publish now = true
?>

Logged

DangerMouse
Expert
****
Offline Offline

Posts: 177



View Profile
« Reply #3 on: March 07, 2008, 02:19:26 PM »

Wordpress supports Blogger, MetaWeblog and MovableType (I think) APIs, so if you concentrate your search there you should be able to find out the correc xmlrpc methods and the correct structure for your xml.

I'm pretty sure there is a way to call some kind of reflection command on the Wordpress xmlrpc.php file aswell, this will detail all the xmlrpc methods supported, but I don't recall where I saw that sorry.

DM
Logged
imred
Rookie
**
Offline Offline

Posts: 26


View Profile
« Reply #4 on: March 07, 2008, 02:22:00 PM »

I think I am seeing the problem...

I decided to use Cook Computing's XMLRPC wrapper... Because of this, I am allowing them to create the XML packet.  And, since this is the case, I am having a difficult time sending over different information.

I'll have to re-think this approach and possibly use an alternative method with vb.net.

thanks guys!  That DID help.
Logged
imred
Rookie
**
Offline Offline

Posts: 26


View Profile
« Reply #5 on: March 07, 2008, 02:24:29 PM »

Wordpress supports Blogger, MetaWeblog and MovableType (I think) APIs, so if you concentrate your search there you should be able to find out the correc xmlrpc methods and the correct structure for your xml.

I'm pretty sure there is a way to call some kind of reflection command on the Wordpress xmlrpc.php file aswell, this will detail all the xmlrpc methods supported, but I don't recall where I saw that sorry.

DM

I did look, pretty heavily into that file (xmlrpc.php).  In fact, I went so far as to change it around to more easily send my own timestamp (to allow post-dating and dating for earlier posts) as well as Titles. 

I think I know it pretty good, it's just the way it extracts everything... and since I wasn't creating the XML myself, I really didn't think about it Smiley  Now that I am thinking about it, I can see the command which extracts the categories out of the XML in the functions php file.

Logged
imred
Rookie
**
Offline Offline

Posts: 26


View Profile
« Reply #6 on: March 07, 2008, 03:26:47 PM »

ok, I got it (at least adding a title and putting it into a category).

Using the Blogger API for new post, you have to have:

<category>3</category>

instead of the actual name of the category Sad

Logged
DangerMouse
Expert
****
Offline Offline

Posts: 177



View Profile
« Reply #7 on: March 07, 2008, 04:58:42 PM »

I believe theres a method from the blogger api that will allow you to return all the available categories, so it should be possible to grab the number from that rather than having to know it before hand.

DM
Logged
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #8 on: March 07, 2008, 05:32:52 PM »

actually if you hit the mt_keywords method in the rpc it will just add what you send as tags. not categories, but then again, you dont have to dick with the stupid categories silliness that goes on in there, as you discovered. tags are good enough imo.
Logged
imred
Rookie
**
Offline Offline

Posts: 26


View Profile
« Reply #9 on: March 07, 2008, 06:25:06 PM »

Thanks Dangermouse - yes, there is the categories piece that I am using, but it brings back the category name Smiley  That was why I had such problems - I thought I was doing it right!  Shocked

Nutballs - that sounds like a good idea.  I get more out of tagging than categories anyway.  Thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!