• Welcome to KonaKart Community Forum. Please login or sign up.
 

KonaKart API

Started by mik, September 15, 2007, 12:55:39 pm

Previous topic - Next topic

mik

Hello,

First of all, I have to say that you have made excellent  job with KonaKart. I like especially SOAP interface...
I am now working on it and I have a question regarding searchForProducts methods. Could someone explain how to use it ? I wrote something like this:

DataDescriptor dataDesc = new DataDescriptor();
dataDesc.setCustom1("test");
ProductSearch prodSearch = new ProductSearch();
Products products = port.searchForProducts(null, dataDesc, prodSearch, -1);

And this returns 0 products (I have modified custom info for one of the product with "test"?
How should I use this methods to collect all products described by  "test" in custom1 field?

Generally speaking, what is missing for me is some kind of tutorial about using SOAP and maybe you could add new category in forum, e.g. "KonaKart Programming" because I wasn't really sure where to send my question...

Best regards,
Mik

trevor

Hello Mik,

That's a good question.  Thanks.  (Thanks also for the suggestions of what you'd like to see).

I reproduced your test scenario and found I could retrieve the product with "test" in the custom1 attribute by using:

            DataDescriptor dataDesc = new DataDescriptor();
            dataDesc.setOffset(0);
            dataDesc.setLimit(100);
            dataDesc.setCustom1("test");

            ProductSearch prodSearch = new ProductSearch();
            prodSearch.setManufacturerId(-100);          // -100 == Search all
            prodSearch.setCategoryId(-100);                // -100 == Search all
            prodSearch.setSearchInSubCats(true);
            Products products = port.searchForProducts(null, dataDesc, prodSearch, -1);

            System.out.println(products.getTotalNumProducts() + " products found");

Without setting the extra values they assume inappropriate values after the SOAP request is deserialised.
If in doubt with the SOAP interface, try to populate more attributes in the interface objects rather than leaving them at default values.

When we get a chance,  we'll provide some better SOAP examples to make life easier in future.
I'll ask about the "KonaKart Programming" section of the forum next week.

Good luck,
Trevor.

mik

Thanks a lot Trevor.
It is sometimes quite hard to guess which fields have to be fulfilled with which values... ;)
Regs
Mik

trevor

That's a fair point Mik.  I think we will need to add some more examples and richer documentation.  Hopefully we will be able to do that very soon.   

For now, just ask questions on the forum if you encounter any uncertainties.

Trevor. 

trevor

Mik,

Not sure if you are aware of this, but there's an example of using the SOAP API in the API Examples FAQ at http://www.konakart.com/apiexamplesfaq.php#HowDoIUseKonaKartsSOAPWebServiceInterface

It includes a downloadable kit that includes a build file for creating the Axis clients and then running a very small example that demonstrates a few calls.   

You may have moved beyond this stage but I thought I'd mention it just in case - it's a good way to get started.

We will add more calls to this example in the near future - eg. the product search call.

Rgds,
Trevor

mik

Thanks Trevor,
Having in mind gold rule known as RTFM :) I had red it before I've started asking questions ;)
Rgds
Mik

trevor

Hi Mik,

Yes, I thought you probably had...   it's surprising how many people don't seem to bother..   :o

Let us know if you have any more problems or suggestions,

Trevor