Re: [SOAP] SOAP and MongoId
| From: | Nikolay Sukhikh | Date: | Wed, 26 Jun 2013 12:42:49 +0000 |
| Subject: | Re: [SOAP] SOAP and MongoId | ||
| References: | 1 2 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-3385@lists.php.net to get a copy of this message | ||
OK, but target function accepts complex object of any class and MongoId may be at any nesting level in the parameter object.
So should I recursively loop through parameter properties and convert all MongoIds to strings?
Then how I can convert that strings to MongoId on server side so target function to receive the object with MongoIds (or stdClass with $id property)?
Can the 'typemap' option of SoapClient/SoapServer help?
WSDL is auto-generated by Yii and currently knows nothing about MongoId, but I can control it.
<wsdl:message name="funcRequest">
<wsdl:part name="param" type="xsd:struct"/>
</wsdl:message>
On Wed, 26 Jun 2013 15:22:02 +0300, Justin Dearing <zippy1981@gmail.com> wrote:
Assuming you are writing the client and server, and both are in php, the service should probably take a string Use __tostring() to covert a mongoid to the hex string, which you can cover back with the mongoid constructor. If that's not the case, I can suggest workarounds based on what you can control. If you don't control the service, you should post the past of the wsdl defining what it's expecting for the mongoid. On Jun 26, 2013 8:01 AM, "Nikolay Sukhikh" <_mk_@ukr.net> wrote:I'm trying to pass function parameter of type MongoId through SoapClient. The problem is that MongoId objects have public property '$id' and SoapClient generates invalid XML for them: <param xsi:type="SOAP-ENC:Struct"><$**id xsi:type="xsd:string">**51ca25b506e4e9872800000a</$id>**</param> Is there any way to workaround this? -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- За використання клієнта електронної пошти Opera: http://www.opera.com/mail/