note 95175 added to soapclient.soapcall

From: Date: Wed, 16 Dec 2009 20:59:17 +0000
Subject: note 95175 added to soapclient.soapcall
Groups: php.notes 
Request: Send a blank email to php-notes+get-164055@lists.php.net to get a copy of this message
If you find yourself needing to consume entire datatables from .NET there are two quick ways to do this. If you are writing the web services yourself there is a very handy trick to return a datatable as a schema-less XML document. Create a new module file in .NET with this code - Imports System.Xml Module PHPDatatable Public Function parse(ByVal dt As DataTable) Dim xmlstream As New StringBuilder Dim write As XmlWriter = XmlWriter.Create(xmlstream) write.WriteProcessingInstruction("xml", "version='1.0' encoding='utf-8'") dt.WriteXml(write) Return xmlstream.ToString() End Function End Module To use it (where MyTable is the datatable we are using.......) return PHPDatatable.parse(MyTable) 'your return type will need to be a STRING. Back in PHP, after you have made your SOAP call and have the results you can use SimpleXML to parse out the datatable into an array of objects like so (where $soap are my soap results.......) <?php $datatable = simplexml_load_string($soap->myfunctionResult); ?> In the unfortunate situation where you have no choice but to consume a full-blown datatable (ie: you aren't writing the web services yourself) I have a basic SOAP client available on Codeplex that can parse .NET datatables into an array of objects. http://superdotnet.codeplex.com/ Both methods are fairly simply to implement, and should save you the headache of mapping out your datatables to prebaked .NET objects and manually setting each value. ---- Server IP: 192.41.40.227 Probable Submitter: 216.201.124.166 ---- Manual Page -- http://www.php.net/manual/en/soapclient.soapcall.php Edit -- https://master.php.net/note/edit/95175 Del: integrated -- https://master.php.net/note/delete/95175/integrated Del: useless -- https://master.php.net/note/delete/95175/useless Del: bad code -- https://master.php.net/note/delete/95175/bad+code Del: spam -- https://master.php.net/note/delete/95175/spam Del: non-english -- https://master.php.net/note/delete/95175/non-english Del: in docs -- https://master.php.net/note/delete/95175/in+docs Del: other reasons-- https://master.php.net/note/delete/95175 Reject -- https://master.php.net/note/reject/95175 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164055) next »