Orchardcore xml rpc

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore xml rpc is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for enabling XML-RPC and MetaWeblog remote publishing in Orchard Core so desktop blogging clients can create and edit content. Covers the XML-RPC endpoint, the Remote Publishing (MetaWeblog) feature, supported MetaWeblog methods, the RSD discovery route for lists, content and media authorizati

How to use this skill

Skill file

Orchard Core XML-RPC - Prompt Templates

Enable Remote Publishing

You are an Orchard Core expert. Enable and configure XML-RPC / MetaWeblog so external client applications such as Open Live Writer can create and edit content remotely.

Guidelines

Enabling Remote Publishing

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.RemotePublishing"
      ],
      "disable": []
    }
  ]
}

Enabling OrchardCore.RemotePublishing implicitly enables OrchardCore.XmlRpc through its dependency.

Enabling Only the Core XML-RPC Feature

If you need the raw XML-RPC endpoint without the MetaWeblog API:

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.XmlRpc"
      ],
      "disable": []
    }
  ]
}

Endpoint Routing (from the module)

// Core XML-RPC feature.
routes.MapAreaControllerRoute(
    name: "XmlRpc",
    areaName: "OrchardCore.XmlRpc",
    pattern: "xmlrpc",
    defaults: new { controller = "Home", action = "Index" });

// Remote Publishing (MetaWeblog) feature.
routes.MapAreaControllerRoute(
    name: "MetaWeblog",
    areaName: "OrchardCore.XmlRpc",
    pattern: "xmlrpc/metaweblog",
    defaults: new { controller = "MetaWeblog", action = "Manifest" });

Reader / Writer Services

// Registered by OrchardCore.XmlRpc Startup.
services.AddScoped<IXmlRpcReader, XmlRpcReader>();
services.AddScoped<IXmlRpcWriter, XmlRpcWriter>();

Authorization of Remote Mutations

Extending Remote Publishing

Add MetaWeblog fields for your own part with a MetaWeblogDriver, and register it only when Remote Publishing is enabled:

using Microsoft.Extensions.DependencyInjection;
using OrchardCore.ContentManagement;
using OrchardCore.MetaWeblog;
using OrchardCore.Modules;
using OrchardCore.XmlRpc;
using OrchardCore.XmlRpc.Models;

namespace MyModule.RemotePublishing;

public sealed class SubtitleMetaWeblogDriver : MetaWeblogDriver
{
    public override void BuildPost(XRpcStruct rpcStruct, XmlRpcContext context, ContentItem contentItem)
    {
        var subtitle = (string)contentItem.Content.ArticlePart?.Subtitle?.Text;

        if (!string.IsNullOrEmpty(subtitle))
        {
            rpcStruct.Set("mt_excerpt", subtitle);
        }
    }

    public override void EditPost(XRpcStruct rpcStruct, ContentItem contentItem)
    {
        var excerpt = rpcStruct.Optional<string>("mt_excerpt");

        if (excerpt is not null)
        {
            contentItem.Content.ArticlePart.Subtitle.Text = excerpt;
        }
    }
}

[RequireFeatures("OrchardCore.RemotePublishing")]
public sealed class RemotePublishingStartup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddScoped<IMetaWeblogDriver, SubtitleMetaWeblogDriver>();
    }
}

For a new XML-RPC method set, implement IXmlRpcHandler (SetCapabilities(XElement) and ProcessAsync(XmlRpcContext); check context.RpcMethodCall.MethodName and set context.RpcMethodResponse) and register it with services.AddScoped<IXmlRpcHandler, MyHandler>().

Configuring a Blogging Client (Open Live Writer)

  1. Enable the Remote Publishing feature.
  2. In the client, add a new account and choose the MetaWeblog API.
  3. Point the endpoint at https://your-site/xmlrpc/metaweblog.
  4. Sign in as a user who can create and publish the relevant content type.

The MetaWeblog API supports the typical operations blogging clients need: retrieving recent posts, creating and editing posts, and uploading media.

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.