Migrating SFAndroid to iDempiere

The migration of Adempiere modules to iDempiere

Migrating SFAndroid to iDempiere

Postby red1 » Tue Jul 30, 2013 7:14 am

The server-side part of the SFAndroid is now fully converted to an OSGi plugin for iDempiere. It is not fully tested in operations yet. At least we now have some insights into its creators' minds. (And now the creators did it again and this time we planned to go into the operations of it).

Screen Shot 2013-08-07 at 7.39.57 AM.png
Screen Shot 2013-08-07 at 7.39.57 AM.png (67.7 KiB) Viewed 22186 times

Screen Shot 2013-08-07 at 7.41.13 AM.png
Screen Shot 2013-08-07 at 7.41.13 AM.png (63.52 KiB) Viewed 22186 times

The code has to be upgraded because iDempiere has changed core and models since ADempiere 361 of which SFAndroid is created on.

Firstly some of the SFAndroid changes to the model core classes has to be refactored. Following HengSin's advice, any change to core should not be written this way:
Code: Select all
public class MClientInfo extends X_ClientInfo
but this way:
Code: Select all
public class MClientInfo extends org.compiere.model.MClientInfo

The packages are local and unique except for the last one referring to the same core package. Formerly we overload the same package and same classes MClientInfo and X_ClientInfo with I_ClientInfo. Now we just wrap I_ClientInfo new properties with POWrapper:
Code: Select all
      //   Dixon Martinez Menu Mobile System
      //      setAD_Tree_SF_SyncMenu_ID(SF_SyncMenu_ID);
      //hengsin - using POWrapper (extends core M<Class>)
      I_AD_ClientInfo iinfo = POWrapper.create(this, I_AD_ClientInfo.class);
      iinfo.setAD_Tree_SF_SyncMenu_ID(SF_SyncMenu_ID);
      //   End Dixon Martinez

This is at line 184 of MClientInfo class. You can find the source at https://bitbucket.org/red1/org.idempier ... oid-server.
The source from the original SFAndroid developers are at https://bitbucket.org/selem

A work-in-progress project guide is uploaded to my main repository of final binaries and backup files: https://sourceforge.net/projects/red1/f ... SFAndroid/ (look for SFAndroid.pdf). Please read that completely before asking me anything.
The Eclipse IDE plugin package explorer is screenshot below.

Screen Shot 2013-07-30 at 7.22.15 AM.png
Screen Shot 2013-07-30 at 7.22.15 AM.png (46.97 KiB) Viewed 22243 times

The MANIFEST.MF contains the plugin.xml extensions for the processes within the source. The OSGi component.xml is for the ModelFactory to register the model classes. The dependencies for the plugin are also displayed and set in the MANIFEST.MF.
Callouts are also transferred from the AD's Table and Column meta-data to extensions as defined in the plugin.xml
If there are any suggestions, ideas or comments just reply below here. If you registered in this forum you have to send me an email so i can approve you. Email me at red1@red1.org. If you have an error while using the code, raise a ticket at https://sourceforge.net/p/red1/tickets/.

All and any information possibly needed is always made available for the freedom to improve and that is the idea I post everything online. If it is already published, some time Google-ing will get you there. Do that before asking in any forum. Getting someone's personal time to help you is not free and you have to pay. And time is not a extensible commodity so do your home-work. That is a more scalable commodity.

This effort is sponsored by SYSNOVA, the largest ADempiere/iDempiere implementor consulting company and contributor in Bangladesh.
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Tue Aug 06, 2013 3:32 pm

With Deepak Pansheriya's close attention and fast help, we now have the SFAndroid-3ews (Web-service for SFAndroid Mobile) plugin for iDempiere and based on CXF. It is tested accessible via SOAP UI (see next post below). Source is in bitbucket under CXF branch. The binary plugin is in my SF/red1 repo with the others above (download the SFAndroidWS<version>.jar).

The migration involves putting the original source into a new Plugin project (committed as main default), switching from XFire to CXF framework and removing redundant dependencies when referencing org.idempiere.webservices plugin (committed into present CXF branch).

Later we will test the mobile to work off this WS launched under iDempiere. If this is successful, the main proof of concept is finished. The Mobile app side is independent and merely talks to this WS. iDempiere WS also allow the latest WS improvements to be reused by the mobile app development team right away. Below is the screenshot of the Eclipse IDE layout of the plugin.

Screen Shot 2013-08-08 at 6.44.39 AM.png
Screen Shot 2013-08-08 at 6.44.39 AM.png (65.97 KiB) Viewed 22174 times
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Thu Aug 08, 2013 6:58 am

Here i put the successful setting of the MANIFEST file of SFAndroidWS plugin.

Screen Shot 2013-08-08 at 6.47.34 AM.png
Screen Shot 2013-08-08 at 6.47.34 AM.png (50.5 KiB) Viewed 22174 times

Here below shows the plugin good working when START <bundle ID> (include in the stack during RUN AS in Eclipse IDE).
Screen Shot 2013-08-08 at 6.51.56 AM.png
Screen Shot 2013-08-08 at 6.51.56 AM.png (37.09 KiB) Viewed 22174 times

i can then access the services as below with the respective URLs at my browser:

Screen Shot 2013-08-08 at 6.52.16 AM.png
Screen Shot 2013-08-08 at 6.52.16 AM.png (52.75 KiB) Viewed 22174 times

Screen Shot 2013-08-08 at 6.51.20 AM.png
Screen Shot 2013-08-08 at 6.51.20 AM.png (114.86 KiB) Viewed 22174 times

Using SOAP UI, pointing to the last WDSL, we can run a test.

Screen Shot 2013-08-08 at 6.55.08 AM.png
Screen Shot 2013-08-08 at 6.55.08 AM.png (58.42 KiB) Viewed 22174 times
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Tue Aug 13, 2013 1:21 pm

But before that WS plugin can work on iDempiere, the present web-services must export some dependencies.
Code: Select all
diff --git a/org.idempiere.webservices/META-INF/MANIFEST.MF b/org.idempiere.webservices/META-INF/MANIFEST.MF
--- a/org.idempiere.webservices/META-INF/MANIFEST.MF
+++ b/org.idempiere.webservices/META-INF/MANIFEST.MF
@@ -19,7 +19,6 @@
  javax.xml.soap;version="1.3.0",
  org.apache.commons.codec.binary;version="1.3.0",
  org.apache.commons.logging;version="1.1.1",
- org.apache.commons.logging.impl;version="1.1.1",
  org.apache.xerces.dom;version="2.9.0",
  org.apache.xerces.dom.events;version="2.9.0",
  org.apache.xerces.dom3.as;version="2.9.0",
@@ -80,7 +79,8 @@
  WEB-INF/lib/axis.jar,
  WEB-INF/lib/commons-discovery-0.5.jar,
  WEB-INF/lib/jsr311-api-1.1.jar
-Export-Package: javax.ws.rs,
+Export-Package: com.trekglobal.ws,
+ javax.ws.rs,
  javax.ws.rs.core,
  javax.ws.rs.ext,
  javax.wsdl,
@@ -155,6 +155,13 @@
  org.apache.commons.discovery.resource.classes,
  org.apache.commons.discovery.resource.names,
  org.apache.commons.discovery.tools,
+ org.apache.cxf,
+ org.apache.cxf.jaxws,
+ org.apache.cxf.jaxws.spring,
+ org.apache.cxf.transport.servlet,
+ org.apache.cxf.xmlbeans,
+ org.apache.cxf.jaxrs.ext,
+ org.apache.cxf.transport.servlet,
  org.apache.xmlbeans,
  org.apache.xmlbeans.impl.common,
  org.apache.xmlbeans.impl.config,
@@ -208,5 +215,6 @@
  org.idempiere.adinterface,
  org.idempiere.webservices,
  org.idempiere.webservices.client,
- org.idempiere.webservices.fault
+ org.idempiere.webservices.fault,
+ org.springframework.web.context
Web-ContextPath: ADInterface

Deepak has raised a request here https://idempiere.atlassian.net/browse/IDEMPIERE-1277. Merged successfully into core code and built green in Jenkins Daily Build.
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Mon Aug 19, 2013 6:39 pm

The original variant or parent source of SFAndroid is here http://bitbucket.org/selem/SFAndroid but it has its operational code in another branch which i merged and resolved all its initial code conflicts here http://bitbucket.org/red1/sfandroid.
At the moment it seems to be private due to the constraint setting placed by the parent i forked from. I will definitely make it open at a later stage. Meanwhile anyone wishing to collaborate can post here what you want to do and your bitbucket ID for me to allow access to.

I recently made a developer environment overview in a movie:



Again take the latest SFAndroid.pdf which is now at v1.8 http://sourceforge.net/projects/red1/fi ... f/download
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Wed Nov 06, 2013 5:41 pm

The SFAndroid mobile client I took and edit a bit from bitbucket.org/selem/sfandroid which does not allow public forks is now pushed as a new fork https://bitbucket.org/red1/sfandroidmobile
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby slowisfast168 » Thu Nov 07, 2013 9:09 pm

Hi Red1,

I followed your guide and everything seems fine but the web services.
I can't access it through browser:
Image

I have checked in osgi console that the sfandroidws buddle is running.
Image

Could you give me some advice what's wrong on my side?

PS: I can acess on my server for the idempiere web service: http://localhost:8090/ADInterface/services/
it works as expected.

Thanks,
Alex Yang
Attachments
buddleStatus.png
buddleStatus.png (52.21 KiB) Viewed 21728 times
webservice.png
webservice.png (53.13 KiB) Viewed 21728 times
slowisfast168
 
Posts: 3
Joined: Wed Nov 06, 2013 4:41 pm

Re: Migrating SFAndroid to iDempiere

Postby red1 » Thu Nov 07, 2013 11:28 pm

Follow my manual closely and check everything. There maybe some setting you can play with.
Try refresh the WS bundle and see if you get the log messages that it is publishing as displayed on page 36 of my manual.
I just tested it on my binary and it still works. I can get the services pages as stated in my manual.
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby slowisfast168 » Sat Nov 09, 2013 9:29 am

Hi Red1,

Yes, your binary works. I just downloaded the jar from your sourceforge and tried.

But your bitbucket repo seems don't work. with the same server I started from eclipse, source afandroidws doesn't work but install your binary works. I guess the problem may due to your classpath changed.

I compared with the source buddle and binary buddle, the classpath is not the same:
Bundle Location inputstream:org.idempiere.SFAndroidWS_1.0.0.201309100507.jar
Last Modification Sat Nov 09 08:57:31 CST 2013
Start Level 1
Bundle Classpath .,WEB-INF/lib/erpconsultores.jar,WEB-INF/lib/cxf-rt-frontend-jaxws-2.6.1.jar

but with source, there is no Bundle Classpath set in the buddle.

Please kindly check.

Thanks,
Alex
slowisfast168
 
Posts: 3
Joined: Wed Nov 06, 2013 4:41 pm

Re: Migrating SFAndroid to iDempiere

Postby red1 » Sat Nov 09, 2013 12:26 pm

My build revision number pushed to bitbucket is 8620 - http://bitbucket.org/red1/org.idempiere.sfandroidws
Same as my Eclipse IDE revision and it can still work here. Anyway i give you my classpath to see if you can give any more clues. If you need any more info about my env please ask to get to the bottom of it. Thanks.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
   <classpathentry exported="true" kind="lib" path="WEB-INF/lib/erpconsultores.jar"/>
   <classpathentry exported="true" kind="lib" path="WEB-INF/lib/cxf-rt-frontend-jaxws-2.6.1.jar"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
   <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
   <classpathentry kind="src" path="WEB-INF/src"/>
   <classpathentry kind="output" path="bin"/>
</classpath>
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby sjeffen » Tue Nov 12, 2013 6:24 pm

Hi
I have been able to get the Client and Server up and running, but I’m not able to connect them through the web service! So I’m using soapUI for testing and I’m able to get an return from the getVersion service, but I’m only getting an error for the InitialLoad service, the response is “Fault occurred while processing.” Doing some debugging in Eclipse, I noticed that in the function InitialLoadResponseDocument InitialLoad(InitialLoadDocument req), the variable req comes in with a null value and that is throwing an exception!

Added the exception from Eclipse!

nov 12, 2013 11:07:37 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Application {http://www.erpconsultoresasociados.com/}AppDroidServices#{http://www.erpconsultoresasociados.com/}InitialLoad has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:64)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:221)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:141)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.mb.appdroid.MAppDroidServicesImpl.validateuser(MAppDroidServicesImpl.java:145)
at org.mb.appdroid.AppDroidServicesImpl.InitialLoad(AppDroidServicesImpl.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
... 34 more

Does this sounds familiarly and does anybody know how to fix this issue?

Regards

Flemming
sjeffen
 
Posts: 3
Joined: Thu Nov 17, 2011 6:31 pm

Re: Migrating SFAndroid to iDempiere

Postby red1 » Wed Nov 13, 2013 5:57 am

I hit key troubles during such work and i write things somewhere in my manual. Please understand that i tried to document as much as possible in there and users must read it with a fine comb for the clues. In the end it worked perfectly.
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby sjeffen » Wed Nov 13, 2013 8:34 pm

Hi

I have read your manual and I do acknowledge the huge effort that has been put into this, that can’t be understated! With that in mind, I will say that I have not been able to figure out a solution for the issue I have encountered and I humble raise this question in this forum after several days of work, in order to hear if anybody have come across this issue and had a solution for it or if someone would be able to direct me in the right direction!

Regards

Flemming
sjeffen
 
Posts: 3
Joined: Thu Nov 17, 2011 6:31 pm

Re: Migrating SFAndroid to iDempiere

Postby slowisfast168 » Wed Nov 13, 2013 10:59 pm

Hi Red1,

It works now. I switched the branch from default to CXF. :)

Thanks,
Alex Yang
slowisfast168
 
Posts: 3
Joined: Wed Nov 06, 2013 4:41 pm

Re: Migrating SFAndroid to iDempiere

Postby sjeffen » Fri Nov 15, 2013 1:20 am

Hi
After spending some more time reading and digging into the fabulous manual, I discovered on page 36 in the screen shot of soapUI that the message contained 2 elements of InitialLoad and not only 1 element as the one generated by soapUI!

This is the message generated by soapUI, and this one does not work:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:erp="http://www.erpconsultoresasociados.com/">
<soapenv:Header/>
<soapenv:Body>
<erp:InitialLoad>
<erp:user>GardenAdmin</erp:user>
<erp:pass>GardenAdmin</erp:pass>
</erp:InitialLoad>
</soapenv:Body>
</soapenv:Envelope>

This works!

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:erp="http://www.erpconsultoresasociados.com/">
<soapenv:Header/>
<soapenv:Body>
<erp:InitialLoad>
<erp:InitialLoad>
<erp:user>GardenAdmin</erp:user>
<erp:pass>GardenAdmin</erp:pass>
</erp:InitialLoad>
</erp:InitialLoad>
</soapenv:Body>
</soapenv:Envelope>

So the outstanding question is now, is this a feature of soapUI? And the screenshot on page 36, is this handcrafted or how do you get soapUI to give the displayed message?

Regards

Flemming
sjeffen
 
Posts: 3
Joined: Thu Nov 17, 2011 6:31 pm

Re: Migrating SFAndroid to iDempiere

Postby red1 » Sun Jan 12, 2014 10:35 am

Hi Flemming,
You know what makes my day? It is when someone really use and read what i publish! :)
OK, now that you solved it and provided your feedback, that is fantastic. Do keep posting if you find anything further.
As of what you posted i still not sure why it is so. It does work on mine as i tested and obtain those screen-shots as proof. But i do recall that there are so many hiccups along the way and that is why i document as much as possible. But there must be variables we have not encountered or I missed as too trivial to have documented.
So thank you once again!
Have a nice weekend!

red1
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Migrating SFAndroid to iDempiere

Postby red1 » Thu Mar 03, 2016 8:05 am

Middle of last year, in Moscow, i have also converted Spinsuite (the new upgraded version from SFAndroid by Venezuelean team of Yamel Senih and Carlos Parada) and documented it here viewtopic.php?f=45&t=1810.
red1
Site Admin
 
Posts: 2760
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia


Return to iDempiere

Who is online

Users browsing this forum: No registered users and 1 guest

cron