iDempiere 2.1 provide Web Service (WS) interfaces over SOAP and REST. The user can use the WS in order to create, update and view the Records in DB Table.
WebService Request XML is managed by XML Schema strictly. I needed to modify this XML Schema, and I researched how to generate Data-binding Java classes to parse Request XML depending on XML Schema.
○ Environment:
[iDempiere]Version: 2.1
[Eclipse]
Pleiades 4.5 Mars
[OS]
Windows 7 SP1
iDempiere 2.1 uses xmlbeans-2.5.0 to parse Request XML. The Data-binding Java classes are stored in idempiere-xmlbeans-1.0.jar at @WORKSPACE@\org.idempiere.webservices\WEB-INF\lib. I had to re-create idempiere-xmlbeans-1.0.jar after updating XML schema in order to reflect schema change to iDempiere WebService actually. I could use xmlbeans Ant Task to create Data-binding Java classed from XML Schema.
○ Create a Project for idempiere-xmlbeans
First of all, I created a new eclipse project for idempiere-xmlbeans like the below.2. idempiere-schema.xsd - Request XML Schema. I found its original file at @WORKSPACE@\org.idempiere.webservices\WEB-INF\xsd and modified and copied it here.
3. xmlbeans-2.5.0.jar - xmlbeans jar iDempiere 2.1 is using. I found it at @WORKSPACE@\org.idempiere.webservices\WEB-INF\lib and copied it here.
○ Execution of Ant Task to generate Xmlbeans Data-binding Java classes
I wrote in build.xml like the below.
<?xml version="1.0" encoding="UTF-8"?>
<project default="xmlbeans_build" name="build">
<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="lib/xmlbeans-2.5.0.jar" />
<target name="xmlbeans_build">
<xmlbean schema="idempiere-schema.xsd" destfile="idempiere-xmlbeans-1.0.jar"/>
</target>
</project>
Then I execute Ant build by eclipse Ant Runner. I add xmlbean-2.5.0.jar into classpath for Ant like the below.
Ant showed console messages like the below. I was successful to create the new idempiere-xmlbeans-1.0.jar file.
<?xml version="1.0" encoding="UTF-8"?>
<project default="xmlbeans_build" name="build">
<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="lib/xmlbeans-2.5.0.jar" />
<target name="xmlbeans_build">
<xmlbean schema="idempiere-schema.xsd" destfile="idempiere-xmlbeans-1.0.jar"/>
</target>
</project>
Buildfile: @WORKSPACE@\idempiere-xmlbeans\build.xml
xmlbeans_build:
[xmlbean] Time to build schema type system: 2.53 seconds
[xmlbean] Time to generate code: 0.853 seconds
[xmlbean] Compiling 90 source files to @HOMEPATH@\AppData\Local\Temp\xbean1594992734447386704.d\classes
[xmlbean] warning: [options] bootstrap class path not set in conjunction with -source 1.4
[xmlbean] 1 warning
[xmlbean] Time to compile code: 5.379 seconds
[xmlbean] Building jar: @WORKSPACE@\idempiere-xmlbeans\idempiere-xmlbeans-1.0.jar
BUILD SUCCESSFUL
Total time: 14 seconds
0 件のコメント:
コメントを投稿