4Suite API Documentation

Module Ft.Server.Server.Xslt.XmlRpcClient

XSLT extensions allowing limited access to external XML-RPC servers
Copyright 2004 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:
Globals:

Classes

class XmlRpcInvokeElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
Invoke an XML-RPC server at a remote URI (Requires Python 2.2 or above) There are 5 attributes, p1, p2... which are used for the positional arguments to the remote method [this will be made less kludgy soon] Each one is an expression which follows the following conversion rules from the XPath data model:
    string -> string
    number -> floating-point number
    boolean -> boolean
    node set -> array of strings

You can also coerce the value to a certain type by using an attribute
of the form t1, t2,... corresponding to the pN attribute with one of the
following string values:

INT
DOUBLE
STRING
BOOLEAN

The return value is converted into an XML fragment representation,
which is sent to output.

    string -> <String>[value]</String>
    floating-point number -> <Double>[value]</Double>
    boolean -> boolean <Boolean>["true" or "false"]</Boolean>
    array -> <Array>[sequence of child elements as above, according to array elements]</Array>

An example of an array:

    <Array>
      <String>a string</String>
      <Float>123.4</Float>
      <Int>1234</Int>
      <String>another string</String>
    </Array>

This means that in order to access a remote method

obj.spam('eggs', 3)

On a remote server at

http://spam.com/xmlrpcserver

And save the result of XSLT variable "monty",
you can use the following XSLT snippet:

<xsl:variable name="monty">
  <futil:xml-rpc-invoke uri="http://spam.com/xmlrpcserver"
                        method="obj.spam"
                        p1="'eggs'"
                        p2="3" t2="INT"/>
</xsl:variable>

No type coercion is used for p1 because XSLT string are generally
unambiguous in converting to XML-RPC.  However, the second param
could be integer or double, so it is coerced (default is double).

Beware that if an array is returned, you might need to use
the exslt:node-set function to convert from result tree fragment
to node set.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

Members

content = <Ft.Xml.Xslt.ContentInfo.Atom instance>
legalAttrs = {'method': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'p1': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p2': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p3': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p4': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'p5': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 't1': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 't2': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 't3': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 't4': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, ...}

Members inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

category, validator

Members inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

attributes, baseUri, children, columnNumber, doesIdle, doesPrime, doesSetup, expandedName, importIndex, lineNumber, nodeName, parent, root

Functions

WriteXmlRpcResults(processor, results)

Globals

CONVERTERS_FROM_XSLT = {None: None, 'BOOLEAN': <function <lambda>>, 'DOUBLE': <type 'float'>, 'INT': <type 'int'>, 'STRING': <type 'str'>}
ExtElements = {('http://xmlns.4suite.org/4ss/util', 'xml-rpc-invoke'): <class Ft.Server.Server.Xslt.XmlRpcClient.XmlRpcInvokeElement>}
ExtFunctions = {}
UTIL_NS = 'http://xmlns.4suite.org/4ss/util'