Class Mappings

Table of Contents

WSDL Data Type Mappings

In addition to primitive data types (such as integers or strings) Recite web services uses a number of custom data types. Each custom type that is used is specified in the WSDL of the web service that uses it. In order to make use of these custom types we must map the type to a local PHP class.

For example, if you call the getPage() method of the pages web service, according to the WSDL the type returned is Module_Pages_Webservies_Page. In order to easily make use of the data included in this data type, we create a local PHP to map this class.

Fortunately, the bundled class does this for us automatically. In this particular example, we have a PHP class called Recite_Pages_Page (located in ./Recite/Pages/Page.php). When we use the Recite_Webservices::factory('pages') call to use the pages web service it will automatically create the mapping between the PHP class and the custom type in the WSDL.

Class mapping does not only correspond to data returned from web services; many of the methods in Recite web services accept complex types as arguments to the function call. For example, the pages method getPage() accepts an instance of Module_Pages_Webservices_Options_GetPages. The bundled client automatically maps this to the local class Recite_Pages_Options_GetPages.

Here's an example of using the mapped classes:

Example 2.1. Using Mapped Classes

<?php
    require_once('Recite/Webservices.php');

    // ... set the end point and authentication

    // create the SOAP client
    $client = Recite_Webservices::Factory('pages');

    // build the options for the getPages() call
    $options = new Recite_Pages_Options_GetPages();

    // retrieve the pages, an array of Recite_Pages_Page
    $pages = $client->getPages($options);
?>

You don't even need to reference the type name as it appears in the WSDL file. You will however need to know which class to use based on the mappings.

WSDL Data Type Mappings

WSDL Data TypeMapped PHP Class Name
Module_Assets_Webservices_Options_GetFilesRecite_Assets_Options_GetFiles
Module_Assets_Webservices_FileRecite_Assets_File
Module_Assets_Webservices_GetFilesResultRecite_Assets_GetFilesResult
Module_Webservices_Auth_AuthenticateRequestRecite_Auth_AuthenticateRequest
Module_Webservices_Auth_AuthenticateResponseRecite_Auth_AuthenticateResponse
Module_Calendar_Webservices_Event_ListRecite_Calendar_Event_List
Module_Calendar_Webservices_Event_TypeRecite_Calendar_Event_Type
Module_Calendar_Webservices_Options_GetCalendarsRecite_Calendar_Options_GetCalendars
Module_Calendar_Webservices_Options_GetEventsRecite_Calendar_Options_GetEvents
Module_Calendar_Webservices_CalendarRecite_Calendar_Calendar
Module_Calendar_Webservices_CategoryRecite_Calendar_Category
Module_Calendar_Webservices_DateRangeRecite_Calendar_DateRange
Module_Calendar_Webservices_EventRecite_Calendar_Event
Module_Ecommerce_Webservices_Options_GetCategoriesRecite_Ecommerce_Options_GetCategories
Module_Ecommerce_Webservices_Options_GetProductsRecite_Ecommerce_Options_GetProducts
Module_Ecommerce_Webservices_Product_TypeRecite_Ecommerce_Product_Type
Module_Ecommerce_Webservices_CategoryRecite_Ecommerce_Category
Module_Ecommerce_Webservices_GetProductsResultRecite_Ecommerce_GetProductsResult
Module_Ecommerce_Webservices_ProductRecite_Ecommerce_Product
Module_Forms_Webservices_Element_ContainerRecite_Forms_Element_Container
Module_Forms_Webservices_FieldListRecite_Forms_FieldList
Module_Forms_Webservices_FieldList_FieldRecite_Forms_FieldList_Field
Module_Forms_Webservices_Processor_OptionsRecite_Forms_Processor_Options
Module_Forms_Webservices_ElementRecite_Forms_Element
Module_Forms_Webservices_ErrorRecite_Forms_Error
Module_Forms_Webservices_FormRecite_Forms_Form
Module_Forms_Webservices_ResponseRecite_Forms_Response
Module_Listings_Webservices_Listing_TypeRecite_Listings_Listing_Type
Module_Listings_Webservices_Options_GetCategoriesRecite_Listings_Options_GetCategories
Module_Listings_Webservices_Options_GetListingsRecite_Listings_Options_GetListings
Module_Listings_Webservices_CategoryRecite_Listings_Category
Module_Listings_Webservices_GetListingsResultRecite_Listings_GetListingsResult
Module_Listings_Webservices_ListingRecite_Listings_Listing
Module_Pages_Webservices_Options_GetPagesRecite_Pages_Options_GetPages
Module_Pages_Webservices_PageRecite_Pages_Page
Module_Search_Webservices_Options_SearchRecite_Search_Options_Search
Module_Search_Webservices_SearchResultRecite_Search_SearchResult
Module_Search_Webservices_SearchResult_ItemRecite_Search_SearchResult_Item
Module_Search_Webservices_SearchIndexRecite_Search_SearchIndex
Module_Templates_Webservices_Options_GetTemplatesRecite_Templates_Options_GetTemplates
Module_Templates_Webservices_TemplateRecite_Templates_Template
Module_Users_Webservices_Options_GetUsersRecite_Users_Options_GetUsers
Module_Users_Webservices_User_DirectoryRecite_Users_User_Directory
Module_Users_Webservices_GetUsersResultRecite_Users_GetUsersResult
Module_Users_Webservices_UserRecite_Users_User
Module_Webservices_Types_ContentBlockRecite_Webservices_Types_ContentBlock
Module_Webservices_Types_PagerRecite_Webservices_Types_Pager