Hi all,
I am trying to access the MSN Search API with SOAP. Passing the same
array of parameters to the PHP SOAP Extension and NuSoap produces
different results. The PHP SOAP seem to be broken, while NuSoap works.
<?php // common code -- the array of search parameters
$request = array('Request' => array('AppID' => 'MSN_SEARCH_API_KEY',
'Query' => 'Seinfeld', 'CultureInfo' => 'en-US', 'SafeSearch' =>
'Strict', 'Flags' => '', 'Location' => '', 'Requests' => array
('SourceRequest' => array('Source' => 'Web', 'Offset' => 0, 'Count'
=> 50, 'ResultFields' => 'All'))));
?>
<?php // 1. PHP 5 Soap extension
$soapClient = new SoapClient("http://soap.search.msn.com/
webservices.asmx?wsdl");
$return = $soapClient->Search($s);
print_r($return);
?>
<?php // 2. NuSoap
$client = new soapclient("http://soap.search.msn.com/webservices.asmx?
wsdl", false);
$result = $client->call("Search", $s);
print_r($result);
?>
Despite passing the same arguments, the 1st returns 10 results while
the 2nd returns 50 results as it should. I ran a TCP packet sniffer
and noticed the PHP Soap extension isn't sending my request for 50
results. Actually the requests are quite different. Here is what is
being sent:
PHP SOAP EXTENSION:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://schemas.microsoft.com/MSNSearch/2005/09/
fex"><SOAP-
ENV:Body><ns1:Search><ns1:Request><ns1:AppID>MSN_SEARCH_API_KEY</
ns1:AppID><ns1:Query>Seinfeld</ns1:Query><ns1:CultureInfo>en-US</
ns1:CultureInfo><ns1:SafeSearch>Strict</ns1:SafeSearch><ns1:Flags/
><ns1:Location/><ns1:Requests><ns1:SourceRequest/><ns1:SourceRequest/
><ns1:SourceRequest/><ns1:SourceRequest/></ns1:Requests></
ns1:Request></ns1:Search></SOAP-ENV:Body></SOAP-ENV:Envelope>
NUSOAP:
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://
schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns6589:Search
xmlns:ns6589="http://tempuri.org"><Request><AppID
xsi:type="xsd:string">MSN_SEARCH_API_KEY</AppID><Query
xsi:type="xsd:string">Seinfeld</Query><CultureInfo
xsi:type="xsd:string">en-US</CultureInfo><SafeSearch
xsi:type="xsd:string">Strict</SafeSearch><Flags
xsi:type="xsd:string"></Flags><Location xsi:type="xsd:string"></
Location><Requests><SourceRequest><Source xsi:type="xsd:string">Web</
Source><Offset xsi:type="xsd:int">0</Offset><Count
xsi:type="xsd:int">50</Count><ResultFields xsi:type="xsd:string">All</
ResultFields></SourceRequest></Requests></Request></ns6589:Search></
SOAP-ENV:Body></SOAP-ENV:Envelope>
Any idea why these would be so different and why the PHP Soap
extension doesn't seem to be working? (I wonder if this is related
to Moritz Augustin's question about deeply nested arguments not
working.)
Thanks,
Richard Miller
--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php