web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Whenever I create a customer, Delete, modify Customer Through web Service below error is shown An exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll but was not handled in user code

(0) ShareShare
ReportReport
Posted on by 60

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace WebApplication1
{
using Customerservice;
class program
{
public string printcustomerlist(Customer_Service service,List<Customer_Filter> filter)
{
StringBuilder sb=new StringBuilder();
sb.AppendLine("Printing Customer list");
Customer[] list = service.ReadMultiple(filter.ToArray(), null, 100);
foreach(Customer c in list)
{
sb.AppendLine(printcustomer(c));
}
return sb.ToString();
}
static string printcustomer(Customer c)
{
return "No:{"+c.No+"} Name:{"+c.Name+"} Bus.Pos.Group:{"+c.Gen_Bus_Posting_Group+"} Cust.Pos.Group: {"+c.Customer_Posting_Group+"}";
}
public void Createcustomer(string no,string name,Customer_Service service, string genbusposg, string Custposg)
{
Customer cust = new Customer();
cust.Name = name;
service.Create(ref cust);
cust.No = no;
cust.Gen_Bus_Posting_Group = genbusposg;
cust.Customer_Posting_Group = Custposg;
service.Update(ref cust);
}
public void deletecustomer(string no, Customer_Service service)
{
List<Customer_Filter> FilterArray = new List<Customer_Filter>();
Customer_Filter nofilter= new Customer_Filter();
nofilter.Field = Customer_Fields.No;
nofilter.Criteria = no;
FilterArray.Add(nofilter);
Customer[] custlist = service.ReadMultiple(FilterArray.ToArray(), null, 1);
service.Delete(custlist[0].Key);
}
public void Modifycustomer(string no,string name,Customer_Service service, string genbusposg, string Custposg)
{
List<Customer_Filter> FilterArray = new List<Customer_Filter>();
Customer_Filter nofilter = new Customer_Filter();
nofilter.Field = Customer_Fields.No;
nofilter.Criteria = no;
FilterArray.Add(nofilter);
Customer[] custlist = service.ReadMultiple(FilterArray.ToArray(), null, 1);
custlist[0].Name = name;
custlist[0].Gen_Bus_Posting_Group = genbusposg;
custlist[0].Customer_Posting_Group = Custposg;
service.Update(ref custlist[0]);
}
}
public partial class Service : System.Web.UI.Page
{
program a = new program();
Customer_Service service = new Customer_Service();
List<Customer_Filter> FilterArray = new List<Customer_Filter>();

protected void Page_Load(object sender, EventArgs e)
{
service.UseDefaultCredentials = true;
Customerbox.Text = a.printcustomerlist(service, FilterArray);
}
protected void Dcustbutton_Click(object sender, EventArgs e)
{
service.UseDefaultCredentials = true;
a.deletecustomer(CustNoBox.Text, service);
Customerbox.Text = a.printcustomerlist(service, FilterArray);
}

protected void Ccustbutton_Click(object sender, EventArgs e)
{
service.UseDefaultCredentials = true;
a.Createcustomer(CustNoBox.Text,CustnameBox.Text, service, CustomerGenBusPostingGroup.SelectedValue.ToString(), CustPostingGroup.SelectedValue.ToString());
Customerbox.Text = a.printcustomerlist(service, FilterArray);
}

protected void MCustbotton_Click(object sender, EventArgs e)
{
service.UseDefaultCredentials = true;
a.Modifycustomer(CustNoBox.Text,CustnameBox.Text, service, CustomerGenBusPostingGroup.SelectedValue.ToString(), CustPostingGroup.SelectedValue.ToString());
Customerbox.Text = a.printcustomerlist(service, FilterArray);
}

}
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    RockwithNav Profile Picture
    8,637 Super User 2025 Season 2 on at

    Did you debugged, seems it has nothing to do with NAV as even u wont be getting 200 response I belief.

    Was this working before OR never worked?

    If its hitting then you need to check for certain customisation as in standard NAV theirs nothing dll that gets called. 

  • Kishor T Profile Picture
    60 on at

    the above code developed throw asp.net web form by using web service if try to insert Customer record in nav using asp.net  above error occurs

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans