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

Get back customers using soap

Started by CyrilTempleux, December 22, 2011, 09:51:27 am

Previous topic - Next topic

CyrilTempleux

Hi there, I want to list all the customers from my website. I used java_soap_exemples to make a simple program that uses KKWSEng to get informations from a distant server (which contains the kk app & db, ofc), using soap. This works well, I can retrieve almost everything I want from this distant server, except a simple list of registred customers.

I don't see a getAllCustomers() function or something similar, is that normal ? What is the reason of that ? How can I do this ?

Thanks

ryan

You can't use the App Engine to get a list of all customers. You need to use the Admin engine for that.

CyrilTempleux

Merry christmas to all.

I tried using KKWSAdmin by just replacing KKWSEng, and doing everything like your exemple. Here's what I tried :


KKWSAdminIfServiceLocator kkwsaisl = new KKWSAdminIfServiceLocator();
kkwsaisl.setKKWSAdminEndpointAddress("http://XX.XX.XX.XX:XXXX/konakartadmin/services/KKWSAdmin");
kkwsaisl.setEndpointAddress("KKWSAdmin", "http://XX.XX.XX.XX:XXXX/konakartadmin/services/KKWSAdmin");

KKWSAdminIf kkWSAdmin = kkwsaisl.getKKWSAdmin();

String session_id = kkWSAdmin.login(DEFAULT_USERNAME, DEFAULT_PASSWORD);


But then I got this :


Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Failure trying to get the Call object; nested exception is:
java.lang.NoClassDefFoundError: com/workingdogs/village/DataSetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:FR-LIL-D00009

Failure trying to get the Call object; nested exception is:
java.lang.NoClassDefFoundError: com/workingdogs/village/DataSetException
at com.konakartadmin.ws.KKWSAdminSoapBindingStub.createCall(KKWSAdminSoapBindingStub.java:7654)
at com.konakartadmin.ws.KKWSAdminSoapBindingStub.login(KKWSAdminSoapBindingStub.java:11922)
at batch.files.ImportClients.main(ImportClients.java:44)
Caused by: java.lang.NoClassDefFoundError: com/workingdogs/village/DataSetException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.apache.axis.utils.JavaUtils.isEnumClassSub(JavaUtils.java:1073)
at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1063)
at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerializerFactory.java:49)
at org.apache.axis.encoding.ser.BeanSerializerFactory.<init>(BeanSerializerFactory.java:42)
at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(BaseSerializerFactory.java:235)
at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315)
at com.konakartadmin.ws.KKWSAdminSoapBindingStub.createCall(KKWSAdminSoapBindingStub.java:7639)
... 2 more
Caused by: java.lang.ClassNotFoundException: com.workingdogs.village.DataSetException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more


What's workingdogs ? Is that a local error or is there something I should do on the distant server ?

Thanks

kate

You'll find life a lot easier if you create an engine using code like this:

(see "C:\Program Files\KonaKart\java_api_examples\src\com\konakartadmin\apiexamples\BaseApiExample.java")

KKAdminEngineMgr kkAdminEngMgr = new KKAdminEngineMgr();
AdminEngineConfig adEngConf = new AdminEngineConfig();
adEngConf.setMode(engineMode);
adEngConf.setPropertiesFileName(DEFAULT_KONAKARTADMIN_PROPS_FILENAME);
adEngConf.setAxisClientFileName(DEFAULT_KONAKART_AXIS_CLIENT_PROPS_FILENAME);
adEngConf.setStoreId(storeId);
adEngConf.setCustomersShared(custShared);
adEngConf.setProductsShared(prodShared);
adEngConf.setProperties(properties);

/*
  * This creates a KonaKart Admin Engine by name using the constructor that requires an
  * AdminEngineConfig object. This is the recommended approach.
  */
setEng(kkAdminEngMgr.getKKAdminByName(engineClass, adEngConf));



-Merry Christmas :-)

CyrilTempleux

Well, I tried to use the java_api_examples, and while I was importing all the required libraries, I realised that it solved problems of my first attempt. So I guess there was just more libraries required.

But I had to download different .jar than konakart jars in /lib, such as an older version of wss4j (1.5.1, instead of 1.6).

Anyway this works fine. Thank you very much.

kate


QuoteBut I had to download different .jar than konakart jars in /lib, such as an older version of wss4j (1.5.1, instead of 1.6).


For others reading this I just want to point out that there should be no need to change the wsdl4j-1.5.1.jar (if this is the jar you mean) and no need for any additional jars in order to compile or run.   The default installation will use the provided jars to create client stubs successfully from the WSDL.   If you use the provided build.xml and follow the User Guide it should work fine.

Hence I don't know what you're referring to Cyril or what is different about your environment.

Perhaps you are referring to a different jar?   You mention wss4j but we don't include that with KonaKart anyway.


Note again that the recommended approach is to use the KKWSEng engine rather than creating AXIS client stubs from the WSDL and writing your own AXIS client-side code because in a java environment it's significantly easier just to instantiate KKWSEng which implements KKEngIf (just like the KKEng POJO engine does) and takes care of all the SOAP plumbing for you automatically.
 
Indeed, the idea is that you write your client side code against the KKEngIf (the "storefront" engine interface) and then later you can decide which implementation to use with your client-side code (selecting from POJO, RMI, SOAP or JSON by name at runtime).   If you write your own AXIS code you cannot benefit from this flexibility.