php5's native SOAP: What I've learned

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

 



I've spent a lot of the past week struggling to get php5 talking to a MS
SQLXML SOAP service.  I'm happy to report that I've been successful, but
it wasn't easy, that's for sure.  Not surprising, given the youth of
both the technology and the implementations.  But I thought I'd post
what I've learned in the hopes that it might help someone else.  I'll
focus on the php5 side, since that's the purpose of this list.  So
please don't think that everything on the SQLXML side went smoothly; it
didn't.  But that's content for another list.

1) PHP5 does not like nested xsd:schema's in the WSDL.  SQLXML expresses
the SqlRowSet result element with the following:

  <xsd:complexType name='SqlRowSet'>
          <xsd:sequence>
            <xsd:element ref='xsd:schema'/>
            <xsd:any/>
          </xsd:sequence>
          <xsd:attribute ref='sqltypes:IsNested'/>
        </xsd:complexType>

...php5 hates that ref='xsd:schema'.  I'm not enough of an XML guy to
understand why, but the simple solution is just removing that element
from the WSDL and not using the SqlRowSet return type.

2) PHP5 sometimes just drops the HTTP connection during execution if the
SOAP results it gets are bizarre.  This causes most browsers to quietly
redisplay the previous page.   In my case, a SQL permissions problem
prevented SQLXML from running the stored procedure.  SQLXML gave a
malformed SOAP response, and PHP5 just barfed (no exception, just a
close on the TCP connection).  This made it look like I was getting the
same results over and over.  Solution: when debugging, add a timestamp
to the output so you can tell if it's fresh.

3) Depending on the format of the SOAP response, you can't always get to
the data you want.  Or at least, I couldn't figure out how.  A var_dump
on the $result of a $client->method didn't show deeply nested XML
objects, including the actual data I was after with the SOAP request.
All's not lost, though -- in cases like this, just nab the
SoapClient::__getLastResponse regexp out the XML nodes that you want.

Anyways, kudos to those who have put the work in to making SOAP native
to PHP rather than an add-on.  It's a wise decision, and I'm sure it
will pay off in the long run.  In the short run, hopefully my brief
notes will help someone else who's struggling with similar issues.

Cheers
-b

-- 
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