Inserting a record from Android into Navsion through SOAP Webservice

I am trying to insert a record into Navion through SOAP web Service, I am using Ksoap2 library for making SOAP calls

Below is the TableClass

Public class ESignOrderXSD implements KvmSerializable,Serializable {
public String Key;
public String Ship_To_PO_No;
public String Customer_PO_No;
public String Ship_to_Name;
public int Entry_No;
public String Mobile_Comment;
public String Sell_to_Customer_No;
public String No;
public String Shipment_Date;
public String Ship_to_Code;
public String Sell_to_Customer_Name;
public String BabaBaba;

@Override
public Object getProperty(int i) {
switch (i){
case 0:
return Entry_No;
case 1:
return Sell_to_Customer_No;
case 2:
return No;
case 3:
return Ship_to_Code;
case 4:
return Ship_to_Name;
case 5:
return Shipment_Date;
case 6:
return Sell_to_Customer_Name;
case 7:
return Customer_PO_No;
case 8:
return Ship_To_PO_No;
case 9:
return Mobile_Comment;
case 10:
return BabaBaba ;
default: return null;

}

}

@Override
public int getPropertyCount() {
return 14;
}

@Override
public void setProperty(int i, Object o) {
switch (i){
case 0:
this.Entry_No= (Integer)o;
break;
case 1:
this.Sell_to_Customer_No= (String)o;
break;
case 2:
this.No= (String)o;
break;
case 3:
this.Ship_to_Code= (String)o;
break;
case 4:
this.Ship_to_Name = (String)o;
break;
case 5:
this.Shipment_Date = (String)o;
break;
case 6:
this.Sell_to_Customer_Name= (String)o;
break;
case 7:
this.Customer_PO_No= (String)o;
break;
case 8:
this.Ship_To_PO_No = (String)o;
break;
case 12:
this.Mobile_Comment= (String)o;
break;
case 13:
this.BabaBaba = (String)o;
break;
}
}

@Override
public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo propertyInfo) {

switch (i){
case 0:
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
propertyInfo.name = "Entry_No";
break;
case 1:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name= "Sell_to_Customer_No";
break;
case 2:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name= "No";
break;
case 3:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name= "Ship_to_Code";
break;
case 4:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Ship_to_Name";
break;
case 5:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Shipment_Date";
break;
case 6:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Sell_to_Customer_Name";
break;
case 7:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Customer_PO_No";
break;
case 8:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Ship_To_PO_No";
break;
case 12:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Mobile_Comment";
break;
case 13:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "BabaBaba";
break;
}

}
}
Here Entry_No is the primary key of the table and its auto incremented
and I am creating a new object of ESignOrderXSD like below

ESignOrderXSD eSignOrderXSD = new ESignOrderXSD();
eSignOrderXSD.setProperty(3,"Test SOPA");

and when I try to post this data i am getting the follwing error

SoapFault - faultcode: 'a:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException' faultstring: 'You cannot change the value of an AutoIncrement field.
Field: Entry No.
Table: e-Sign Order
Identification fields and values:
Entry No.='0'' faultactor: 'null' detail: org.kxml2.kdom.Node@4175b9a

becuse since Entry_No is an int datatype its assing 0
but if i create a object without Entry_No then its showing

Entry_No cannot be null or Empty so how to create a new record using SOAP webservice in Navsion

Answers

  • GudmundurGudmundur Member Posts: 2
    Hi, I think you need to set "Entry No" to 0 before insert. Just my 5 cents, I don't see if you already are.

    Kind regards, Gudmundur
  • zohaibu95@hotmail.comzohaibu95@hotmail.com Member Posts: 223
    You need to set "Entry No" to 0 before insert.
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
Sign In or Register to comment.