Adding ext/xcom docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@326948 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
John Jawed 2012-08-02 18:56:18 +00:00
parent f3772d0a09
commit d955a8984d
18 changed files with 1234 additions and 0 deletions

View file

@ -224,6 +224,7 @@
<listitem><simpara><xref linkend="book.win32service"/></simpara></listitem>
<listitem><simpara><xref linkend="book.wincache"/></simpara></listitem>
<listitem><simpara><xref linkend="book.xattr"/></simpara></listitem>
<listitem><simpara><xref linkend="book.x-commerce"/></simpara></listitem>
<listitem><simpara><xref linkend="book.xdiff"/></simpara></listitem>
<listitem><simpara><xref linkend="book.xhprof"/></simpara></listitem>
<listitem><simpara><xref linkend="book.xml"/></simpara></listitem>
@ -454,6 +455,7 @@
<listitem><para><xref linkend="book.vpopmail"/></para></listitem>
<listitem><para><xref linkend="book.wddx"/></para></listitem>
<listitem><para><xref linkend="book.xattr"/></para></listitem>
<listitem><para><xref linkend="book.x-commerce"/></para></listitem>
<listitem><para><xref linkend="book.xdiff"/></para></listitem>
<listitem><para><xref linkend="book.xml"/></para></listitem>
<listitem><para><xref linkend="book.xmlreader"/></para></listitem>
@ -572,6 +574,7 @@
<listitem><para><xref linkend="book.win32service"/></para></listitem>
<listitem><para><xref linkend="book.wincache"/></para></listitem>
<listitem><para><xref linkend="book.xattr"/></para></listitem>
<listitem><para><xref linkend="book.x-commerce"/></para></listitem>
<listitem><para><xref linkend="book.xdiff"/></para></listitem>
<listitem><para><xref linkend="book.yaml"/></para></listitem>
<listitem><para><xref linkend="book.yaz"/></para></listitem>

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
"{PATH_TO_DOCBASE}/docbook/docbook-xml/docbook.dtd" [
<!-- $Revision$ -->
<!-- We use xhtml entities all over the place -->
<!ENTITY % xhtml-lat1 SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-lat1.ent">
<!ENTITY % xhtml-symbol SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-symbol.ent">
<!ENTITY % xhtml-special SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-special.ent">
<!ENTITY % isopub SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/isopub.ent">
%xhtml-lat1;
%xhtml-symbol;
%xhtml-special;
%isopub;
<!-- Fallback to English definitions and snippets (in case of missing translation) -->
<!ENTITY % language-defs.default SYSTEM "{PATH_TO_DOC}/language-defs.ent">
<!ENTITY % language-snippets.default SYSTEM "{PATH_TO_DOC}/language-snippets.ent">
<!ENTITY % extensions.default SYSTEM "{PATH_TO_DOC}/extensions.ent">
%language-defs.default;
%extensions.default;
%language-snippets.default;
<!-- All global entities for the XML files -->
<!ENTITY % global.entities SYSTEM "{PATH_TO_DOCBASE}/entities/global.ent">
<!-- These are language independent -->
<!ENTITY % frontpage.entities SYSTEM "{PATH_TO_DOC}/contributors.ent">
<!ENTITY % file.entities SYSTEM "{PATH_TO_DOCBASE}/entities/file-entities.ent">
<!-- Include all external DTD parts defined previously -->
%global.entities;
%file.entities;
%frontpage.entities;
]>
<book xml:id="book.x-commerce" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en">
<title>X.commerce</title>
<titleabbrev>X.commerce</titleabbrev>
<preface xml:id="intro.x-commerce">
&reftitle.intro;
<para>
</para>
</preface>
&reference.x-commerce.setup;
&reference.x-commerce.constants;
&reference.x-commerce.examples;
&reference.x-commerce.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.x-commerce" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>X.commerce</title>
<titleabbrev>X.commerce</titleabbrev>
<preface xml:id="intro.x-commerce">
&reftitle.intro;
<para>
This extension provides X.commerce bindings and avro helper methods.
<link xlink:href="&url.xcom;">X.commerce</link> provides developers
and merchants an ecosystem to build as well as utilize commerce API's built
by others. It supports multi-tenancy, asynchronous/synchronous calls,
and service onboarding.
</para>
</preface>
&reference.x-commerce.setup;
&reference.x-commerce.xcom;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="x-commerce.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
Use <option role="configure">--with-x-commerce[=DIR]</option> when compiling PHP.
</para>
<para>
Windows users should include <filename>php_x-commerce.dll</filename> into &php.ini;
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="x-commerce.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&no.constants;
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,8 @@
&reference.x-commerce.xcom.construct;
&reference.x-commerce.xcom.decode;
&reference.x-commerce.xcom.encode;
&reference.x-commerce.xcom.getdebugoutput;
&reference.x-commerce.xcom.getlastresponse;
&reference.x-commerce.xcom.getlastresponseinfo;
&reference.x-commerce.xcom.send;
&reference.x-commerce.xcom.sendasync;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="ref.x-commerce" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>X.commerce &Functions;</title>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="x-commerce.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<section xml:id="x-commerce.requirements">
&reftitle.required;
<para>
ext/xcom requires PHP 5.1 or newer.
</para>
<para>
ext/xcom requires libcurl (which must be built with HTTPS
support).
</para>
<para>
ext/xcom requires libavro (which comes bundled in the package
but the installation will prefer the system libavro if available).
</para>
</section>
<section xml:id="x-commerce.installation">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="&url.pear.package;xcom">&url.pear.package;xcom</link>
</para>
</section>
<section xml:id="x-commerce.configuration">
&reftitle.runtime;
&no.config;
</section>
<section xml:id="x-commerce.resources">
&reftitle.resources;
<para>
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!--
Do NOT translate this file
-->
<versions>
<!-- Methods -->
<function name='xcom::__construct' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::send' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::sendasync' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::encode' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::decode' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::getlastresponse' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::getlastresponseinfo' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::getdebugoutput' from='PHP 5 &gt;= Unknown'/>
<function name='xcom::__destruct' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::__clone' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::__construct' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::getmessage' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::getcode' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::getfile' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::getline' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::gettrace' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::getprevious' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::gettraceasstring' from='PHP 5 &gt;= Unknown'/>
<function name='xcomexception::__tostring' from='PHP 5 &gt;= Unknown'/>
</versions>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.xcom" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The Xcom class</title>
<titleabbrev>Xcom</titleabbrev>
<partintro>
<!-- {{{ Xcom intro -->
<section xml:id="xcom.intro">
&reftitle.intro;
<para>
</para>
</section>
<!-- }}} -->
<section xml:id="xcom.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>Xcom</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>Xcom</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Properties</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="xcom.props.debug">__debug</varname>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.xcom')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<section xml:id="xcom.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="xcom.props.debug">
<term><varname>__debug</varname></term>
<listitem>
<para>Set this to a non-FALSE value to enable debug mode</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</partintro>
&reference.x-commerce.entities.xcom;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 321901 $ -->
<refentry xml:id="xcom.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::__construct</refname>
<refpurpose>Create a new Xcom object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>Xcom::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>fabric_url</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>fabric_token</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>capability_token</parameter></methodparam>
</methodsynopsis>
<para>
Creates a new Xcom object
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fabric_url</parameter></term>
<listitem>
<para>
The fabric endpoint (<constant>XCOM_FABRIC_PRODUCTION</constant> for
production and <constant>XCOM_FABRIC_SANDBOX</constant> for sandbox).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fabric_token</parameter></term>
<listitem>
<para>
The fabric token provided to you, pass an empty string if you only send messages.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>capability_token</parameter></term>
<listitem>
<para>
The capability token, it is used when sending messages.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xcom.decode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::decode</refname>
<refpurpose>Decodes an avro-encoded message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>object</type><methodname>Xcom::decode</methodname>
<methodparam><type>string</type><parameter>avro_msg</parameter></methodparam>
<methodparam><type>string</type><parameter>json_schema</parameter></methodparam>
</methodsynopsis>
<para>
This method decodes an avro message.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>avro_message</parameter></term>
<listitem>
<para>
The binary avro message to be decoded.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>json_schema</parameter></term>
<listitem>
<para>
The avro JSON schema (avpr) to be used in decoding the message.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a <constant>stdClass</constant> object, or FALSE on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::decode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$xcom = new Xcom();
$xcom->decode($avro_payload, $schema);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Xcom::encode</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xcom.encode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::encode</refname>
<refpurpose>Encode an avro message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Xcom::encode</methodname>
<methodparam><type>stdClass</type><parameter>data</parameter></methodparam>
<methodparam><type>string</type><parameter>avro_schema</parameter></methodparam>
</methodsynopsis>
<para>
This method encodes a <constant>stdClass</constant> object to an
avro binary encoded blob.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
A <constant>stdClass</constant> compatible object to encode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>avro_schema</parameter></term>
<listitem>
<para>
The avro JSON schema to encode the <constant>data</constant> against.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an avro-encoded string or <constant>FALSE</constant> on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::encode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$data = new stdClass();
$data->orderID = "foo1234";
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$xcom = new Xcom();
$xcom->encode($data, $schema);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Xcom::decode</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xcom.getdebugoutput" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::getDebugOutput</refname>
<refpurpose>Get the debug output</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Xcom::getDebugOutput</methodname>
<void />
</methodsynopsis>
<para>
Get the full request/response headers and body from the previous
message (if <constant>Xcom::__debug</constant> was set to a
non-<constant>FALSE</constant> value before the
<methodname>Xcom::send</methodname>). This call does not work for
messages which are sent using <methodname>Xcom::sendAsync</methodname>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing request/response debug information.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::getDebugOutput</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$data = new stdClass();
$data->orderID = "123495585343";
$xcom = new Xcom(XCOM_FABRIC_SANDBOX, "fabric_token", "capability_token");
$xcom->send("/com.x.example.v1/OrderFulfillment/OrderShipped", $data, $schema);
echo "Debug output: " . $xcom->getDebugOutput();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xcom.getlastresponse" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::getLastResponse</refname>
<refpurpose>Get the last response body</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Xcom::getLastResponse</methodname>
<void />
</methodsynopsis>
<para>
Fetch the body of the last response. Mostly useful when debugging
error messages, often times the reason for a failure is documentated
in the response body (ie, Invalid Token, bad HTTP method, etc.)
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the last response.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::getLastResponse</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$data = 'foo';
$xcom = new Xcom(XCOM_FABRIC_SANDBOX, "fabric_token", "an_invalid_token");
$xcom->send("/com.x.example.v1/OrderFulfillment/OrderShipped", $data);
echo "I failed because: " . $xcom->getLastResponse();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xcom.getlastresponseinfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::getLastResponseInfo</refname>
<refpurpose>Gets the last response HTTP information</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>Xcom::getLastResponseInfo</methodname>
<void />
</methodsynopsis>
<para>
Get the last response information such as HTTP response code, latencies,
and redirect URL's.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array containing HTTP response information.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 300432 $ -->
<refentry xml:id="xcom.send" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::send</refname>
<refpurpose>Send a message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>Xcom::send</methodname>
<methodparam><type>string</type><parameter>topic</parameter></methodparam>
<methodparam><type>mixed</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>json_schema</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>http_headers</parameter></methodparam>
</methodsynopsis>
<para>
Send a message to a capability (API provider) for a topic.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
If <parameter>json_schema</parameter> is specified, the <parameter>data</parameter>
must be an object and is encoded as an avro-encoded message.
</para>
<para>
If <parameter>json_schema</parameter> is not specified, the <parameter>data</parameter>
will be converted to a string and sent.
</para>
<para>
<variablelist>
<varlistentry>
<term><parameter>topic</parameter></term>
<listitem>
<para>
The topic path (ie, /store/get/orders).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
The data to be sent.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>json_schema</parameter></term>
<listitem>
<para>
The avro JSON schema if <parameter>data</parameter> is an object,
if left empty there is no avro encoding.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>http_headers</parameter></term>
<listitem>
<para>
HTTP client headers (such as User-Agent, Accept, etc.)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the HTTP response code, or <constant>FALSE</constant> on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::send</function> example (avro)</title>
<programlisting role="php">
<![CDATA[
<?php
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$data = new stdClass();
$data->orderID = "123495585343";
$xcom = new Xcom(XCOM_FABRIC_SANDBOX, "fabric_token", "capability_token");
var_dump($xcom->send("/com.x.example.v1/OrderFulfillment/OrderShipped", $data, $schema));
/*
* Output:
* int(200)
*/
?>
]]>
</programlisting>
</example>
<example>
<title><function>Xcom::send</function> example (arbitrary payload)</title>
<programlisting role="php">
<![CDATA[
<?php
$xcom = new Xcom(XCOM_FABRIC_SANDBOX, "fabric_token", "capability_token");
var_dump($xcom->send("/get/profile", 'request-payload'));
/*
* Output:
* int(200)
*/
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Xcom::sendAsync</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 300432 $ -->
<refentry xml:id="xcom.sendasync" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Xcom::sendAsync</refname>
<refpurpose>Send a message asynchronously</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>Xcom::sendAsync</methodname>
<methodparam><type>string</type><parameter>topic</parameter></methodparam>
<methodparam><type>mixed</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>json_schema</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>http_headers</parameter></methodparam>
</methodsynopsis>
<para>
Send a message to a capability (API provider) for a topic asynchronously (using pthreads).
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
If <parameter>json_schema</parameter> is specified, the <parameter>data</parameter>
must be an object and is encoded as an avro-encoded message.
</para>
<para>
If <parameter>json_schema</parameter> is not specified, the <parameter>data</parameter>
will be converted to a string and sent.
</para>
<para>
<variablelist>
<varlistentry>
<term><parameter>topic</parameter></term>
<listitem>
<para>
The topic path (ie, /store/get/orders).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
The data to be sent.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>json_schema</parameter></term>
<listitem>
<para>
The avro JSON schema if <parameter>data</parameter> is an object,
if left empty there is no avro encoding.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>http_headers</parameter></term>
<listitem>
<para>
HTTP client headers (such as User-Agent, Accept, etc.)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <constant>0</constant>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Xcom::sendAsync</function> example (avro)</title>
<programlisting role="php">
<![CDATA[
<?php
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$data = new stdClass();
$data->orderID = "123495585343";
$xcom = new Xcom(XCOM_FABRIC_SANDBOX, "fabric_token", "capability_token");
$xcom->sendAsync("/com.x.example.v1/OrderFulfillment/OrderShipped", $data, $schema);
?>
]]>
</programlisting>
</example>
<example>
<title><function>Xcom::send</function> example (arbitrary payload)</title>
<programlisting role="php">
<![CDATA[
<?php
$xcom = new Xcom(XCOM_FABRIC_PRODUCTION, "fabric_token", "capability_token");
$xcom->sendAsync("/get/profile", 'request-payload');
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Xcom::send</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->