Serializing objects for transportation over SOAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there ,

I have a quick question for the group on PEAR:SOAP which you might be able to help me with.

I have a library of custom DataMapper objects which I access through static calls.

e.g.
================================
$invoiceCollection = InvoiceCollectionMapper::FindForDate('20060504');
================================

I want to use these Mappers on a couple of other sites thru a webservice.

In order to transport these object instances over SOAP, I've serialized them at the server end, and unserialized them on the client end.

To look after this serialization, I created a wrapper around my InvoiceCollectionMapper :

=================================
class SOAP_InvoiceCollectionMapper
{
  function FindForDate($aDate)
  {
    $result = InvoiceCollectionMapper::FindForDate($aDate);
    return serialize($result);
  }
}
==================================

My server looks like so:

==================================
$server = new SOAP_Server();
$soapInvoiceCollectionMapper = new SOAP_InvoiceCollectionMapper();
$server->addObjectMap($soapInvoiceCollectionMapper,'urn:soapInvoiceCollectionMapper');
==================================

This is working fine! BUT.....

I have a lot a datamappers, any they contain new methods all the time. Having create a new wrapper for each of them, and each new methods is a pain in the chops.

Which brings me to my question..... Is it possible to have PEAR::SOAP do this serialization and unserialization in the PEARSERVER and PEARCLIENT objects?

e.g..
$server->SerializeEnvelopeContents(true);

Perhaps there is already functionality to handle this in the library already, that would be ace!

Otherwise, would anyone have any suggestions on how to handle this elegantly?

Thanks for your help!

Kind Regards,

Karl Glennon

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux