PDA

View Full Version : web services and nusoap



mobilebadboy
12-12-2009, 08:43 PM
I found an example for using nusoap to connect with allposters web services, and while people say they got it to work, I can't get mine to work. It returns alternating errors (not sure why, this is my first attempt in this area).

Either:

Result: 1 1 Value cannot be null. Parameter name: s

or

Result: 1 1 Object reference not set to an instance of an object.

Here's the code:



require_once('nusoap/lib/nusoap.php');

$WEBSITE_ID = 'XXXXXXX';
$category = '12911';
$pagenumber = '1';

$soapclient = new soapclient('http://webservice.allposters.com/ProductInformationService.asmx');
$soapclient->soap_defencoding = "UTF-8";
$soapclient->namespaces = array(
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsd' => 'http://www.w3.org/2001/XMLSchema',
'soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
);

$namespace = "http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService";
$soapAction = "http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService/GetProductsInCategoryInformation";

$xml = array("APCSearchXml"=>"<![CDATA[<APC_Search_Query>".
"<WebSiteID>".$WEBSITE_ID."</WebSiteID>".
"<CategoryID>".$category."</CategoryID>".
"<ProductsPerPage>12</ProductsPerPage>".
"<PageNumber>".$pagenumber."</PageNumber>".
"</APC_Search_Query>]]>"
);

//get the feed
$soapclient->charencoding = false; //important!
$response = $soapclient->call('GetProductsInCategoryInformation',$xml, $namespace, $soapAction,'','','rpc','literal');


I've got a ton of debug info, but it's too much to post.

The response I get is:



HTTP/1.1 200 OK
Connection: keep-alive
Date: Sun, 13 Dec 2009 03:38:05 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 802
Set-Cookie: NSC_XfcTfswjdf_80=44e629393660;path=/

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetProductsInCategoryInformationResponse xmlns="http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService"><GetProductsInCategoryInformationResult><APC_Search_Results>
<StatusCode>1</StatusCode>
<Search_Error>
<ErrorNumber>1</ErrorNumber>
<ErrorDescription>Object reference not set to an instance of an object.</ErrorDescription>
</Search_Error>
</APC_Search_Results></GetProductsInCategoryInformationResult></GetProductsInCategoryInformationResponse></soap:Body></soap:Envelope>


Any ideas?