PDA

View Full Version : getProductList SOAP Request


Adrian
21-06-07, 12:10
Hi Everyone,

Just to get you started in our new forum! WELCOME :D


==============================================

Below is a capture of a typical PS_API SOAP communication, for the function getProductList()

(Please note that there's no newlines in the actual stream, but have been added here for readability's sake)


Request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.productserve.com/">
<SOAP-ENV:Header>
<ns1:UserAuthentication SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://api.productserve.com/">
<ns1:iId>45628</ns1:iId>
<ns1:sPassword>16c19db29b4fd0eb</ns1:sPassword>
<ns1:sType>affiliate</ns1:sType>
</ns1:UserAuthentication>
<ns1:getQuota SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://api.productserve.com/">true</ns1:getQuota>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:getProductList>
<ns1:iCategoryId>550</ns1:iCategoryId>
<ns1:iLimit>5</ns1:iLimit>
<ns1:iOffset>0</ns1:iOffset>
<ns1:bIncludeDescendants>true</ns1:bIncludeDescendants>
</ns1:getProductList>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



Response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.productserve.com/">
<SOAP-ENV:Body>
<ns1:getProductListResponse>
<ns1:getProductListReturn>
<ns1:Product>
<ns1:iId>12485995</ns1:iId>
<ns1:iMerchantId>1256</ns1:iMerchantId>
<ns1:sMerchantProductId>97718A79FR</ns1:sMerchantProductId>
<ns1:iUpc>0</ns1:iUpc>
<ns1:iEan>0</ns1:iEan>
<ns1:iIsbn>0</ns1:iIsbn>
<ns1:sName>BD-R Blu-Ray Media ( 25GB Blu-ray BD-R )</ns1:sName>
<ns1:sDesc>Write-once Blu-ray disc with up to unprecedented 50GB capacity
2x speed recording (72Mbit per second)
Newly developed Durabis2 coating protects disc surface from scratches, fingerprints and smudges
More than 4 hours of recording time of HDTV footage (50GB)
Highest compatibility with any BD hardware in the market
Inorganic recording layer material for long lasting quality Available in singles 25GB (order code A79FR) and 50GB (order code A80FR)</ns1:sDesc>
<ns1:sBrand>TDK</ns1:sBrand>
<ns1:iCategoryId>550</ns1:iCategoryId>
<ns1:sAwDeepLink>http://www.maplin.co.uk/Module.aspx?ModuleNo=97718&amp;C=AffilWin45628&amp;T=_1248 5995&amp;platform=cs</ns1:sAwDeepLink>
<ns1:sAwThumbUrl>http://images.productserve.com/thumb/1256/12485995.jpg</ns1:sAwThumbUrl>
<ns1:sAwImageUrl>http://images.productserve.com/preview/1256/12485995.jpg</ns1:sAwImageUrl>
<ns1:sCurrency>GBP</ns1:sCurrency>
<ns1:fSearchPrice>15.99</ns1:fSearchPrice>
<ns1:fRrpPrice>0</ns1:fRrpPrice>
<ns1:sDisplayPrice>GBP15.99</ns1:sDisplayPrice>
</ns1:Product>
</ns1:getProductListReturn>
<ns1:iLimit>5</ns1:iLimit>
<ns1:iOffset>0</ns1:iOffset>
<ns1:iReturnCount>5</ns1:iReturnCount>
<ns1:iTotalCount>9</ns1:iTotalCount>
</ns1:getProductListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

================================================


Adrian
Integration & Technical Support

adrian.botelho@affiliatewindow.com
www.affiliatewindow.com

Andy
30-06-07, 10:51
In all honesty Adrian, Amo, Kostas and the rest of the Digi win team, you expect more of us than you should. I mean it in the nicest possible way, I'm quite flattered that you think we understand all this SOAP stuff.

Granted, Ive been PHPin' for a number of years, can html with my eyes shut, css with my hands tied behind my back even javascript a little. But SOAP?

Not a scooby doo lads!!

I just don't get it.

I don't even understand the style of PHP ShopWindow has been written in! The only fact I know about it is that the word "hungarian" figures somewhere in the equation.

I just messed until I found the variables I wanted to use, then used them my way.

Now, what would be nice is if there was some sort of tutorial for dummies, or even better a training day or two........................:D

I think the affiliates have made ShopWindow do things DigiWin hadn't even dreamed of yet, think what we could achieve if we actually knew what you were talking about!

xlcus
30-06-07, 12:28
To be honest, you don't need to know anything about SOAP really. Just download the simple API client they provide...

http://www.affiliatewindow.com/downloads/api.client.zip

Then take a look at the ps_client.php file inside that zip. It's a very simple (and I mean very simple) example of how to use the API. They have a one line example for each type of API request you can make, and you can uncomment each one, one by one, to see how it works and the type of responses you get.

You don't really have to understand how SOAP works to use it... You can take that simple ps_client.php file and expand on it as a start to creating your own site.

Andy
30-06-07, 20:32
Downloaded it, couldn't make head nor tail of it.

How are you supposed to run it? where does it display results?

Seemed to me like it's just an engine without anyway of starting it up

and to be honest again, I'd quite like to understand it all, I just don't know where to start understanding it. The documentation is abit sketchy to say the least.
I found my way around shopwindow by reverse engineering the smarty templates, and finding the php equivalent variables. But i wanna know how it connects to another server and I'd quite like to know what the other server does with the requests, what can WE do to cut down calls yet maximise output, can we create custom calls etc.

At the moment, scooby doo is getting in my way.

xlcus
01-07-07, 14:47
How are you supposed to run it? where does it display results?

Unzip the file somewhere on your webserver, then point your web browser at the ps_client.php file.

So for example, you might create a "temp" folder in the root of your website, then point your browser at... http://yourdomainname/temp/ps_client.php

The results of the test program will be shown in your browser. If you scroll to the bottom of the page, you can see the data from the API call all nicely wrapped up in a PHP object for you.

Ajax2000
02-07-07, 10:40
The basic tool is excellent but just that; Basic. It would not really be fair to expect AW to provide a worldclass platform and support it or else every affiliate would be opening an AW shop!

It reminds me of when eBay was cloned by EveryAuction - We all had an auction site (I sold mine to Freeserve) but everyone in EA forums wanted the perfect code or add-ons to be an eBay mirror. Some of us managed it using the PERL modules and whilst EA is not my bag anymore my Bid History script is still used by eBay!

If you have any extensive PHP knowledge then using the files mentioned would be straight forward enough to develop your own GUI based on the API - Nice to be individual and then apply things like Cache techniques etc to your platform.

The other problem with an all singing/dancing solution would be that there are 100's of Hosting solutions all with different PHP settings or Linux to Windows etc - Most people on 1&1 for example are running PHP4 by default - That is an Apache default not 1&1 - But there are a number of solutions to resolve this, some technical some easy from .htaccess to just renaming...

If your not comfortable with SOAP (Very standard tool these days, used by platforms such as Venda.com) then use the SW code and tweak the CSS and PHP to make it real 'purty' :p

iannai
11-07-07, 12:45
In order to return any results, my submission was as follows (this is in classic ASP / VB Script)

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.productserve.com/">
<SOAP-ENV:Header>
<ns1:UserAuthentication SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://api.productserve.com/">
<ns1:iId>id</ns1:iId>
<ns1:sPassword>mypass36</ns1:sPassword>
<ns1:sType>affiliate</ns1:sType>
</ns1:UserAuthentication>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:getProductList>
<ns1:iCategoryId>550</ns1:iCategoryId>
<ns1:aMerchantIds></ns1:aMerchantIds>
<ns1:sRefineByPairs></ns1:sRefineByPairs>
<ns1:sSort>az</ns1:sSort>
<ns1:iLimit>15</ns1:iLimit>
<ns1:iOffset>0</ns1:iOffset>
<ns1:bIncludeDescendants>true</ns1:bIncludeDescendants>
</ns1:getProductList>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Otherwise, I got an empty <getProductListRetrurn/> element.
In order to get results, I need to include all the possible parameters, and default sSort to az

Tobias
29-09-08, 17:22
The API seems quite straight foward, but while working with it many obvious things turns up not being so obvious. Eg.:



// refine by category (golf)
$aRefineByVals = array(4 => 259);

$aActiveRefineBy = array();
foreach($aRefineByVals as $iGroupId => $sVal)
{
// create definition first
$oRefineByDefinition = new stdClass();
$oRefineByDefinition->sId = $sVal;
$oRefineByDefinition->sName = '';

// add to group
$oRefineByGroup = new stdClass();
$oRefineByGroup->iId = $iGroupId;
$oRefineByGroup->sName = '';
$oRefineByGroup->aRefineByDefinitions = array($oRefineByDefinition);
array_push($aActiveRefineBy, $oRefineByGroup);
}

$oClient = ClientFactory::getClient(API_USERNAME, API_PASSWORD, API_USER_TYPE);
$oResponse = $oClient->call('getProductList', array(
'sQuery' => '',
'bAdult' => false,
'bHotPick' => false,
'bIncludeTree' => false,
'sSort' => 'relevancy',
'iOffset' => 0,
'iLimit' => 20,
'oActiveRefineByGroup' => $aActiveRefineBy
));



The above code totally ignore category filter but do not output any errors, the Object $aActiveRefineBy seems been created with correct structure so I have no idea why this do not work?

morsborn
23-11-08, 16:39
Hi, was this ever solved? i have the same problem and cannot find the solutons.

Thanks