{
    "content": [
        {
            "type": "text",
            "text": "# Frontier::RPC2 (perldoc)\n\n## NAME\n\nFrontier::RPC2 - encode/decode RPC2 format XML\n\n## SYNOPSIS\n\nuse Frontier::RPC2;\n$coder = Frontier::RPC2->new;\n$xmlstring = $coder->encodecall($method, @args);\n$xmlstring = $coder->encoderesponse($result);\n$xmlstring = $coder->encodefault($code, $message);\n$call = $coder->decode($xmlstring);\n$responsexml = $coder->serve($requestxml, $methods);\n$booleanobject = $coder->boolean($boolean);\n$datetimeobject = $coder->datetime($datetime);\n$base64object = $coder->base64($base64);\n$intobject = $coder->int(42);\n$floatobject = $coder->float(3.14159);\n$stringobject = $coder->string(\"Foo\");\n\n## DESCRIPTION\n\n*Frontier::RPC2* encodes and decodes XML RPC calls.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **SEE ALSO** (1 subsections)\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Frontier::RPC2",
        "section": "",
        "mode": "perldoc",
        "summary": "Frontier::RPC2 - encode/decode RPC2 format XML",
        "synopsis": "use Frontier::RPC2;\n$coder = Frontier::RPC2->new;\n$xmlstring = $coder->encodecall($method, @args);\n$xmlstring = $coder->encoderesponse($result);\n$xmlstring = $coder->encodefault($code, $message);\n$call = $coder->decode($xmlstring);\n$responsexml = $coder->serve($requestxml, $methods);\n$booleanobject = $coder->boolean($boolean);\n$datetimeobject = $coder->datetime($datetime);\n$base64object = $coder->base64($base64);\n$intobject = $coder->int(42);\n$floatobject = $coder->float(3.14159);\n$stringobject = $coder->string(\"Foo\");",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 74,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "perl",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Frontier::RPC2 - encode/decode RPC2 format XML\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Frontier::RPC2;\n\n$coder = Frontier::RPC2->new;\n\n$xmlstring = $coder->encodecall($method, @args);\n$xmlstring = $coder->encoderesponse($result);\n$xmlstring = $coder->encodefault($code, $message);\n\n$call = $coder->decode($xmlstring);\n\n$responsexml = $coder->serve($requestxml, $methods);\n\n$booleanobject = $coder->boolean($boolean);\n$datetimeobject = $coder->datetime($datetime);\n$base64object = $coder->base64($base64);\n$intobject = $coder->int(42);\n$floatobject = $coder->float(3.14159);\n$stringobject = $coder->string(\"Foo\");\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "*Frontier::RPC2* encodes and decodes XML RPC calls.\n\n$coder = Frontier::RPC2->new( *OPTIONS* )\nCreate a new encoder/decoder. The following option is supported:\n\nencoding\nThe XML encoding to be specified in the XML declaration of encoded RPC requests or\nresponses. Decoded results may have a different encoding specified; XML::Parser will\nconvert decoded data to UTF-8. The default encoding is none, which uses XML 1.0's\ndefault of UTF-8. For example:\n\n$server = Frontier::RPC2->new( 'encoding' => 'ISO-8859-1' );\n\nuseobjects\nIf set to a non-zero value will convert incoming <i4>, <float>, and <string> values to\nobjects instead of scalars. See int(), float(), and string() below for more details.\n\n$xmlstring = $coder->encodecall($method, @args)\n`\"encodecall\"' converts a method name and it's arguments into an RPC2 `\"methodCall\"'\nelement, returning the XML fragment.\n\n$xmlstring = $coder->encoderesponse($result)\n`\"encoderesponse\"' converts the return value of a procedure into an RPC2 `\"methodResponse\"'\nelement containing the result, returning the XML fragment.\n\n$xmlstring = $coder->encodefault($code, $message)\n`\"encodefault\"' converts a fault code and message into an RPC2 `\"methodResponse\"' element\ncontaining a `\"fault\"' element, returning the XML fragment.\n\n$call = $coder->decode($xmlstring)\n`\"decode\"' converts an XML string containing an RPC2 `\"methodCall\"' or `\"methodResponse\"'\nelement into a hash containing three members, `\"type\"', `\"value\"', and `\"methodname\"'.\n`\"type\"' is one of `\"call\"', `\"response\"', or `\"fault\"'. `\"value\"' is array containing the\nparameters or result of the RPC. For a `\"call\"' type, `\"value\"' contains call's parameters\nand `\"methodname\"' contains the method being called. For a `\"response\"' type, the `\"value\"'\narray contains call's result. For a `\"fault\"' type, the `\"value\"' array contains a hash with\nthe two members `\"faultCode\"' and `\"faultMessage\"'.\n\n$responsexml = $coder->serve($requestxml, $methods)\n`\"serve\"' decodes `$requestxml', looks up the called method name in the `$methods' hash and\ncalls it, and then encodes and returns the response as XML.\n\n$booleanobject = $coder->boolean($boolean);\n$datetimeobject = $coder->datetime($datetime);\n$base64object = $coder->base64($base64);\nThese methods create and return XML-RPC-specific datatypes that can be passed to the\nencoder. The decoder may also return these datatypes. The corresponding package names (for\nuse with `\"ref()\"', for example) are `\"Frontier::RPC2::Boolean\"',\n`\"Frontier::RPC2::DateTime::ISO8601\"', and `\"Frontier::RPC2::Base64\"'.\n\nYou can change and retrieve the value of boolean, date/time, and base64 data using the\n`\"value\"' method of those objects, i.e.:\n\n$boolean = $booleanobject->value;\n\n$booleanobject->value(1);\n\nNote: `\"base64()\"' does *not* encode or decode base64 data for you, you must use\nMIME::Base64 or similar module for that.\n\n$intobject = $coder->int(42);\n$floatobject = $coder->float(3.14159);\n$stringobject = $coder->string(\"Foo\");\nBy default, you may pass ordinary Perl values (scalars) to be encoded. RPC2 automatically\nconverts them to XML-RPC types if they look like an integer, float, or as a string. This\nassumption causes problems when you want to pass a string that looks like \"0096\", RPC2 will\nconvert that to an <i4> because it looks like an integer. With these methods, you could now\ncreate a string object like this:\n\n$partnum = $coder->string(\"0096\");\n\nand be confident that it will be passed as an XML-RPC string. You can change and retrieve\nvalues from objects using value() as described above.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "perl",
                        "content": "<http://www.scripting.com/frontier5/xml/code/rpc.html>\n"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Ken MacLeod <ken@bitsko.slc.ut.us>\n",
                "subsections": []
            }
        }
    }
}