2022

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

8.Now change the relevant values in the appcode-deploy.xml file to point to the relevant locations and set the necessary properties

Code Block


<!-- set global properties for this build -->
<!-- Setup Deployment specific properties -->
<property name="appcode.name" value="MyTestMsNavSvc" /> 
– The name of the appcode project —
<property name="appcode" location="/AvankiaWS2/MyAppCodeSvc"/>
— The location of the appcode project in your machine —
<property name="environment" value="sandbox" />
— The environment under which the jars will be deployed in dbsync2 ( folder under the profile folder) —
<property name="profile" value="profile_test" />
---- Name of the profile ----
<property name="dbsync.server.url" value="http://localhost:8080/dbsync2"/>
— DBSync2 server URL -----
<property name="dbsync.server.username" value="localhost@avankia.com"/>
— DBSync2 UID ----
<property name="dbsync.server.password" value="avankia"/>
---- DBsync2 Password — 

...

9. Assuming we are trying to do a a SOAP call in our AppCode Service implementation, we need to run a wsimport task to download the binding classes into our project and for future use for reading, writing and getmetadata operations

Code Block

<!-- Additional properties to pass the wsdl filenames -->
<property name="customer_wsdl" value="Customer.wsdl"> </property>
<property name="salesinv_wsdl" value="SalesInvoice.wsdl"> </property> 
<!-- added for running wsimport -->
<property name="java_home" value="/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home"/> 

<target name="wsimport" depends="init">
<exec executable="$\{java_home\}/bin/wsimport">
<arg line="-keep -s $\{appcode\}/generated-src -d $\{appcode\}/generated-classes $\{appcode\}/$\{customer_wsdl\}"/>
</exec> 
<exec executable="$\{java_home\}/bin/wsimport">
<arg line="-keep -s $\{appcode\}/generated-src -d $\{appcode\}/generated-classes $\{appcode\}/$\{salesinv_wsdl\}"/>
</exec> 
<jar destfile="$\{appcode.lib\}/generatedwsdlclasses.jar" basedir="$\{appcode\}/generated-classes"/>
</target> 

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="$\{deploy.dir\}"/>
<mkdir dir="$\{compile.dir\}"/>
<mkdir dir="$\{deploy.dir\}/zip"/>
<!-- add src and target files -->
<delete dir="$\{appcode\}/generated-src"/>
<delete dir="$\{appcode\}/generated-classes"/>
<mkdir dir="$\{appcode\}/generated-src"/>
<mkdir dir="$\{appcode\}/generated-classes"/> 

<delete file="$\{deploy.dir\}/$\{appcode.name\}.jar"></delete> 
<delete file="$\{deploy.dir\}/zip/$\{appcode.name\}.zip"></delete> 
<delete file="$\{appcode.lib\}/generatedwsdlclasses.jar"></delete> 
</target> 



Run the ant task with target as wsimport to generate the SOAP binding classes along with the classes and source code


You can see the sample output below:

10. Now you can start using the generated classes in your AppCode project



Note: Due to limitations in the existing DbSync mapping algorithm which cannot allow certain nested hierarchies, we need to create DBSync Compatible Wrapper classes to allow the metadata binding with the conversion processor
Please refer to msnav2013 project where we have created necessary wrapper classes to do the metadata binding

The main functions of the wrapper classes are to convert from the DBSync compatible type to the underlying SOAP type and Vice Versa

Code Block

 public class Customer {\\

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp; <properties
and methods>{color}\\ \\

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:7f0055}{*}public{*}{color} {color:7f0055}{*}static{*}{color} {color:lack}methods
public static Customer createCustomer(CustomerCard{color} {color:6a3e3e}card{color}{color:lack}) {{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Customer{color}{color:6a3e3e}newObject{color} {color:lack}={color} {color:7f0055}{*}new{*}{color} {color:lack}Customer newObject = new Customer();{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:6a3e3e}newObject{color}{color:lack}.setKey({color}{color:6a3e3e}card{color}{color:lack}.getKey());{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:6a3e3e}newObject{color}{color:lack}.setNo({color}{color:6a3e3e}card{color}{color:lack}.getNo());{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ////Set other attributes{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:7f0055}{*}return{*}{color} {color:6a3e3e}newObject{color}{color:lack};{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;
}{color}\\

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:7f0055}{*}public{*}{color} {color:7f0055}{*}static{*}{color} {color:lack}CustomerCard createCustomerCard(Customer{color} {color:6a3e3e}customer{color}{color:lack}){color} {color:7f0055}{*}throws{*}{color} {color:lack}DatatypeConfigurationException {{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CustomerCard{color}{color:6a3e3e}card{color} {color:lack}={color} {color:7f0055}{*}new{*}{color} {color:lack}CustomerCard card = new CustomerCard();{color}
 {color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:6a3e3e}card{color}{color:lack}.setKey({color}{color:6a3e3e}customer{color}{color:lack}.getKey());{color}
 {color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:6a3e3e}card{color}{color:lack}.setNo({color}{color:6a3e3e}customer{color}{color:lack}.getNo());{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}  
//set other attributes{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{color} {color:7f0055}{*}return{*}{color} {color:6a3e3e}card{color}{color:lack};{color}

{color:lack}&nbsp;&nbsp;&nbsp;&nbsp;
}{color}

{color:lack}}{color}

...


public class Customer {

     <properties and methods>

...