Home  |  Linux  | Mysql  | PHP  | XML
From:Peter Beckman Date:Tue Jul 29 16:33:59 2008
Subject:PHP SOAP, ADODB, MySQL and BigInt problem
I have bigints in my MySQL DB (full international-style phone numbers, such
as 12125004000).  I want to return these via a SOAP API I'm working on.

My public soap API PHP file is just this:

     require 'api_pub_soap.class.inc';

     $server = new SoapServer("pubapi.wsdl");
     $server->setClass('pubapisoap');
     $server->handle();

Class pubapisoap extends my pubapi class, so that I can do REST or other
methods for accessing and responding to API requests.

It seems that even if I specify xsd:string in the WSDL for the response,
the item is somehow strongly typed by SOMETHING.  Maybe SOAP, maybe ADODB,
but I'm not sure how to untype it.  I love how simple my API implementation
is, and I don't want to get it all complex by skipping the setClass piece
and have to redo everything.

I've even tried to typecast those two fields back to a string before
returning the values in the base class, but with no luck.  What am I doing
wrong?

Here's the request and response:

     <SOAP-ENV:Body>
         <m:extensionGet xmlns:m="pubapi.wsdl">
             <apikey xsi:type="xsd:string">md5hash</apikey>
             <extensionid xsi:type="xsd:int">1</extensionid>
             <did xsi:type="xsd:string"></did>
             <extension xsi:type="xsd:int"></extension>
         </m:extensionGet>
     </SOAP-ENV:Body>

     <SOAP-ENV:Body>
         <ns1:extensionGetResponse xmlns:ns2="pubapi.wsdl" xmlns:ns1="">
             <extensionList SOAP-ENC:arrayType="ns2:Extension[1]" xsi:type="ns2:ExtensionArray">
                 <item xsi:type="ns2:Extension">
                     <extensionid xsi:type="xsd:int">1</extensionid>
                     <did xsi:type="xsd:int">2147483647</did>
                     <forward xsi:type="xsd:int">2147483647</forward>
                     <added xsi:type="xsd:int">1136219788</added>
                     <startdate xsi:type="xsd:int">1136219788</startdate>
                     <enddate xsi:type="xsd:int">1151501937</enddate>
                     <alias xsi:type="xsd:string"></alias>
                     <extension xsi:type="xsd:int">0</extension>
                     <extensionLength xsi:type="xsd:int">0</extensionLength>
                 </item>
             </extensionList>
         </ns1:extensionGetResponse>
     </SOAP-ENV:Body>

The WSDL relevant:

     <xsd:complexType name="Extension">
         <xsd:all>
             <xsd:element name="extensionid" type="xsd:int"/>
             <xsd:element name="did" type="xsd:string"/>
             <xsd:element name="forward" type="xsd:string" />
             <xsd:element name="added" type="xsd:int" />
             <xsd:element name="startdate" type="xsd:int" />
             <xsd:element name="enddate" type="xsd:int" />
             <xsd:element name="alias" type="xsd:string" />
             <xsd:element name="extension" type="xsd:int" />
             <xsd:element name="extensionLength" type="xsd:int" />
         </xsd:all>
     </xsd:complexType>
     <xsd:complexType name="ExtensionArray">
         <xsd:complexContent>
             <xsd:restriction base="SOAP-ENC:Array">
                 <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Extension[]"/>
             </xsd:restriction>
         </xsd:complexContent>
     </xsd:complexType>

     <message name="extensionGetRequest">
         <part name="apikey" type="xsd:string" />
         <part name="extensionid" type="xsd:int" />
         <part name="did" type="xsd:string" />
         <part name="extension" type="xsd:int" />
     </message>
     <message name="extensionGetResponse">
         <part name="extensionList" type="tns:ExtensionArray" />
     </message>

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman@angryox.com                                 http://www.angryox.com/
---------------------------------------------------------------------------
Navigate in group php.soap at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants