Zend_Service_StrikeIron: Bundled Services

Zend_Service_StrikeIron: Advanced Uses

This section describes the more advanced uses of Zend_Service_StrikeIron.

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:

  1. span style="color: #ff0000;">'username' => 'your-username',
  2.                                                 'password' => 'your-password'));
  3.  
  4. // Get a generic client to the Reverse Phone Lookup service
  5. 'wsdl' => 'http://ws.strikeiron.com/ReversePhoneLookup?WSDL''Number' => '(408) 253-8800'// 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.

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():

  1. span style="color: #ff0000;">'username' => 'your-username',
  2.                                       'password' => 'your-password',
  3.                                       'options''trace'// Get a client for the Sales & Use Tax Basic service
  4. 'class' => 'SalesUseTaxBasic'));
  5.  
  6. // Perform a method call
  7. 'province' => 'ontario'));
  8.  
  9. // Get SOAPClient instance and view XML

Zend_Service_StrikeIron: Bundled Services