Introducción a Zend Framework

 Aprendiendo Zend Framework

Apéndice

 Referencia de Zend Framework


  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    63.31. Zend_Service_StrikeIron: Advanced Uses

    This section describes the more advanced uses of Zend_Service_StrikeIron.

    63.31.1. Using Services by WSDL

    Some StrikeIron services may have a PHP wrapper class available, such as those described in Bundled Services. However, StrikeIron offers hundreds of services and many of these may be usable even without creating a special wrapper class.

    To try a StrikeIron service that does not have a wrapper class available, give the wsdl option to getService() instead of the class option:

    $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
                                                    
    'password' => 'your-password'));

    // Get a generic client to the Reverse Phone Lookup service
    $phone $strikeIron->getService(
        array(
    'wsdl' => 'http://ws.strikeiron.com/ReversePhoneLookup?WSDL')
    );

    $result $phone->lookup(array('Number' => '(408) 253-8800'));
    echo 
    $result->listingName;

    // Zend Technologies USA Inc

    Using StrikeIron services from the WSDL will require at least some understanding of the WSDL files. StrikeIron has many resources on its site to help with this. Also, Jan Schneider from the Horde project has written a small PHP routine that will format a WSDL file into more readable HTML.

    Please note that only the services described in the Bundled Services section are officially supported.

    63.31.2. Viewing SOAP Transactions

    All communication with StrikeIron is done using the SOAP extension. It is sometimes useful to view the XML exchanged with StrikeIron for debug purposes.

    Every StrikeIron client (subclass of Zend_Service_StrikeIron_Base) contains a getSoapClient() method to return the underlying instance of SOAPClient used to communicate with StrikeIron.

    PHP' SOAPClient has a trace option that causes it to remember the XML exchanged during the last transaction. Zend_Service_StrikeIron does not enable the trace option by default but this can easily by changed by specifying the options that will be passed to the SOAPClient constructor.

    To view a SOAP transaction, call the getSoapClient() method to get the SOAPClient instance and then call the appropriate methods like __getLastRequest() and __getLastRequest():

    $strikeIron =
        new 
    Zend_Service_StrikeIron(array('username' => 'your-username',
                                          
    'password' => 'your-password',
                                          
    'options'  => array('trace' => true)));

    // Get a client for the Sales & Use Tax Basic service
    $taxBasic $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));

    // Perform a method call
    $taxBasic->getTaxRateCanada(array('province' => 'ontario'));

    // Get SOAPClient instance and view XML
    $soapClient $taxBasic->getSoapClient();
    echo 
    $soapClient->__getLastRequest();
    echo 
    $soapClient->__getLastResponse();
    digg delicious meneame google twitter technorati facebook

    Comentarios

    Loading...